using concrete Java syntax in Stratego:

rules
  foo1 : java |[ {java_bstm*} ]| -> ""
  foo2 : java |[ {~bstm*:bstm*} ]| -> ""

gives this AST

Rules(
          [ RDefNoArgs(
              "foo1"
            , RuleNoCond(
                ToMetaExpr(Block([meta-var("java_bstm*")]))
              , NoAnnoList(Str("\"\""))
              )
            )
          , RDefNoArgs(
              "foo2"
            , RuleNoCond(
                ToMetaExpr(Block([Var(ListVar("bstm*"))]))
              , NoAnnoList(Str("\"\""))
              )
            )
          ]
        )

The meta variables java_bstm* and bstm* should represent lists of statements, and not single statements inside a single-statement block. The relevant productions for concrete Java support are:

variables
  "java_" "bstm" [0-9\']* "*"         -> JavaBlockStm*   {prefer}
context-free syntax
  "~bstm*:" StrategoTerm  -> JavaBlockStm* {cons("FromMetaExpr")}
Submitted by Sebastian Erdweg on 2 March 2011 at 21:46

On 7 March 2011 at 09:41 Lennart Kats commented:

(It seems email notifications were broken, only just noticed this issue.) So you found a case where you could reproduce this problem? Was it in any of the source files? The XML one I looked at seemed to work. Anyway, the problem likely resides in the TreeBuilder class that implodes the tree. As a workaround, you can probably use ~bstm:bstms as well.


On 7 March 2011 at 09:42 Lennart Kats tagged parser

On 7 March 2011 at 09:42 Lennart Kats tagged @lennartkats

On 8 March 2011 at 09:50 Sebastian Erdweg commented:

Using ~bstm:bstms did not help.

I extracted the example to the following file:
https://svn.strategoxt.org/repos/StrategoXT/sugarj/branches/SugarJ-editor-services/case-studies/concretesyntax/MetaListVarTest.sugj


On 14 March 2011 at 10:17 Lennart Kats commented:

This may be a duplicate of Spoofax/346, and may indicate a parser issue rather than an imploder issue.


On 14 March 2011 at 10:18 Lennart Kats tagged @maartje

On 14 March 2011 at 10:18 Lennart Kats tagged composition

On 8 January 2013 at 15:05 Eelco Visser tagged sdf

On 8 January 2013 at 15:05 Eelco Visser tagged concrete-syntax

On 8 January 2013 at 16:09 Eelco Visser removed tag @lennartkats

Log in to post comments