[commit: ghc] master: Capture original source for literals (c0ad5bc)

git at git.haskell.org git at git.haskell.org
Fri Nov 21 19:24:47 UTC 2014


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

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

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

commit c0ad5bc03e02ce0d7d545599e4b1a68a6f727f2b
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Fri Nov 21 13:24:30 2014 -0600

    Capture original source for literals
    
    Summary:
    Make HsLit and OverLitVal have original source strings, for source to
    source conversions using the GHC API
    
    This is part of the ongoing AST Annotations work, as captured in
    https://ghc.haskell.org/trac/ghc/wiki/GhcAstAnnotations and
    https://ghc.haskell.org/trac/ghc/ticket/9628#comment:28
    
    The motivations for the literals is as follows
    
    ```lang=haskell
    x,y :: Int
    x = 0003
    y = 0x04
    
    s :: String
    s = "\x20"
    
    c :: Char
    c = '\x20'
    
    d :: Double
    d = 0.00
    
    blah = x
      where
        charH = '\x41'#
        intH = 0004#
        wordH = 005##
        floatH = 3.20#
        doubleH = 04.16##
        x = 1
    ```
    
    Test Plan: ./sh validate
    
    Reviewers: simonpj, austin
    
    Reviewed By: simonpj, austin
    
    Subscribers: thomie, goldfire, carter, simonmar
    
    Differential Revision: https://phabricator.haskell.org/D412
    
    GHC Trac Issues: #9628


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

c0ad5bc03e02ce0d7d545599e4b1a68a6f727f2b
 compiler/deSugar/Check.lhs                         |  18 ++-
 compiler/deSugar/DsMeta.hs                         |  40 +++---
 compiler/deSugar/MatchLit.lhs                      |  90 +++++++------
 compiler/ghc.mk                                    |   2 +
 compiler/hsSyn/Convert.lhs                         |  14 +-
 compiler/hsSyn/HsExpr.lhs                          |   4 +-
 compiler/hsSyn/HsLit.lhs                           | 149 +++++++++++++--------
 compiler/hsSyn/HsPat.lhs                           |   5 +-
 compiler/hsSyn/HsUtils.lhs                         |  14 +-
 compiler/parser/Lexer.x                            |  61 +++++----
 compiler/parser/Parser.y                           |  71 ++++++----
 compiler/parser/RdrHsSyn.hs                        |   4 +-
 compiler/rename/RnExpr.lhs                         |   4 +-
 compiler/rename/RnPat.lhs                          |  11 +-
 compiler/typecheck/Inst.lhs                        |   6 +-
 compiler/typecheck/TcBinds.lhs                     |   3 +-
 compiler/typecheck/TcExpr.lhs                      |   3 +-
 compiler/typecheck/TcGenDeriv.lhs                  |  30 +++--
 compiler/typecheck/TcHsSyn.lhs                     |  39 +++---
 compiler/typecheck/TcInstDcls.lhs                  |   3 +-
 compiler/typecheck/TcRnDriver.lhs                  |   3 +-
 compiler/typecheck/TcSplice.lhs                    |   2 +-
 compiler/typecheck/TcTyClsDecls.lhs                |   2 +-
 .../{landmines => annotations-literals}/.gitignore |   3 +-
 .../ghc-api/annotations-literals/LiteralsTest.hs   |  24 ++++
 .../tests/ghc-api/annotations-literals/Makefile    |  16 +++
 testsuite/tests/ghc-api/annotations-literals/all.T |   2 +
 .../tests/ghc-api/annotations-literals/literals.hs |  43 ++++++
 .../ghc-api/annotations-literals/literals.stdout   | 145 ++++++++++++++++++++
 .../tests/ghc-api/annotations-literals/parsed.hs   | 109 +++++++++++++++
 .../ghc-api/annotations-literals/parsed.stdout     |  12 ++
 31 files changed, 683 insertions(+), 249 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 c0ad5bc03e02ce0d7d545599e4b1a68a6f727f2b


More information about the ghc-commits mailing list