summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Grasp/Parser.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Grasp/Parser.hs b/src/Grasp/Parser.hs
index 3a71fdf..4b42ab6 100644
--- a/src/Grasp/Parser.hs
+++ b/src/Grasp/Parser.hs
@@ -36,14 +36,19 @@ parseGrasp = parse grasp "error"
grasp = do
string "digraph {"
whiteSpace
- n <- many node
- e <- many edge
+ (n,e) <- stmtList ([],[])
string "}"
eol
eof
return (n,e)
+stmtList (n,e) =
+ try (node >>= (\x -> stmtList (x:n,e)) )
+ <|> try (edge >>= (\x -> stmtList (n,x:e)) )
+ <|> return (reverse n, reverse e)
+
+
node = do
i <- ident
l <- labelAttrib