1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Don’t match unused fields.

This commit is contained in:
Rob Rix 2017-01-20 14:10:30 -05:00
parent 17ce8d6988
commit e11c56b7a4

View File

@ -18,8 +18,8 @@ termAssignment
-> [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ The child nodes of the term.
-> IO [ SyntaxTerm Text '[Range, Category, SourceSpan] ] -- ^ All child nodes (included unnamed productions) of the term as 'IO'. Only use this if you need it.
-> IO (Maybe (S.Syntax Text (SyntaxTerm Text '[Range, Category, SourceSpan]))) -- ^ The resulting term, in IO.
termAssignment source (range :. category :. sourceSpan :. Nil) children allChildren
| category == Error = pure $! Just (S.Error children)
termAssignment source (_ :. category :. _ :. Nil) children allChildren
| category == Error = pure (Just (S.Error children))
| category `elem` operators = do
allChildren' <- allChildren
pure $! Just (S.Operator allChildren')