Charj : small change to local variable and formal parameter
authorMinas Charalambides <charala1@illinois.edu>
Mon, 31 May 2010 22:41:59 +0000 (17:41 -0500)
committerMinas Charalambides <charala1@illinois.edu>
Mon, 31 May 2010 22:52:34 +0000 (17:52 -0500)
            declarations with regard to the handling of modifiers,
            so that they are output in the same fashion as for
            class scope declarations

            for class scope declarations, if no access modifier is
            specified, then private is assumed and added to the AST

src/langs/charj/src/charj/translator/Charj.stg
src/langs/charj/src/charj/translator/CharjEmitter.g

index 5b6dee12fd43eff3ccad38d1e8cd00e83b8833be..be010abc2eecd97a904ee70e040fd380cba022b0 100644 (file)
@@ -271,11 +271,11 @@ mod_list_ci(accmods, localmods, charjmods, othermods) ::=
 
 local_var_decl(modList, type, declList) ::=
 <<
-<if(modList)>
-<modList> <type> <declList>;
-<else>
-<type> <declList>;
-<endif>
+<if(modList)><modList> <endif><type> <declList>;
+>>
+
+local_mod_list(mods) ::= <<
+<mods; separator=" ">
 >>
 
 
index c6c33b66af149d615b2c59bfaecf8a970c833731..bb47ab55bf7d6d936e989c954fda71c28c9201d8 100644 (file)
@@ -348,6 +348,7 @@ returns [List names]
         {
             $names = $m;
         }
+        ->  local_mod_list(mods = {$names})
     ;
 
 charjModifierList
@@ -510,12 +511,12 @@ blockStatement
 localVariableDeclaration
     :   ^(PRIMITIVE_VAR_DECLARATION localModifierList? simpleType variableDeclaratorList)
         -> local_var_decl(
-            modList={null},
+            modList={$localModifierList.st},
             type={$simpleType.st},
             declList={$variableDeclaratorList.st})
     |   ^(OBJECT_VAR_DECLARATION localModifierList? objectType variableDeclaratorList)
         -> local_var_decl(
-            modList={null},
+            modList={$localModifierList.st},
             type={$objectType.st},
             declList={$variableDeclaratorList.st})
     ;