X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FLexer.x;h=e891cae73b9ced9e0e28e86a78b4767d7f31957c;hb=a385f0af5ea320a18d580f6a36c59c55b3516efd;hp=b73e430b9aabd531cb6165154b5921bab97d6e91;hpb=1cd9b26ddbc76e67f680b4f58e3452c6708503f1;p=ghc-hetmet.git diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index b73e430..e891cae 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -385,7 +385,7 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") } } <0> { - -- Unboxed ints (:: Int#) + -- Unboxed ints (:: Int#) and words (:: Word#) -- It's simpler (and faster?) to give separate cases to the negatives, -- especially considering octal/hexadecimal prefixes. @decimal \# / { ifExtension magicHashEnabled } { tok_primint positive 0 1 decimal } @@ -395,6 +395,10 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") } @negative 0[oO] @octal \# / { ifExtension magicHashEnabled } { tok_primint negative 3 4 octal } @negative 0[xX] @hexadecimal \# / { ifExtension magicHashEnabled } { tok_primint negative 3 4 hexadecimal } + @decimal \# \# / { ifExtension magicHashEnabled } { tok_primword 0 2 decimal } + 0[oO] @octal \# \# / { ifExtension magicHashEnabled } { tok_primword 2 4 octal } + 0[xX] @hexadecimal \# \# / { ifExtension magicHashEnabled } { tok_primword 2 4 hexadecimal } + -- Unboxed floats and doubles (:: Float#, :: Double#) -- prim_{float,double} work with signed literals @signed @floating_point \# / { ifExtension magicHashEnabled } { init_strtoken 1 tok_primfloat } @@ -533,6 +537,7 @@ data Token | ITprimchar Char | ITprimstring FastString | ITprimint Integer + | ITprimword Integer | ITprimfloat Rational | ITprimdouble Rational @@ -971,6 +976,7 @@ tok_integral itint transint transbuf translen (radix,char_to_int) span buf len = -- some conveniences for use with tok_integral tok_num = tok_integral ITinteger tok_primint = tok_integral ITprimint +tok_primword = tok_integral ITprimword positive positive = id negative = negate decimal = (10,octDecDigit)