diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index f4bb366b0..97f45c427 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -41,6 +41,7 @@ type Syntax = , Literal.KeyValue , Literal.TextElement , Statement.Assignment + , Statement.Break , Syntax.Context , Syntax.Error , Syntax.Empty @@ -71,7 +72,8 @@ expression = term (handleError (choice expressionChoices)) expressionChoices :: [Assignment.Assignment [] Grammar Term] expressionChoices = - [ callExpression + [ breakStatement + , callExpression , channelType , comment , constVarDeclaration @@ -282,6 +284,14 @@ parameterDeclaration :: Assignment parameterDeclaration = symbol ParameterDeclaration *> children expressions +-- Statements + +breakStatement :: Assignment +breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> labelName) + +labelName :: Assignment +labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source) + -- Helpers -- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present.