public static (List <ASTError>, ASTAlias) Parse( IParser parser, IEnumerable <ASTAnnotation> annotations, IEnumerable <ASTDirective> directives) { List <ASTError> errors = new List <ASTError>(); ASTAlias result = new ASTAlias { Annotations = annotations, Directives = directives }; if (parser.HasNext()) { parser.Next(); } var nameId = parser.Consume(TokenType.Identifier); result.Name = nameId.Value; parser.Consume(TokenType.Equal); result.Type = ASTTypeDefinition.Parse(parser).ToList(); result.Restrictions = ASTRestriction.CreateRestrictions(parser, TokenType.KW_Alias).ToList(); parser.TryConsume(TokenType.EndStatement); parser.Consume(TokenType.ContextEnded); return(errors, result); }
public static (List <ASTError>, ASTChoice) Parse(IParser parser) { if (parser.HasNext()) { parser.Next(); } var result = new ASTChoice(); var nameId = parser.Consume(TokenType.Identifier); result.Name = nameId.Value; parser.Consume(TokenType.Equal); result.Type = ASTTypeDefinition.Parse(parser).ToList(); result.Options = ASTOption.Parse(parser).ToList(); parser.TryConsume(TokenType.EndStatement); parser.Consume(TokenType.ContextEnded); return(new List <ASTError>(), result); }
public static ASTFlowParameter Parse(IParser parser) { var identifiers = ASTTypeDefinition.Parse(parser).ToList(); return(new ASTFlowParameter("", identifiers)); }