/// <summary> /// Adds the token to the lookup /// </summary> /// <param name="token"></param> public static void AddToLookup(Token token) { AllTokens[token.Text] = token; }
/// <summary> /// Checks if the token supplied is a math op ( * / + - % ) /// </summary> /// <param name="token"></param> /// <returns></returns> public static bool IsMath(Token token) { return MathTokens.ContainsKey(token.Text); }
/// <summary> /// Checks if the token is a comparison token ( less lessthan more morethan equal not equal ). /// </summary> /// <param name="token"></param> /// <returns></returns> public static bool IsCompare(Token token) { return CompareTokens.ContainsKey(token.Text); }
/// <summary> /// Clones this instance of the token and returns a new instance with the same values. /// </summary> /// <returns></returns> public Token Clone() { var token = new Token(this.Kind, this.Type, this.Text, this.Value); return token; }
/// <summary> /// Whether or not the token supplied is a new line. /// </summary> /// <param name="token"></param> /// <returns></returns> public static bool IsNewLine(Token token) { return (token._type == TokenTypes.NewLine || token._type == TokenTypes.NewLine); }
/// <summary> /// Sets values from another token. /// </summary> /// <param name="t"></param> internal void SetValues(Token t) { _kind = t._kind; _type = t._type; }