Skip to content

Commit 2782bb2

Browse files
committed
Fix "foo = ..." and trailing , in parameters, initial !!, ???
1 parent 749ed52 commit 2782bb2

File tree

7 files changed

+1040
-970
lines changed

7 files changed

+1040
-970
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# C3IntelliJ Changelog
44

55
## [Unreleased]
6+
- Support ???:
7+
- Support foo = ...
8+
- Support trailing , in parameter list.
9+
- Support unary !!.
610

711
## [0.1.7] - 2025-08-05
812

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup = com.github.c3lang.c3intellij
44
pluginName = c3intellij
55
pluginRepositoryUrl = https://github.com/c3lang/c3intellij
66
# SemVer format -> https://semver.org
7-
pluginVersion = 0.1.7
7+
pluginVersion = 0.1.8
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 243

src/main/gen/org/c3lang/intellij/lexer/C3Lexer.java

Lines changed: 948 additions & 941 deletions
Large diffs are not rendered by default.

src/main/gen/org/c3lang/intellij/parser/C3Parser.java

Lines changed: 79 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/gen/org/c3lang/intellij/psi/C3Types.java

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/org/c3lang/intellij/C3.bnf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ enum_list ::= enum_constant (COMMA enum_constant ?)* COMMA?
217217
enum_constant ::= CONST_IDENT attributes? [eq_expr_pin]
218218
arg_list ::= arg (COMMA arg)* COMMA?
219219
named_ident ::= CT_IDENT | HASH_IDENT | IDENT | CT_TYPE_IDENT
220-
arg ::= (named_ident COLON (expr | type)) | param_path (EQ (expr | type))? | expr | type | KW_CT_VASPLAT (LBT range_exp RBT)? | ELLIPSIS expr
220+
arg ::= (named_ident COLON (ELLIPSIS? expr | type)) | param_path (EQ (expr | type))? | expr | type | KW_CT_VASPLAT (LBT range_exp RBT)? | ELLIPSIS expr
221221

222222

223223
global_decl ::= KW_TLOCAL? optional_type IDENT (global_multi_declaration | global_single_declaration) EOS
@@ -254,9 +254,9 @@ range_exp ::= range_loc? (DOTDOT | COLON) range_loc?
254254
range_loc ::= BIT_XOR? expr
255255
lambda_decl ::= KW_FN optional_type? fn_parameter_list attributes?
256256
optional_type ::= type QUESTION?
257-
fn_parameter_list ::= LP parameter_list? RP
258-
param_decl ::= parameter [eq_expr_pin]
259-
parameter_list ::= param_decl (COMMA param_decl)* { pin(".*")=1 }
257+
fn_parameter_list ::= LP parameter_list? COMMA? RP
258+
param_decl ::= parameter ((EQ ELLIPSIS) | [eq_expr_pin])
259+
parameter_list ::= param_decl (COMMA param_decl)* { pin(".*")=2 }
260260
parameter ::= KW_INLINE? type (ELLIPSIS? IDENT attributes? | ELLIPSIS? CT_IDENT | (HASH_IDENT | AMP IDENT) attributes? | attributes?)
261261
| ELLIPSIS | HASH_IDENT attributes?| AMP IDENT attributes? | IDENT ELLIPSIS? attributes?
262262
| CT_IDENT | CT_IDENT ELLIPSIS
@@ -392,7 +392,7 @@ compound_statement ::= LB statement_list* RB { pin(".*")=2 }
392392

393393
statement_list ::= statement+
394394

395-
unary_op ::= AMP | AND | STAR | PLUS | MINUS | BIT_NOT | BANG | PLUSPLUS | MINUSMINUS | LP type RP { name = "operator" }
395+
unary_op ::= AMP | AND | STAR | PLUS | MINUS | BIT_NOT | BANG | BANGBANG | PLUSPLUS | MINUSMINUS | LP type RP { name = "operator" }
396396
mult_bin_op ::= STAR | DIV | MOD { name = "operator" }
397397
shift_bin_op ::= SHL | SHR { name = "operator "}
398398
bit_bin_op ::= AMP | BIT_XOR | BIT_OR { name = "operator" }
@@ -456,7 +456,7 @@ call_expr ::= expr call_expr_tail {
456456
}
457457
unary_expr ::= unary_op expr { rightAssociative=true }
458458
expr_terminator ::= EOS | RP | RBT | RB | COMMA | COLON
459-
ternary_expr ::= expr QUESTION !((BANGBANG | BANG)? expr_terminator) expr COLON expr { rightAssociative=true }
459+
ternary_expr ::= expr (QUESTION | CT_TERNARY) !((BANGBANG | BANG)? expr_terminator) expr COLON expr { rightAssociative=true }
460460
optional_expr ::= expr QUESTION &((BANGBANG | BANG)? expr_terminator)
461461
elvis_bin_expr ::= expr ELVIS expr { rightAssociative=true }
462462
optelse_bin_expr ::= expr OPTELSE expr { rightAssociative=true }

src/main/java/org/c3lang/intellij/C3.flex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ LINE_COMMENT = "//" .*
186186

187187
"&&&" { return C3Types.CT_AND; }
188188
"|||" { return C3Types.CT_OR; }
189+
"???" { return C3Types.CT_TERNARY; }
189190
"+++" { return C3Types.CT_PLUS; }
190191
"..." { return C3Types.ELLIPSIS; }
191192
"<<=" { return C3Types.SHL_ASSIGN; }

0 commit comments

Comments
 (0)