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.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ public enum TokenType {
|
|||||||
|
|
||||||
TILDE, // ~
|
TILDE, // ~
|
||||||
CARET, // ^
|
CARET, // ^
|
||||||
|
CARETCARET, // ^^
|
||||||
BAR, // |
|
BAR, // |
|
||||||
BARBAR, // ||
|
BARBAR, // ||
|
||||||
AMP, // &
|
AMP, // &
|
||||||
|
@ -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("?:");
|
||||||
|
Loading…
Reference in New Issue
Block a user