private FieldType ParseType(String type, SourceInfo sourceInfo) { var type_only = type.TrimEnd("0123456789".ToCharArray()); uint.TryParse(type.TrimStart("abcdefghijklmnopqrstuvwxyz".ToCharArray()), out uint size); Debug.Assert(new HashSet <String> { "int", "i", "uint", "u", "float", "f", "bool", "ascii_string", "utf8_string" }.Contains(type_only)); switch (type_only) { case "int": case "i": return(new AST.FieldTypes.Signed(sourceInfo, size)); case "uint": case "u": return(new AST.FieldTypes.Unsigned(sourceInfo, size)); case "float": case "f": return(new AST.FieldTypes.Float(sourceInfo, size)); case "bool": return(new AST.FieldTypes.Boolean(sourceInfo)); case "ascii_string": return(new AST.FieldTypes.AsciiString(sourceInfo)); case "utf8_string": return(new AST.FieldTypes.Utf8String(sourceInfo)); default: // This indicates an error in our grammar or an error in ANTLR throw new ArgumentException($"Unrecoginized fieldtype {type}"); } }
public Object(SourceInfo sourceInfo, String identifier, IList <Field> fields) : base(sourceInfo) { this.Identifier = identifier; this.Fields = fields; }
public Element(SourceInfo sourceinfo) : base(sourceinfo) { }
public FieldType(SourceInfo sourceInfo) : base(sourceInfo) { }
public Enumerator(SourceInfo sourceinfo, String name, String value) : base(sourceinfo) { this.Name = name; this.Original_value = value; }
public Parser(SourceInfo sourceInfo, String name, IList <AST.Element> elements) : base(sourceInfo) { this.Elements = elements; this.Name = name; }
public ASTNode(SourceInfo sourceInfo) { this.SourceInfo = sourceInfo; }
public IMultiplier(SourceInfo sourceInfo) : base(sourceInfo) { }
public Enumeration(SourceInfo sourceInfo, String identifier, FieldType type, IList <Enumerator> enumerators) : base(sourceInfo) { this.Identifier = identifier; this.Enumerators = enumerators; this.Type = type; }