mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
convert [,,] to [][][]
This commit is contained in:
parent
e9ac5f88d2
commit
01fdc1d195
@ -245,10 +245,17 @@ variable_reference:
|
||||
expression;
|
||||
rank_specifiers:
|
||||
rank_specifier+ ;
|
||||
// convert dimension separators into additional dimensions, so [,,] -> [] [] []
|
||||
rank_specifier:
|
||||
'[' dim_separators? ']' ;
|
||||
dim_separators:
|
||||
','+ ;
|
||||
o='[' dim_separators? c=']' -> $o $c dim_separators?;
|
||||
dim_separators
|
||||
@init {
|
||||
CommonTree ret = (CommonTree)adaptor.Nil;
|
||||
}
|
||||
@after {
|
||||
$dim_separators.tree = ret;
|
||||
}:
|
||||
(c=',' { adaptor.AddChild(ret, adaptor.Create(OPEN_BRACKET, $c.token, "["));adaptor.AddChild(ret, adaptor.Create(CLOSE_BRACKET, $c.token, "]")); })+ -> ;
|
||||
|
||||
delegate_creation_expression:
|
||||
// 'new'
|
||||
|
@ -166,11 +166,12 @@ ref_variable_reference:
|
||||
variable_reference:
|
||||
expression;
|
||||
rank_specifiers:
|
||||
rank_specifier+ ;
|
||||
rs+=rank_specifier+ -> template(rs={$rs}) "<rs>";
|
||||
rank_specifier:
|
||||
'[' dim_separators? ']' ;
|
||||
dim_separators:
|
||||
','+ ;
|
||||
'[' /* dim_separators? */ ']' -> string(payload={"[]"}) ;
|
||||
// keving
|
||||
// dim_separators:
|
||||
// ','+ ;
|
||||
|
||||
delegate_creation_expression:
|
||||
// 'new'
|
||||
|
@ -134,9 +134,10 @@ variable_reference:
|
||||
rank_specifiers:
|
||||
rank_specifier+ ;
|
||||
rank_specifier:
|
||||
'[' dim_separators? ']' ;
|
||||
dim_separators:
|
||||
','+ ;
|
||||
'[' /*dim_separators?*/ ']' ;
|
||||
// keving
|
||||
// dim_separators:
|
||||
// ','+ ;
|
||||
|
||||
delegate_creation_expression:
|
||||
// 'new'
|
||||
|
@ -16,6 +16,9 @@ tokens {
|
||||
IN;
|
||||
OUT;
|
||||
|
||||
OPEN_BRACKET='[';
|
||||
CLOSE_BRACKET=']';
|
||||
|
||||
ENUM_BODY;
|
||||
TYPE_PARAM_CONSTRAINT;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user