X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=lex.icl;h=aa34987969b5afcdc71c83451f91fe448ee9902f;hb=f1a53c1d5200e6122756e1b52b1cd4b58282968e;hp=ce642a1a76c0a0cb61d639d7a73ec96ef0bbdb52;hpb=d5abf2ad34be35640d0e1b04d4f3da24e4ea9967;p=cc1516.git diff --git a/lex.icl b/lex.icl index ce642a1..aa34987 100644 --- a/lex.icl +++ b/lex.icl @@ -7,9 +7,10 @@ import StdBool import StdList import StdChar import StdString +import StdTuple import yard -from AST import :: Pos(..) +import AST :: LexItem = LexToken Int TokenValue @@ -19,9 +20,7 @@ from AST import :: Pos(..) | LexItemError String lexer :: [Char] -> LexerOutput -lexer r = case runParser (lexProgram 1 1) r of - (Right p, _) = Right p - (Left e, _) = Left e +lexer r = fst $ runParser (lexProgram 1 1) r lexProgram :: Int Int -> Parser Char [Token] lexProgram line column = lexToken >>= \t->case t of