1. 21 Jan, 2018 1 commit
    • Takenobu Tani's avatar
      Implement underscores in numeric literals (NumericUnderscores extension) · 4a13c5b1
      Takenobu Tani authored
      Implement the proposal of underscores in numeric literals.
      Underscores in numeric literals are simply ignored.
      
      The specification of the feature is available here:
      https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/000
      9-numeric-underscores.rst
      
      For a discussion of the various choices:
      https://github.com/ghc-proposals/ghc-proposals/pull/76
      
      Implementation detail:
      
      * Added dynamic flag
        * `NumericUnderscores` extension flag is added for this feature.
      
      * Alex "Regular expression macros" in Lexer.x
        * Add `@numspc` (numeric spacer) macro to represent multiple
          underscores.
        * Modify `@decimal`, `@decimal`, `@binary`, `@octal`, `@hexadecimal`,
          `@exponent`, and `@bin_exponent` macros to include `@numspc`.
      
      * Alex "Rules" in Lexer.x
        * To be simpler, we have only the definitions with underscores.
          And then we have a separate function (`tok_integral` and `tok_frac`)
          that validates the literals.
      
      * Validation functions in Lexer.x
        * `tok_integral` and `tok_frac` functions validate
          whether contain underscores or not.
          If `NumericUnderscores` extensions are not enabled,
          check that there are no underscores.
        * `tok_frac` function is created by merging `strtoken` and
          `init_strtoken`.
        * `init_strtoken` is deleted. Because it is no longer used.
      
      * Remove underscores from target literal string
        * `parseUnsignedInteger`, `readRational__`, and `readHexRational} use
          the customized `span'` function to remove underscores.
      
      * Added Testcase
        * testcase for NumericUnderscores enabled.
            NumericUnderscores0.hs and NumericUnderscores1.hs
        * testcase for NumericUnderscores disabled.
            NoNumericUnderscores0.hs and NoNumericUnderscores1.hs
        * testcase to invalid pattern for NumericUnderscores enabled.
            NumericUnderscoresFail0.hs and NumericUnderscoresFail1.hs
      
      Test Plan: `validate` including the above testcase
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: carter, rwbarton, thomie
      
      GHC Trac Issues: #14473
      
      Differential Revision: https://phabricator.haskell.org/D4235
      4a13c5b1
  2. 21 Dec, 2017 1 commit
    • Ryan Scott's avatar
      Fix #14588 by checking for more bang patterns · 9caf40e9
      Ryan Scott authored
      Summary:
      Commit 37299536
      inadvertently removed a check in the parser which rejected
      let-bindings with bang patterns, leading to #14588. This fixes it by
      creating a `hintBangPat` function to perform this check, and
      sprinkling it in the right places.
      
      Test Plan: make test TEST=T14588
      
      Reviewers: bgamari, alanz, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #14588
      
      Differential Revision: https://phabricator.haskell.org/D4270
      9caf40e9
  3. 15 May, 2017 1 commit
  4. 29 Mar, 2017 1 commit
  5. 13 Mar, 2017 1 commit
  6. 06 Mar, 2017 1 commit
  7. 03 Mar, 2017 2 commits
  8. 19 May, 2016 1 commit
  9. 19 Feb, 2016 1 commit
    • thomie's avatar
      Modifier letter in middle of identifier is ok · d738e664
      thomie authored
      Refactoring only. Cleanup some loose ends from #10196.
      
      Initially the idea was to only allow modifier letters at the end of
      identifiers. Since we later decided to allow modifier letters also in
      the middle of identifiers (because not doing so would not fix the
      regression completely), the names `suffix` and `okIdSuffixChar` don't
      seem appropriate anymore.
      
      Remove TODO. Move test from should_fail to should_compile.
      d738e664
  10. 17 Feb, 2016 1 commit
  11. 22 Oct, 2015 1 commit
  12. 08 Oct, 2015 1 commit
    • thomie's avatar
      Parser: revert some error messages to what they were before 7.10 · e2b579e8
      thomie authored
      Among doing other things, Phab:D201 (bc2289e1)
      tried to improve the error messages thrown by the parser. For example a missing
      else clause now prints "parse error in if statement: else clause empty" instead
      of "parse error (possibly incorrect indentation or mismatched brackets)".
      
      Some error messages got much worse however (see tests), and the result seems to
      be a net negative. Although not entirely satisfactory, this commits therefore
      reverts those parser changes.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D1309
      
      GHC Trac Issues: #10498
      e2b579e8
  13. 03 Jul, 2015 1 commit
  14. 12 Jun, 2015 1 commit
  15. 09 Jun, 2015 1 commit
  16. 30 Mar, 2015 1 commit
  17. 27 Jun, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add -XBinaryLiterals language extension (re #9224) · 1c0b5fdc
      Herbert Valerio Riedel authored
      Haskell2010 supports
      
      - base-10 (prefix-less),
      - base-8 (via `0[oO]`-prefix), and
      - base-16 (via `0[xX]`-prefix) integer literals.
      
      This commit adds syntax support for base-2 integer literals via the new `0[bB]`
      prefix. The use of a `0b` prefix for indicating binary literals is known
      from popular programming languages such as C++14, Perl, Python, Ruby, and Java.
      
      This syntax extension is disabled by default and can be enabled via the
      new `{-# LANGUAGE BinaryLiterals #-}` pragma and/or the new `-XBinaryLiterals`
      
      This new extensions requires to upgrade the `ExtsBitmap` type from
      `Word` to `Word64` as this adds a 33th flag which is not guaranteed to
      fit into a `Word`.
      Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
      
      Differential Revision: https://phabricator.haskell.org/D22
      1c0b5fdc
  18. 06 Nov, 2013 1 commit
  19. 12 Oct, 2013 2 commits
  20. 11 Oct, 2013 1 commit
  21. 19 Aug, 2013 1 commit
  22. 19 May, 2013 1 commit
  23. 21 Apr, 2013 1 commit
  24. 11 Feb, 2013 1 commit
  25. 01 Feb, 2013 1 commit
  26. 16 Jul, 2012 2 commits
  27. 10 Oct, 2011 1 commit
  28. 27 Sep, 2011 1 commit
  29. 20 Jul, 2011 1 commit
  30. 08 May, 2011 1 commit
  31. 01 Dec, 2010 1 commit
  32. 25 Nov, 2010 2 commits
  33. 20 Nov, 2010 1 commit
  34. 08 Oct, 2010 1 commit
  35. 10 Aug, 2010 1 commit
  36. 08 Aug, 2010 1 commit