mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 08:44:20 +03:00
Добавлен kawaii-оператор ^^
This commit is contained in:
parent
ea39897828
commit
865fe46523
@ -80,6 +80,7 @@ public final class Lexer {
|
||||
OPERATORS.put("@=", TokenType.ATEQ);
|
||||
OPERATORS.put("..", TokenType.DOTDOT);
|
||||
OPERATORS.put("**", TokenType.STARSTAR);
|
||||
OPERATORS.put("^^", TokenType.CARETCARET);
|
||||
OPERATORS.put("?:", TokenType.QUESTIONCOLON);
|
||||
}
|
||||
|
||||
|
@ -629,6 +629,10 @@ public final class Parser {
|
||||
result = new BinaryExpression(BinaryExpression.Operator.AT, result, multiplicative());
|
||||
continue;
|
||||
}
|
||||
if (match(TokenType.CARETCARET)) {
|
||||
result = new BinaryExpression(BinaryExpression.Operator.CARETCARET, result, multiplicative());
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ public enum TokenType {
|
||||
|
||||
TILDE, // ~
|
||||
CARET, // ^
|
||||
CARETCARET, // ^^
|
||||
BAR, // |
|
||||
BARBAR, // ||
|
||||
AMP, // &
|
||||
|
@ -33,6 +33,7 @@ public final class BinaryExpression implements Expression {
|
||||
|
||||
// Addition operators for future usage or overloading
|
||||
AT("@"),
|
||||
CARETCARET("^^"),
|
||||
RANGE(".."),
|
||||
POWER("**"),
|
||||
ELVIS("?:");
|
||||
|
Loading…
Reference in New Issue
Block a user