1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 04:41:47 +03:00

Assign multiple comments at the end of a branch.

This commit is contained in:
Rob Rix 2017-08-14 18:38:29 -04:00
parent e3e3657b2c
commit a7cfb3c988

View File

@ -11,6 +11,7 @@ import Data.Align.Generic
import Data.Functor (void)
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Show.Generic
import Data.List.NonEmpty (some1)
import Data.Maybe (fromMaybe)
import Data.Record
import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm1)
@ -470,7 +471,7 @@ conditionalExpression :: Assignment
conditionalExpression = makeTerm <$> symbol ConditionalExpression <*> children (flip Statement.If <$> expression <*> expression <*> expressions)
term :: Assignment -> Assignment
term term = contextualize comment term <|> comment <* eof
term term = contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)
manyTermsTill :: Show b => Assignment.Assignment (AST Grammar) Grammar Term -> Assignment.Assignment (AST Grammar) Grammar b -> Assignment.Assignment (AST Grammar) Grammar [Term]
manyTermsTill step end = manyTill (step <|> comment) end