Добавлен kawaii-оператор ^^

This commit is contained in:
Victor 2018-03-09 10:57:08 +02:00
parent ea39897828
commit 865fe46523
4 changed files with 7 additions and 0 deletions

View File

@ -80,6 +80,7 @@ public final class Lexer {
OPERATORS.put("@=", TokenType.ATEQ); OPERATORS.put("@=", TokenType.ATEQ);
OPERATORS.put("..", TokenType.DOTDOT); OPERATORS.put("..", TokenType.DOTDOT);
OPERATORS.put("**", TokenType.STARSTAR); OPERATORS.put("**", TokenType.STARSTAR);
OPERATORS.put("^^", TokenType.CARETCARET);
OPERATORS.put("?:", TokenType.QUESTIONCOLON); OPERATORS.put("?:", TokenType.QUESTIONCOLON);
} }

View File

@ -629,6 +629,10 @@ public final class Parser {
result = new BinaryExpression(BinaryExpression.Operator.AT, result, multiplicative()); result = new BinaryExpression(BinaryExpression.Operator.AT, result, multiplicative());
continue; continue;
} }
if (match(TokenType.CARETCARET)) {
result = new BinaryExpression(BinaryExpression.Operator.CARETCARET, result, multiplicative());
continue;
}
break; break;
} }

View File

@ -72,6 +72,7 @@ public enum TokenType {
TILDE, // ~ TILDE, // ~
CARET, // ^ CARET, // ^
CARETCARET, // ^^
BAR, // | BAR, // |
BARBAR, // || BARBAR, // ||
AMP, // & AMP, // &

View File

@ -33,6 +33,7 @@ public final class BinaryExpression implements Expression {
// Addition operators for future usage or overloading // Addition operators for future usage or overloading
AT("@"), AT("@"),
CARETCARET("^^"),
RANGE(".."), RANGE(".."),
POWER("**"), POWER("**"),
ELVIS("?:"); ELVIS("?:");