Skip to content

Commit 865fe46

Browse files
committed
Добавлен kawaii-оператор ^^
1 parent ea39897 commit 865fe46

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/main/java/com/annimon/ownlang/parser/Lexer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public static List<Token> tokenize(String input) {
8080
OPERATORS.put("@=", TokenType.ATEQ);
8181
OPERATORS.put("..", TokenType.DOTDOT);
8282
OPERATORS.put("**", TokenType.STARSTAR);
83+
OPERATORS.put("^^", TokenType.CARETCARET);
8384
OPERATORS.put("?:", TokenType.QUESTIONCOLON);
8485
}
8586

src/main/java/com/annimon/ownlang/parser/Parser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,10 @@ private Expression additive() {
629629
result = new BinaryExpression(BinaryExpression.Operator.AT, result, multiplicative());
630630
continue;
631631
}
632+
if (match(TokenType.CARETCARET)) {
633+
result = new BinaryExpression(BinaryExpression.Operator.CARETCARET, result, multiplicative());
634+
continue;
635+
}
632636
break;
633637
}
634638

src/main/java/com/annimon/ownlang/parser/TokenType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public enum TokenType {
7272

7373
TILDE, // ~
7474
CARET, // ^
75+
CARETCARET, // ^^
7576
BAR, // |
7677
BARBAR, // ||
7778
AMP, // &

src/main/java/com/annimon/ownlang/parser/ast/BinaryExpression.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public static enum Operator {
3333

3434
// Addition operators for future usage or overloading
3535
AT("@"),
36+
CARETCARET("^^"),
3637
RANGE(".."),
3738
POWER("**"),
3839
ELVIS("?:");

0 commit comments

Comments
 (0)