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