public ProtoField(int number, ProtoReference reference, string name, ProtoOccurrence occurrence) { this.Occurrence = occurrence; this.Number = number; this.Name = name; this.Reference = reference; }
private static ProtoField ParseField(Lexer lexer, ProtoReference reference, ProtoOccurrence occurrence) { string name = Parser.ParseValue(lexer, LexemType.Symbol, "field name"); Parser.ParseValue(lexer, LexemType.Equal, "equal sign"); if (!int.TryParse(Parser.ParseValue(lexer, LexemType.Number, "field number"), NumberStyles.Integer, CultureInfo.InvariantCulture, out var number)) { throw new ParserException(lexer.Position, "invalid field number"); } if (lexer.Current.Type == LexemType.BracketBegin) { lexer.Next(); Parser.ParseOptions(lexer); Parser.ParseValue(lexer, LexemType.BracketEnd, "closing bracket"); } return(new ProtoField(number, reference, name, occurrence)); }