diff options
Diffstat (limited to 'ghc/compiler/parser/Lex.lhs')
-rw-r--r-- | ghc/compiler/parser/Lex.lhs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ghc/compiler/parser/Lex.lhs b/ghc/compiler/parser/Lex.lhs index c86721c9f6..8dae914d65 100644 --- a/ghc/compiler/parser/Lex.lhs +++ b/ghc/compiler/parser/Lex.lhs @@ -128,6 +128,7 @@ data Token | ITlabel | ITdynamic | ITunsafe + | ITwith | ITstdcallconv | ITccallconv @@ -208,6 +209,8 @@ data Token | ITqvarsym (FAST_STRING,FAST_STRING) | ITqconsym (FAST_STRING,FAST_STRING) + | ITipvarid FAST_STRING -- GHC extension: implicit param: ?x + | ITpragma StringBuffer | ITchar Char @@ -282,6 +285,7 @@ ghcExtensionKeywordsFM = listToUFM $ ( "label", ITlabel ), ( "dynamic", ITdynamic ), ( "unsafe", ITunsafe ), + ( "with", ITwith ), ( "stdcall", ITstdcallconv), ( "ccall", ITccallconv), ("_ccall_", ITccall (False, False, False)), @@ -590,6 +594,8 @@ lexToken cont glaexts buf = trace "lexIface: misplaced NUL?" $ cont (ITunknown "\NUL") (stepOn buf) + '?'# | flag glaexts && is_lower (lookAhead# buf 1#) -> + lex_ip cont (setCurrentPos# buf 1#) c | is_digit c -> lex_num cont glaexts 0 buf | is_symbol c -> lex_sym cont buf | is_upper c -> lex_con cont glaexts buf @@ -892,12 +898,18 @@ is_ident = is_ctype 1 is_symbol = is_ctype 2 is_any = is_ctype 4 is_space = is_ctype 8 -is_upper = is_ctype 16 -is_digit = is_ctype 32 +is_lower = is_ctype 16 +is_upper = is_ctype 32 +is_digit = is_ctype 64 ----------------------------------------------------------------------------- -- identifiers, symbols etc. +lex_ip cont buf = + case expandWhile# is_ident buf of + buf' -> cont (ITipvarid lexeme) buf' + where lexeme = lexemeToFastString buf' + lex_id cont glaexts buf = case expandWhile# is_ident buf of { buf1 -> |