Skip to content

Commit

Permalink
Unify type cast to other language features
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed Feb 14, 2025
1 parent 22955bd commit 28eb5a3
Show file tree
Hide file tree
Showing 8 changed files with 317 additions and 299 deletions.
579 changes: 292 additions & 287 deletions src/main/gen/com/spicelang/intellij/spice/SpiceLexer.java

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions src/main/gen/com/spicelang/intellij/spice/SpiceParser.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/java/com/spicelang/intellij/spice/Spice.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ relationalExpr ::= shiftExpr ((LESS | GREATER | LESS_EQUAL | GREATER_EQUAL) shif
shiftExpr ::= additiveExpr ((LESS LESS | GREATER GREATER) additiveExpr)*
additiveExpr ::= multiplicativeExpr ((PLUS | MINUS) multiplicativeExpr)*
multiplicativeExpr ::= castExpr ((MUL | DIV | REM) castExpr)*
castExpr ::= LPAREN dataType RPAREN prefixUnaryExpr | prefixUnaryExpr
castExpr ::= prefixUnaryExpr | CAST LESS dataType GREATER LPAREN assignExpr RPAREN
prefixUnaryExpr ::= postfixUnaryExpr | (MINUS | PLUS_PLUS | MINUS_MINUS | NOT | BITWISE_NOT | MUL | BITWISE_AND) prefixUnaryExpr
postfixUnaryExpr ::= atomicExpr (LBRACKET assignExpr RBRACKET | DOT postfixUnaryExpr | PLUS_PLUS | MINUS_MINUS | SCOPE_ACCESS postfixUnaryExpr)*
atomicExpr ::= value | (identifierExpr SCOPE_ACCESS)* identifierExpr | builtinCall | LPAREN assignExpr RPAREN {methods=[getIdentifier]}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/spicelang/intellij/spice/Spice.flex
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ alignof { return SpiceTypes.ALIGNOF; }
len { return SpiceTypes.LEN; }
panic { return SpiceTypes.PANIC; }
syscall { return SpiceTypes.SYSCALL; }
cast { return SpiceTypes.CAST; }
ext { return SpiceTypes.EXT; }
true { return SpiceTypes.TRUE; }
false { return SpiceTypes.FALSE; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public Lexer getHighlightingLexer() {
if (tokenType.equals(SpiceTypes.LEN)) return BUILTIN_KEY;
if (tokenType.equals(SpiceTypes.PANIC)) return BUILTIN_KEY;
if (tokenType.equals(SpiceTypes.SYSCALL)) return BUILTIN_KEY;
if (tokenType.equals(SpiceTypes.CAST)) return KEYWORD_KEY;
if (tokenType.equals(SpiceTypes.EXT)) return KEYWORD_KEY;
if (tokenType.equals(SpiceTypes.TRUE)) return CONSTANT_KEY;
if (tokenType.equals(SpiceTypes.FALSE)) return CONSTANT_KEY;
Expand Down

0 comments on commit 28eb5a3

Please sign in to comment.