Support for length unary operator
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-09-12 18:19:06 +02:00
parent bd9eac9056
commit 73142afa8a
18 changed files with 95 additions and 10 deletions

View File

@@ -362,6 +362,7 @@ namespace Porygon::Parser {
switch (kind) {
case TokenKind::PlusToken:
case TokenKind::MinusToken:
case TokenKind::HashToken:
case TokenKind::NotKeyword:
return OperatorPrecedence::Unary;
default:
@@ -375,6 +376,8 @@ namespace Porygon::Parser {
return UnaryOperatorKind::Identity;
case TokenKind::MinusToken:
return UnaryOperatorKind::Negation;
case TokenKind::HashToken :
return UnaryOperatorKind::Count;
case TokenKind::NotKeyword:
return UnaryOperatorKind::LogicalNegation;
default: // This should never trigger, so throw.