I had this code:


inverse-handled(|cname, name) : _ ->

handle-property(|cname) : CompositeProperty(name, referenced) ->
<handle-composite(|cname, name)>referenced
where not(<inverse-handled(|cname, name)>_)

Which resulted in:


stratego.jvm.helper:
[java] [ Main | error ] match symbols in build pattern
[java] Build(Wld)
[java] [ Main | error ] match symbols in build pattern
[java] Build(Wld)
[java] [ Main | error ] Compilation failed (2.74 secs)

During build. A workaround seems to be to change the code to:


inverse-handled(|cname) : name ->

handle-property(|cname) : CompositeProperty(name, referenced) ->
<handle-composite(|cname, name)>referenced
where not(<inverse-handled(|cname)>name)

Submitted by Sverre Rabbelier on 9 May 2010 at 02:22

On 10 May 2010 at 10:25 Lennart Kats commented:

The _ pattern is currently only allowed in term matching (e.g., the left-hand side of a rule), not when constructing a new term. Unlike in Perl, you cannot construct the current term explicitly using the _, but much like Perl you can use it implicitly:


handle-property(|cname) : CompositeProperty(name, referenced) ->
<handle-composite(|cname, name)>referenced
where not(inverse-handled(|cname))

(The <> application brackets can then be removed.) Likewise, x := <foo> applies foo to the current term.

Of course, the Spoofax editor should really tell you about this directly (new issue: Spoofax/119); it shouldn’t fail just when compiling the program.

Log in to post comments