mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Fix for emptyStatements
This commit is contained in:
parent
c0ca3df3d1
commit
f7b6ba3734
@ -422,7 +422,7 @@ methodSpecList :: Assignment
|
||||
methodSpecList = symbol MethodSpecList *> children expressions
|
||||
|
||||
packageClause :: Assignment
|
||||
packageClause = makeTerm <$> symbol PackageClause <*> children (Go.Syntax.Package <$> expression <*> pure [])
|
||||
packageClause = makeTerm <$> symbol PackageClause <*> children (Go.Syntax.Package <$> expression <*> emptyStatements)
|
||||
|
||||
parameters :: Assignment
|
||||
parameters = symbol ParameterList *> children expressions
|
||||
@ -610,4 +610,7 @@ manyTerm = many . term
|
||||
term :: Assignment -> Assignment
|
||||
term term' = contextualize comment term' <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)
|
||||
|
||||
emptyStatements :: Assignment.Assignment [] Grammar (Syntax.Statements Term)
|
||||
emptyStatements = pure (fromList [])
|
||||
|
||||
{-# ANN module ("HLint: ignore Eta reduce" :: String) #-}
|
||||
|
@ -94,7 +94,7 @@ type Assignment = Assignment' Term
|
||||
|
||||
-- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax.
|
||||
assignment :: Assignment
|
||||
assignment = handleError $ makeTerm <$> symbol Program <*> children (Syntax.Program . fromList <$> many expression) <|> parseError
|
||||
assignment = handleError $ makeTerm <$> symbol Program <*> children (Syntax.Program <$> manyStatements expression) <|> parseError
|
||||
|
||||
expression :: Assignment
|
||||
expression = term (handleError (choice expressionChoices))
|
||||
|
@ -186,6 +186,9 @@ manyTerm term = many (contextualize comment term <|> makeTerm1 <$> (Syntax.Conte
|
||||
manyStatements :: Assignment.Assignment [] Grammar Term -> Assignment.Assignment [] Grammar (Syntax.Statements Term)
|
||||
manyStatements expr = fromList <$> (manyTerm expr)
|
||||
|
||||
emptyStatements :: Assignment.Assignment [] Grammar (Syntax.Statements Term)
|
||||
emptyStatements = pure (fromList [])
|
||||
|
||||
term :: Assignment -> Assignment
|
||||
term term = contextualize comment (postContextualize comment term)
|
||||
|
||||
@ -768,7 +771,7 @@ internalModule :: Assignment
|
||||
internalModule = makeTerm <$> symbol Grammar.InternalModule <*> children (TypeScript.Syntax.InternalModule <$> term (string <|> identifier <|> nestedIdentifier) <*> statements)
|
||||
|
||||
module' :: Assignment
|
||||
module' = makeTerm <$> symbol Module <*> children (TypeScript.Syntax.Module <$> term (string <|> identifier <|> nestedIdentifier) <*> (statements <|> pure (fromList [])))
|
||||
module' = makeTerm <$> symbol Module <*> children (TypeScript.Syntax.Module <$> term (string <|> identifier <|> nestedIdentifier) <*> (statements <|> emptyStatements))
|
||||
|
||||
|
||||
statements :: Assignment.Assignment [] Grammar (Syntax.Statements Term)
|
||||
|
Loading…
Reference in New Issue
Block a user