Lexer.hs revision 7b07d9655900f3b6baf20ac45a4cd29d26b807ad
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedermodule Lexer where
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederimport Text.ParserCombinators.Parsec
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederimport Text.ParserCombinators.Parsec.Expr
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederimport Text.ParserCombinators.Parsec.Language
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederimport qualified Text.ParserCombinators.Parsec.Token as T
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder-------------------------------------------------------------------------------
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder-- The lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder-------------------------------------------------------------------------------
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederlexer = T.makeTokenParser gmpDef
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederlexeme = T.lexeme lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederparens = T.parens lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederbraces = T.braces lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaedersemiSep = T.semiSep lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaedersemiSep1 = T.semiSep1 lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaedercommaSep = T.commaSep lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaedercommaSep1 = T.commaSep1 lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaederwhiteSpace = T.whiteSpace lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedersymbol = T.symbol lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederidentifier = T.identifier lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederreserved = T.reserved lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedernatural = T.natural lexer
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaedergmpDef
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder = haskellStyle
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder { identStart = letter
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder , identLetter = alphaNum <|> oneOf "_'" -- ???
, opStart = opLetter gmpDef
, opLetter = oneOf "\\-</~[]"
, reservedOpNames = ["~","->","<-","<->","/\\","\\/","[]"]
}
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------