-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtility.cs
More file actions
35 lines (29 loc) · 806 Bytes
/
Utility.cs
File metadata and controls
35 lines (29 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Collections.Generic;
namespace LexerParser
{
public static class Utility
{
public static Token EOL = new Token("EOL", 0);
public static bool IsDigit(char ch)
{
return '0' <= ch && ch <= '9';
}
public static bool IsSpace(char ch)
{
return ch==' ';
}
public static bool IsOperator(char ch)
{
return (ch == '+' || ch == '-' || ch == '*' || ch == '/');
}
public static bool IsParenthesis(char ch)
{
return ch == '(' || ch == ')';
}
public static Token Remove(this List<Token> tokens){
var currentToken=tokens[0];
tokens.RemoveAt(0);
return currentToken;
}
}
}