[commit: ghc] master: Add -XBinaryLiterals language extension (re #9224) (1c0b5fd)

git at git.haskell.org git at git.haskell.org
Fri Jun 27 18:58:29 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1c0b5fdc9f2b6ea8166cc565383d4cd20432343c/ghc

>---------------------------------------------------------------

commit 1c0b5fdc9f2b6ea8166cc565383d4cd20432343c
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jun 21 11:38:17 2014 +0200

    Add -XBinaryLiterals language extension (re #9224)
    
    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 <hvr at gnu.org>
    
    Differential Revision: https://phabricator.haskell.org/D22


>---------------------------------------------------------------

1c0b5fdc9f2b6ea8166cc565383d4cd20432343c
 compiler/main/DynFlags.hs                          |  2 ++
 compiler/parser/Ctype.lhs                          |  5 +++-
 compiler/parser/Lexer.x                            | 21 ++++++++++++++--
 docs/users_guide/7.10.1-notes.xml                  |  2 +-
 docs/users_guide/flags.xml                         |  6 +++++
 docs/users_guide/glasgow_exts.xml                  | 20 +++++++++++++++
 testsuite/.gitignore                               |  3 +++
 testsuite/tests/driver/T4437.hs                    |  1 +
 .../parser/should_fail/ParserNoBinaryLiterals1.hs  |  5 ++++
 .../should_fail/ParserNoBinaryLiterals1.stderr     |  5 ++++
 .../parser/should_fail/ParserNoBinaryLiterals2.hs  |  9 +++++++
 .../should_fail/ParserNoBinaryLiterals2.stderr     |  5 ++++
 .../parser/should_fail/ParserNoBinaryLiterals3.hs  |  9 +++++++
 .../should_fail/ParserNoBinaryLiterals3.stderr     |  5 ++++
 testsuite/tests/parser/should_fail/all.T           |  3 +++
 .../tests/parser/should_run/BinaryLiterals0.hs     | 19 ++++++++++++++
 .../tests/parser/should_run/BinaryLiterals0.stdout |  1 +
 .../tests/parser/should_run/BinaryLiterals1.hs     | 25 +++++++++++++++++++
 .../tests/parser/should_run/BinaryLiterals1.stdout |  3 +++
 .../tests/parser/should_run/BinaryLiterals2.hs     | 29 ++++++++++++++++++++++
 .../tests/parser/should_run/BinaryLiterals2.stdout |  4 +++
 testsuite/tests/parser/should_run/all.T            |  3 +++
 22 files changed, 181 insertions(+), 4 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1c0b5fdc9f2b6ea8166cc565383d4cd20432343c


More information about the ghc-commits mailing list