Example #1
0
 /// <summary>
 /// Adds the token to the lookup
 /// </summary>
 /// <param name="token"></param>
 public static void AddToLookup(Token token)
 {
     AllTokens[token.Text] = token;
 }
Example #2
0
 /// <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);
 }
Example #3
0
 /// <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);
 }
Example #4
0
 /// <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;
 }
Example #5
0
 /// <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);
 }
Example #6
0
 /// <summary>
 /// Sets values from another token.
 /// </summary>
 /// <param name="t"></param>
 internal void SetValues(Token t)
 {
     _kind = t._kind;
     _type = t._type;
 }