public SourceObject(string text, TokenRef.Type type) { OfType = type; Text = text; Sequence = null; Previous = null; }
public static NextStateRec CreateTokenRef(string name, TokenRef.Type type, ParseResponse response) { NextStateRec nsRec; switch (type) { case TokenRef.Type.Null: throw new FormatException($"SourceObject Type {type.ToString()} is valid BUT NOT in the context as a Next State Token Ref!"); case TokenRef.Type.Empty: nsRec = new NextStateRec(Type.TokenRef, TokenRef.CreateEmpty(), null, response); break; case TokenRef.Type.Identifier: if (!(name is null)) { throw new ArgumentNullException(nameof(name), $"NextStateRecords can not contain Identifier Tokens with predefined names -{nameof(name)} must be set to 'null', not '{name}'!"); } nsRec = new NextStateRec(Type.TokenRef, TokenRef.CreateIdentifier(), response); break; case TokenRef.Type.Keyword: nsRec = new NextStateRec(Type.TokenRef, TokenRef.CreateKeyword(name), name, response); break; case TokenRef.Type.Operator: nsRec = new NextStateRec(Type.TokenRef, TokenRef.CreateOperator(name), name, response); break; case TokenRef.Type.Error: throw new NotImplementedException("Error types yet to be implemented!"); default: throw InvalidEnumValueException.InvalidArgument(typeof(TokenRef.Type), type, nameof(name)); } return(nsRec); }
public static NextStateRec CreateTokenRef(TokenRef.Type type, ParseResponse response) { return(CreateTokenRef(null, type, response)); }
public static NextStateRec CreateTokenRef(string name, TokenRef.Type type) { return(CreateTokenRef(name, type, ParseResponse.Next)); }
private SymbolRecord CreateSymbol(string token, TokenRef.Type type) { return(new SymbolRecord(token, type)); }
public SymbolRecord(string token, TokenRef.Type type) : this() { Token = token ?? throw new ArgumentNullException(nameof(token)); Type = type; }