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 ASTTypeField(IParser parser) { this.Restrictions = new List <ASTRestriction>(); this.Annotations = ASTAnnotation.Parse(parser).ToList(); this.Name = parser.Consume(TokenType.Identifier).Value; Token Separator = parser.Consume(TokenType.Separator); this.Type = ASTTypeDefinition.ParseType(parser).ToList(); this.Restrictions = ASTRestriction.CreateRestrictions(parser).ToList(); parser.Consume(TokenType.EndStatement); }
public ASTAlias(IParser parser) { if (parser.HasNext()) parser.Next(); var nameId = parser.Consume(TokenType.Identifier); this.Name = nameId.Value; parser.Consume(TokenType.Equal); this.Type = ASTTypeDefinition.ParseType(parser).ToList(); this.Restrictions = ASTRestriction.CreateRestrictions(parser).ToList(); parser.TryConsume(TokenType.EndStatement); parser.Consume(TokenType.ContextEnded); }
public static ASTTypeField Parse(IParser parser) { var result = new ASTTypeField(); result.Restrictions = new List <ASTRestriction>(); result.Annotations = ASTAnnotation.Parse(parser).ToList(); result.Name = parser.Consume(TokenType.Identifier).Value; Token Separator = parser.Consume(TokenType.Separator); result.Type = ASTTypeDefinition.ParseType(parser).ToList(); result.Restrictions = ASTRestriction.CreateRestrictions(parser, TokenType.KW_Type).ToList(); parser.Consume(TokenType.EndStatement); return(result); }