Capture original source for literals

Authored by alanz.

Description

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

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: Trac #9628

Details

Auditors
thomie
Committed
austinNov 21 2014, 1:24 PM
Reviewer
simonpj
Differential Revision
D412: Capture original source for literals
Parents
rGHCa97f90cecb63: Add Data.Void to base (re #9814)
Branches
Unknown
Tags
Unknown
Build Status
Buildable 2175
Build 2185: GHC Continuous Integration (amd64/Linux)
thomie raised a concern with this commit.Jul 4 2015, 8:00 AM
thomie added a subscriber: thomie.
thomie added inline comments.
/compiler/parser/Lexer.x
1354

When enabling the -fwarn-unused-matches check, this results in:

compiler/parser/Lexer.x:1364:3: warning:

Defined but not used: ‘end’
1359

This requires -fno-warn-incomplete-patterns. It would be nice to not need that for this file.

alanz marked 2 inline comments as done.Jul 6 2015, 4:14 AM

Done

thomie accepted this commit.Jul 6 2015, 5:13 AM

Thanks.