diff --git a/Simple4/ParsecParser.hs b/Simple4/ParsecParser.hs index 498910c..3f8f1dc 100644 --- a/Simple4/ParsecParser.hs +++ b/Simple4/ParsecParser.hs @@ -33,7 +33,9 @@ pOptionalSemi :: Parser () pOptionalSemi = optional $ symbol ";" pDef :: Parser Def -pDef = do +pDef = (try pFullDef) <|> ((\e -> ("_",e)) <$> pExp) + +pFullDef =do v <- identifier foo <- symbol "=" e <- pExp diff --git a/Simple4/Test.hs b/Simple4/Test.hs index f18e788..7d7aac0 100644 --- a/Simple4/Test.hs +++ b/Simple4/Test.hs @@ -40,12 +40,12 @@ prog3 = [ -- undefined var bad1 = [("_", EVar "x")] -text2 = "l=new 1 x=*l \ -\ _ = let x = 2 in if x then x else 42\ +text2 = "l=new 1; x=*l \ +\ let x = 2 in if x then x else 42\ \ y = 2\ -\ _ = x+y" +\ x+y" text4 = "locals = new {}; \ -\ _=locals.y=1; \ -\ _ = if locals.y then locals.y = None else locals.y = 42;\ -\ _ = locals.y" \ No newline at end of file +\ locals.y=1; \ +\ if locals.y then locals.y = 42 else locals.y = None;\ +\ locals.y" \ No newline at end of file