Charj: improved entry method handling and recognition on invocation
authorAaron Becker <akbecker@gmail.com>
Fri, 28 May 2010 23:56:20 +0000 (18:56 -0500)
committerAaron Becker <akbecker@gmail.com>
Fri, 28 May 2010 23:56:20 +0000 (18:56 -0500)
src/langs/charj/src/charj/translator/Charj.g
src/langs/charj/src/charj/translator/CharjASTModifier.g
src/langs/charj/src/charj/translator/CharjEmitter.g
src/langs/charj/src/charj/translator/CharjSemantics.g

index 8b3cdb35e4fc31b5843e11d2c19aaecfc8b81e6b..76e80941444409acbad88154299bb53943f793ea 100644 (file)
@@ -98,6 +98,7 @@ tokens {
     UNARY_MINUS             = '--'              ;
     NOT                     = '!'               ;
     TILDE                   = '~'               ;
+    AT                      = '@'               ;
     INSTANCEOF              = 'instanceof'      ;
 
 
@@ -166,6 +167,7 @@ tokens {
     LOCAL_MODIFIER_LIST;
     CHARJ_SOURCE;
     METHOD_CALL;
+    ENTRY_METHOD_CALL;
     MODIFIER_LIST;
     PAREN_EXPR;
     POST_DEC;
@@ -408,22 +410,18 @@ localModifier
 type
     :   simpleType
     |   objectType
-    |   proxyType
     |   VOID
     ;
 
-proxyType
-    :   qualifiedTypeIdent '@' arrayDeclaratorList?
-        ->  ^(PROXY_TYPE qualifiedTypeIdent arrayDeclaratorList?)
-    ;
-
 simpleType
     :   primitiveType arrayDeclaratorList?
         ->  ^(SIMPLE_TYPE primitiveType arrayDeclaratorList?)  
     ;
 
 objectType
-    :   qualifiedTypeIdent arrayDeclaratorList?
+    :   qualifiedTypeIdent AT arrayDeclaratorList?
+        ->  ^(PROXY_TYPE qualifiedTypeIdent arrayDeclaratorList?)
+    |   qualifiedTypeIdent arrayDeclaratorList?
         ->  ^(POINTER_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     ;
 
@@ -733,6 +731,8 @@ postfixedExpression
                     ->  ^(METHOD_CALL $postfixedExpression arguments)
                 )?
             )
+        |   (AT genericTypeArgumentList? IDENT arguments)
+            ->  ^(ENTRY_METHOD_CALL ^(AT $postfixedExpression IDENT) genericTypeArgumentList? arguments)
         |   '[' expression ']'
             ->  ^(ARRAY_ELEMENT_ACCESS $postfixedExpression expression)
         )*
index 1ac68746dd090fa46ab692aede7906bb4550a12f..11eb4568f6f0e3b4f53f1dd8985999ad8c70abaf 100644 (file)
@@ -357,6 +357,8 @@ primaryExpression
     |   parenthesizedExpression
     |   IDENT
     |   ^(METHOD_CALL primaryExpression genericTypeArgumentList? arguments)
+    |   ^(ENTRY_METHOD_CALL ^(AT primaryExpression IDENT) genericTypeArgumentList? arguments)
+        ->  ^(ENTRY_METHOD_CALL ^(DOT primaryExpression IDENT) genericTypeArgumentList? arguments)
     |   explicitConstructorCall
     |   ^(ARRAY_ELEMENT_ACCESS primaryExpression expression)
     |   literal
index 57255794a28446a28e6c9bb25fdfa1d23aa4320b..c103c9ce1d3cf54f7c8352e425a1957253c80515 100644 (file)
@@ -664,6 +664,8 @@ primaryExpression
         -> {%{$start.getText()}}
     |   ^(METHOD_CALL pe=primaryExpression gtal=genericTypeArgumentList? args=arguments)
         -> method_call(primary={$pe.st}, generic_types={$gtal.st}, args={$args.st})
+    |   ^(ENTRY_METHOD_CALL pe=primaryExpression gtal=genericTypeArgumentList? args=arguments)
+        -> method_call(primary={$pe.st}, generic_types={$gtal.st}, args={$args.st})
     |   explicitConstructorCall
         -> {$explicitConstructorCall.st}
     |   ^(ARRAY_ELEMENT_ACCESS pe=primaryExpression ex=expression)
index b4bdad50e3bd625fa0c384ce9cebec5851d6bc33..159d495b2fe55ff8ffd8edad03ab0b3f6e457b1b 100644 (file)
@@ -464,6 +464,7 @@ primaryExpression
     |   parenthesizedExpression
     |   IDENT
     |   ^(METHOD_CALL primaryExpression genericTypeArgumentList? arguments)
+    |   ^(ENTRY_METHOD_CALL primaryExpression genericTypeArgumentList? arguments)
     |   explicitConstructorCall
     |   ^(ARRAY_ELEMENT_ACCESS primaryExpression expression)
     |   literal