Browse Source

Added support for the ampersand operator

constants
Tristan B. V. Kildaire 10 months ago
parent
commit
1f8f248219
  1. 15
      source/tlang/compiler/symbols/check.d

15
source/tlang/compiler/symbols/check.d

@ -51,6 +51,7 @@ public enum SymbolType
ADD,
DIVIDE,
STAR,
AMPERSAND,
UNKNOWN
}
@ -399,6 +400,11 @@ public SymbolType getSymbolType(Token tokenIn)
{
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] == '/';
}
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 */

Loading…
Cancel
Save