to detect Comparative symbols ( < , > , != , <= , >= , <> ) just add this lines for ReadSymbol() method
case '!':
case '<':
case '>':
this.buffer.Append(currentChar);
this.ReadNextChar();
if (currentChar == '=' || currentChar == '>')
{
this.buffer.Append(currentChar);
this.ReadNextChar();
}
var nottoken = new Token { Value = this.buffer.ToString(), Type = TokenType.Symbol };
this.buffer.Clear();
return nottoken;
by completed method:
private Token ReadSymbol()
{
switch (currentChar)
{
case '+':
case '-':
case '*':
case '/':
case '^':
case '(':
case ')':
case '[':
case ']':
case ';':
case ':':
case '=':
case '.':
case ',':
var token = new Token { Value = currentChar.ToString(), Type = TokenType.Symbol };
this.buffer.Clear();
this.ReadNextChar();
return token;
case '!':
case '<':
case '>':
this.buffer.Append(currentChar);
this.ReadNextChar();
if (currentChar == '=' || currentChar == '>')
{
this.buffer.Append(currentChar);
this.ReadNextChar();
}
var nottoken = new Token { Value = this.buffer.ToString(), Type = TokenType.Symbol };
this.buffer.Clear();
return nottoken;
default:
this.ReadNextChar();
break;
}
return null;
}
to detect Comparative symbols ( < , > , != , <= , >= , <> ) just add this lines for ReadSymbol() method
by completed method: