X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FLexCore.hs;h=fa7c1e3acc3c324f1616c348dd7b820cf234729a;hb=4c6a3f787abcaed009a574196d82237d9ae64fc8;hp=936786d9491008266127987380077d86072a2d86;hpb=317fc69d18eda68fd65f5ba634feafbe4a3923da;p=ghc-hetmet.git diff --git a/compiler/parser/LexCore.hs b/compiler/parser/LexCore.hs index 936786d..fa7c1e3 100644 --- a/compiler/parser/LexCore.hs +++ b/compiler/parser/LexCore.hs @@ -1,12 +1,18 @@ +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module LexCore where import ParserCoreUtils -import Ratio import Char import Numeric isNameChar c = isAlpha c || isDigit c || (c == '_') || (c == '\'') - || (c == ':') || (c == '$') + || (c == '$') || (c == '-') || (c == '.') isKeywordChar c = isAlpha c || (c == '_') lexer :: (Token -> P a) -> P a @@ -29,6 +35,7 @@ lexer cont (')':cs) = cont TKcparen cs lexer cont ('{':cs) = cont TKobrace cs lexer cont ('}':cs) = cont TKcbrace cs lexer cont ('=':cs) = cont TKeq cs +lexer cont (':':'=':':':cs) = cont TKcoloneqcolon cs lexer cont (':':':':cs) = cont TKcoloncolon cs lexer cont ('*':cs) = cont TKstar cs lexer cont ('.':cs) = cont TKdot cs @@ -37,7 +44,9 @@ lexer cont ('@':cs) = cont TKat cs lexer cont ('?':cs) = cont TKquestion cs lexer cont (';':cs) = cont TKsemicolon cs -- 20060420 GHC spits out constructors with colon in them nowadays. jds -lexer cont (':':cs) = lexName cont TKcname (':':cs) +-- 20061103 but it's easier to parse if we split on the colon, and treat them +-- as several tokens +lexer cont (':':cs) = cont TKcolon cs -- 20060420 Likewise does it create identifiers starting with dollar. jds lexer cont ('$':cs) = lexName cont TKname ('$':cs) lexer cont (c:cs) = failP "invalid character" [c] @@ -94,6 +103,7 @@ lexKeyword cont cs = ("cast",rest) -> cont TKcast rest ("note",rest) -> cont TKnote rest ("external",rest) -> cont TKexternal rest + ("local",rest) -> cont TKlocal rest ("_",rest) -> cont TKwild rest _ -> failP "invalid keyword" ('%':cs)