npalix / rathaxes

Automatically exported from code.google.com/p/rathaxes
1 stars 0 forks source link

Cannot declare a C scope directly in (i.e: "at the root of") a chunk #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to declare a C scope directly in a chunk in a blt, like this:

template sequence foo()
{
    chunk ::CALL()
    {
        {
            /* A variable declaration I'd like to scope */
            int i;

            /* Some useful code */
            i = 0;
            i++;
        }
    }
}

But it fails with:

Template sequence block!
CHUNK
An error Occured while parsing :
Trace:
rathaxes.cws(213): main scope
cnorm.cwp(76): rtxParseFile
rtx.cwp(26): translation_unit
rtx.cwp(37): rtx_declaration
rtxBack.cwp(126): rtx_stmt<"with">
rtx.cwp(37): rtx_declaration
rtxBack.cwp(28): rtx_stmt<"template">
rtxBack.cwp(37): rtx_stmt_template_content<"sequence">
rtxBack.cwp(210): rtx_stmt<"chunk">
rtxTemplatedLanguage.cwp(25): rtx_templatedLang_body<"C">
cnormDeclarations.cwp(592): initializer_list
rtx.cwp(11): initializer

Error: line 998, col 19:
bad initializer_list after '{'

Original issue reported on code.google.com by kalessin...@gmail.com on 18 Sep 2012 at 6:15

GoogleCodeExporter commented 9 years ago
Lowering the priority, I can add the scope in the calling code (I'm actually 
forced to do so because of #13 and #10).

Original comment by kalessin...@gmail.com on 18 Sep 2012 at 6:58

GoogleCodeExporter commented 9 years ago
This is merely an unforeseen way to use scope within rathaxes.
It will be fixed soon.

Original comment by dav.pineau@gmail.com on 18 Sep 2012 at 3:29

GoogleCodeExporter commented 9 years ago
Here is how to add it to the test suite to reproduce it easily:

patch -p1 << 'EOF'
diff --git a/rathaxes/compiler/tests/01_A_test_back_parse.cws 
b/rathaxes/compiler/tests/01_A_test_back_parse.cws
--- a/rathaxes/compiler/tests/01_A_test_back_parse.cws
+++ b/rathaxes/compiler/tests/01_A_test_back_parse.cws
@@ -125,7 +125,9 @@
         {
             chunk ::CALL()
             {
-                ${LKM::test(ctx)};
+                { // regression test for #47
+                    ${LKM::test(ctx)};
+                }
             }
         }

EOF

(Just copy and paste the above blob in your shell from the root of the repo and 
then run make test).

Original comment by kalessin...@gmail.com on 19 Sep 2012 at 5:26

GoogleCodeExporter commented 9 years ago
Resolved in Revision: 0d1239bf1ce2

Original comment by dav.pineau@gmail.com on 20 Sep 2012 at 2:59