Adjust the parser a bit.
This commit is contained in:
parent
55edae65cb
commit
1b00b22f55
@ -72,16 +72,19 @@ parseVarName = variable
|
||||
parseVar : Parser LogoExpr
|
||||
parseVar = map Variable parseVarName
|
||||
|
||||
parseTerm : Parser LogoExpr
|
||||
parseTerm = oneOf [ parseInt, parseVar ]
|
||||
|
||||
parseSum : Parser LogoExpr
|
||||
parseSum = succeed Sum
|
||||
|= oneOf [ backtrackable parseVar, backtrackable parseInt ]
|
||||
|= parseTerm
|
||||
|. spaces
|
||||
|. symbol "+"
|
||||
|. spaces
|
||||
|= parseExpr
|
||||
|
||||
parseExpr : Parser LogoExpr
|
||||
parseExpr = oneOf [ lazy (\_ -> backtrackable parseSum), backtrackable parseInt, backtrackable parseVar ]
|
||||
parseExpr = oneOf [ lazy (\_ -> backtrackable parseSum), parseTerm ]
|
||||
|
||||
parseProg : Parser LogoProg
|
||||
parseProg = sequence
|
||||
|
Loading…
Reference in New Issue
Block a user