Fixed small conflicts in Translator.
[charm.git] / src / langs / charj / src / charj / translator / CharjEmitter.g
index 076e6fcf0253539a1330d4cef0bce49fe7bc3b9b..feeb88a02f1cadc2d5d6da937dfbbaa682519c73 100644 (file)
@@ -210,11 +210,6 @@ classScopeDeclaration
     :   ^(FUNCTION_METHOD_DECL m=modifierList? g=genericTypeParameterList? 
             ty=type IDENT f=formalParameterList
             b=block?)
-        {
-            // determine whether it's an entry method
-            if($m.start != null)
-                entry = listContainsToken($m.start.getChildren(), CHARJ_MODIFIER_LIST);
-        }
         -> {emitCC()}? funcMethodDecl_cc(
                 sym={currentClass},
                 modl={$m.st}, 
@@ -230,7 +225,29 @@ classScopeDeclaration
                 id={$IDENT.text}, 
                 fpl={$f.st}, 
                 block={$b.st})
-        -> {(emitCI() && entry)}? funcMethodDecl_ci(
+        -> {emitCI()}? // do nothing, since it's not an entry method
+        ->
+    |   ^(ENTRY_FUNCTION_DECL m=modifierList? g=genericTypeParameterList? 
+            ty=type IDENT f=formalParameterList a=arrayDeclaratorList? 
+            b=block?)
+        -> {emitCC()}? funcMethodDecl_cc(
+                sym={currentClass},
+                modl={$m.st}, 
+                gtpl={$g.st}, 
+                ty={$ty.st},
+                id={$IDENT.text}, 
+                fpl={$f.st}, 
+                adl={$a.st},
+                block={$b.st})
+        -> {emitH()}? funcMethodDecl_h(
+                modl={$m.st}, 
+                gtpl={$g.st}, 
+                ty={$ty.st},
+                id={$IDENT.text}, 
+                fpl={$f.st}, 
+                adl={$a.st},
+                block={$b.st})
+        -> {emitCI()}? funcMethodDecl_ci(
                 modl={$m.st}, 
                 gtpl={$g.st}, 
                 ty={$ty.st},
@@ -251,12 +268,23 @@ classScopeDeclaration
             declList={$variableDeclaratorList.st})
         ->
     |   ^(CONSTRUCTOR_DECL m=modifierList? g=genericTypeParameterList? IDENT f=formalParameterList b=block)
+        -> {emitCC()}? ctorDecl_cc(
+                modl={$m.st},
+                gtpl={$g.st}, 
+                id={$IDENT.text}, 
+                fpl={$f.st}, 
+                block={$b.st})
+        -> {emitCI()}? // do nothing, it's not an entry constructor
+        -> {emitH()}? ctorDecl_h(
+                modl={$m.st},
+                gtpl={$g.st}, 
+                id={$IDENT.text}, 
+                fpl={$f.st}, 
+                block={$b.st})
+        ->
+    |   ^(ENTRY_CONSTRUCTOR_DECL m=modifierList? g=genericTypeParameterList? IDENT f=formalParameterList b=block)
         {
-            // determine whether it's an entry method
-            if ($m.start != null) {
-                entry = listContainsToken($m.start.getChildren(), CHARJ_MODIFIER_LIST);
-            }
-            migrationCtor = currentClass.migrationCtor == $CONSTRUCTOR_DECL;
+            migrationCtor = currentClass.migrationCtor == $ENTRY_CONSTRUCTOR_DECL;
         }
         -> {emitCC()}? ctorDecl_cc(
                 modl={$m.st},
@@ -264,7 +292,7 @@ classScopeDeclaration
                 id={$IDENT.text}, 
                 fpl={$f.st}, 
                 block={$b.st})
-        -> {emitCI() && entry && !migrationCtor}? ctorDecl_ci(
+        -> {emitCI() && !migrationCtor}? ctorDecl_ci(
                 modl={$m.st},
                 gtpl={$g.st}, 
                 id={$IDENT.text}, 
@@ -770,6 +798,8 @@ expr
         -> template(ty={$ty.st}, e1={$e1.st}) "(<ty>)<e1>"
     |   primaryExpression
         -> {$primaryExpression.st}
+    |   ^(POINTER_DEREFERENCE e1 = expr)
+        ->  template(e = {$e1.st}) "*(<e>)"
     ;
 
 primaryExpression