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