diff options
author | simonpj <unknown> | 2002-06-05 14:08:25 +0000 |
---|---|---|
committer | simonpj <unknown> | 2002-06-05 14:08:25 +0000 |
commit | 2145e55a4fbd60c3bd134496d82ddc545bd698ba (patch) | |
tree | 316c1dce0df22aecbc88d079bb71fc193e3583d5 /ghc/compiler/prelude/PrelNames.lhs | |
parent | 84e376bc7bc01799d444cdb2d915d69f36fe77d5 (diff) | |
download | haskell-2145e55a4fbd60c3bd134496d82ddc545bd698ba.tar.gz |
[project @ 2002-06-05 14:08:23 by simonpj]
------------------------------------------------
Fix the (new) lexer, and make the derived read
and show code work according to the new H98 report
------------------------------------------------
The new lexer, based on Koen's cunning parser (Text.ParserCombinators.ReadP)
wasn't quite right. It's all very cool now.
In particular:
* The H98 "lex" function should return the exact string parsed, and it
now does, aided by the new combinator ReadP.gather.
* As a result the Text.Read.Lex Lexeme type is much simpler than before
data Lexeme
= Char Char -- Quotes removed,
| String String -- escapes interpreted
| Punc String -- Punctuation, eg "(", "::"
| Ident String -- Haskell identifiers, e.g. foo, baz
| Symbol String -- Haskell symbols, e.g. >>, %
| Int Integer
| Rat Rational
| EOF
deriving (Eq,Show)
* Multi-character punctuation, like "::" was getting lexed as a Symbol,
but it should be a Punc.
* Parsing numbers wasn't quite right. "1..n" got it confused because it
got committed to a decimal point and then found a second '.'.
* The new H98 spec for Show is there, which ignores associativity.
Diffstat (limited to 'ghc/compiler/prelude/PrelNames.lhs')
-rw-r--r-- | ghc/compiler/prelude/PrelNames.lhs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ghc/compiler/prelude/PrelNames.lhs b/ghc/compiler/prelude/PrelNames.lhs index 8dc8fb908a..dafee0d356 100644 --- a/ghc/compiler/prelude/PrelNames.lhs +++ b/ghc/compiler/prelude/PrelNames.lhs @@ -637,7 +637,7 @@ prec_RDR = varQual_RDR rEAD_PREC_Name FSLIT("prec") -- Module Lex symbol_RDR = dataQual_RDR lEX_Name FSLIT("Symbol") ident_RDR = dataQual_RDR lEX_Name FSLIT("Ident") -single_RDR = dataQual_RDR lEX_Name FSLIT("Single") +punc_RDR = dataQual_RDR lEX_Name FSLIT("Punc") times_RDR = varQual_RDR pREL_NUM_Name FSLIT("*") plus_RDR = varQual_RDR pREL_NUM_Name FSLIT("+") |