Commit ef296721 authored by Paul Ogris's avatar Paul Ogris
Browse files

Fix atom parsing

This still doesn't parse all LARS atoms. An atom token should also
contain any window descriptions etc.
parent dee18f82
......@@ -96,7 +96,12 @@ symbol = L.symbol sc
atom :: Parser Atom
atom = lexeme $ do
identifier <- pack <$> ((:) <$> (P.char '-' <|> P.lowerChar) <*> many P.alphaNumChar)
pure $ identifier <> ""
arguments <- option "" . lexeme $ do
_ <- P.char '('
args <- takeWhileP Nothing (/= ')')
_ <- P.char ')'
pure $ "(" <> args <> ")"
pure $ identifier <> arguments
rule :: Parser Rule
rule =
......
......@@ -75,4 +75,5 @@ parser = parallel $ do
"head(X)"
[ BodyAtom (Positive "body(X)")
, BodyAtom (Negative "foo(Y)")
, BodyRelation "X = Y"
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment