mirror of https://github.com/tbklang/tlang.git
Added support for the ampersand operator
This commit is contained in:
parent
15a848756b
commit
1f8f248219
|
@ -51,6 +51,7 @@ public enum SymbolType
|
||||||
ADD,
|
ADD,
|
||||||
DIVIDE,
|
DIVIDE,
|
||||||
STAR,
|
STAR,
|
||||||
|
AMPERSAND,
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +400,11 @@ public SymbolType getSymbolType(Token tokenIn)
|
||||||
{
|
{
|
||||||
return SymbolType.DIVIDE;
|
return SymbolType.DIVIDE;
|
||||||
}
|
}
|
||||||
|
/* Ampersand `&` operator check */
|
||||||
|
else if(token[0] == '&')
|
||||||
|
{
|
||||||
|
return SymbolType.AMPERSAND;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,6 +423,15 @@ public bool isMathOp(Token token)
|
||||||
tokenStr[0] == '*' || tokenStr[0] == '/';
|
tokenStr[0] == '*' || tokenStr[0] == '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool isBinaryOp(Token token)
|
||||||
|
{
|
||||||
|
string tokenStr = token.getToken();
|
||||||
|
|
||||||
|
return tokenStr[0] == '&' || cmp("&&", tokenStr) == 0 ||
|
||||||
|
tokenStr[0] == '|' || cmp("||", tokenStr) == 0 ||
|
||||||
|
tokenStr[0] == '^' || tokenStr[0] == '~';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Test: Character literal */
|
/* Test: Character literal */
|
||||||
|
|
Loading…
Reference in New Issue