mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Skip anonymous nodes at the end of input.
This commit is contained in:
parent
1943d62dbf
commit
3b9c53c4c2
@ -66,8 +66,9 @@ data Result a = Result a | Error [Text]
|
||||
-- | Run an assignment of nodes in a grammar onto terms in a syntax, discarding any unparsed nodes.
|
||||
assignAll :: (Symbol grammar, Eq grammar, Show grammar) => Assignment grammar a -> [AST grammar] -> Result a
|
||||
assignAll assignment nodes = case runAssignment assignment nodes of
|
||||
Result ([], a) -> Result a
|
||||
Result (c:_, _) -> Error ["Expected end of input, but got: " <> show c]
|
||||
Result (rest, a) -> case dropAnonymous rest of
|
||||
[] -> Result a
|
||||
c:_ -> Error ["Expected end of input, but got: " <> show c]
|
||||
Error e -> Error e
|
||||
|
||||
-- | Run an assignment of nodes in a grammar onto terms in a syntax.
|
||||
|
Loading…
Reference in New Issue
Block a user