1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Add back manyTerm combinator as an alias for many term

This commit is contained in:
Rick Winfrey 2017-11-20 17:08:03 -08:00
parent 9117f5153a
commit f44d0dc3fc
5 changed files with 112 additions and 4 deletions

View File

@ -114,6 +114,10 @@ infixTerm = infixContext comment
manyTermsTill :: Show b => Assignment.Assignment [] Grammar Term -> Assignment.Assignment [] Grammar b -> Assignment.Assignment [] Grammar [Term]
manyTermsTill step end = manyTill (step <|> comment) end
-- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present.
manyTerm :: Assignment -> Assignment.Assignment [] Grammar [Term]
manyTerm = many . term
-- | Match a term and contextualize any comments preceeding or proceeding the term.
term :: Assignment -> Assignment
term term' = contextualize comment term' <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)

View File

@ -22,4 +22,31 @@
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })))))
->(Identifier) }))
(
(Context
(Comment)
(Annotation
{ (Identifier)
->(Identifier) }
(Constructor
(Empty)
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier))))))
(Annotation
{ (Identifier)
->(Identifier) }
(Interface))
(Context
(Comment)
(Empty))))))

View File

@ -22,4 +22,31 @@
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })))))
->(Identifier) }))
(
(Context
(Comment)
(Annotation
{ (Identifier)
->(Identifier) }
(Constructor
(Empty)
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier))))))
(Annotation
{ (Identifier)
->(Identifier) }
(Interface))
(Context
(Comment)
(Empty))))))

View File

@ -16,4 +16,29 @@
(Identifier))
(Annotation
(Identifier)
(Identifier))))))
(Identifier)))
(
(Context
(Comment)
(Annotation
(Identifier)
(Constructor
(Empty)
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier))))))
(Annotation
(Identifier)
(Interface))
(Context
(Comment)
(Empty))))))

View File

@ -16,4 +16,29 @@
(Identifier))
(Annotation
(Identifier)
(Identifier))))))
(Identifier)))
(
(Context
(Comment)
(Annotation
(Identifier)
(Constructor
(Empty)
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier)))
(Field
(Identifier)
(
(Identifier))))))
(Annotation
(Identifier)
(Interface))
(Context
(Comment)
(Empty))))))