mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
little bits so that ScormEngine translation doesn't regress
This commit is contained in:
parent
e39fc12be4
commit
ea85f4a396
@ -289,6 +289,7 @@ lambda(args, body) ::= <<
|
||||
(<args>) => <body>
|
||||
>>
|
||||
array_construct(type, args, inits) ::= ""new <type>[<if(args)><args><endif>]<if(inits)><inits><endif>""
|
||||
array_construct_nobracks(type, inits) ::= ""new <type><if(inits)><inits><endif>""
|
||||
array_initializer(init) ::= ""{ <init> }""
|
||||
application(func, funcparens, args) ::= ""<optparens(parens=funcparens,e=func)>(<args>)""
|
||||
index(func, funcparens, args) ::= ""<optparens(parens=funcparens,e=func)>[<args>]""
|
||||
|
@ -474,6 +474,8 @@ namespace_member_declarations:
|
||||
namespace_member_declaration
|
||||
@init { string ns = $NSContext::currentNS;
|
||||
bool isCompUnit = false;
|
||||
CommonTree atts = null;
|
||||
CommonTree mods = null;
|
||||
}
|
||||
@after {
|
||||
if (isCompUnit) {
|
||||
@ -491,7 +493,7 @@ namespace_member_declaration
|
||||
}
|
||||
}:
|
||||
namespace_declaration
|
||||
| attributes? modifiers? ty=type_declaration[$attributes.tree, mangleModifiersForType($modifiers.tree)] { isCompUnit = true; }
|
||||
| attributes? { atts = dupTree($attributes.tree); } modifiers? { mods = dupTree($modifiers.tree); } ty=type_declaration[atts, mangleModifiersForType(mods)] { isCompUnit = true; }
|
||||
;
|
||||
// type_declaration is only called at the top level, so each of the types declared
|
||||
// here will become a Java compilation unit (and go to its own file)
|
||||
|
@ -516,7 +516,7 @@ primary_or_array_creation_expression returns [int precedence]:
|
||||
array_creation_expression returns [int precedence]:
|
||||
^(NEW_ARRAY
|
||||
(type ('[' expression_list? ']' rank_specifiers? ai1=array_initializer? -> array_construct(type = { $type.st }, args = { $expression_list.st }, inits = { $ai1.st }) // new int[4]
|
||||
| ai2=array_initializer -> array_construct(type = { $type.st }, inits = { $ai2.st })
|
||||
| ai2=array_initializer -> array_construct_nobracks(type = { $type.st }, inits = { $ai2.st })
|
||||
)
|
||||
| rank_specifier array_initializer // var a = new[] { 1, 10, 100, 1000 }; // int[]
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user