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:
parent
9117f5153a
commit
f44d0dc3fc
@ -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)
|
||||
|
29
test/fixtures/go/type-declarations.diffA-B.txt
vendored
29
test/fixtures/go/type-declarations.diffA-B.txt
vendored
@ -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))))))
|
||||
|
29
test/fixtures/go/type-declarations.diffB-A.txt
vendored
29
test/fixtures/go/type-declarations.diffB-A.txt
vendored
@ -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))))))
|
||||
|
27
test/fixtures/go/type-declarations.parseA.txt
vendored
27
test/fixtures/go/type-declarations.parseA.txt
vendored
@ -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))))))
|
||||
|
27
test/fixtures/go/type-declarations.parseB.txt
vendored
27
test/fixtures/go/type-declarations.parseB.txt
vendored
@ -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))))))
|
||||
|
Loading…
Reference in New Issue
Block a user