I have a syntax something like this:
syntax Foo
= b:Bar z:Baz?
=> Foo { Bar => b, Baz => z }
But if Baz doesn't match then the graph projects to be:
Foo { Bar => Bar { ... }, Baz => null }
What I'd really like is for Baz to not project to null but something else instead (such as Baz { }). The only way I could get it to work so far is to completely duplicate the syntax one with Baz required and one with Baz totally missing and change the greater projection.
Here is a more complete example
Given the input text "bar", modify this language:
module test
{
language test
{
syntax Main = Foo;
syntax Foo
= b:Bar z:Baz?
=> Foo { Bar => b, Baz => z };
token Bar = "bar" => true;
token Baz = "baz" => true;
}
}
To produce the graph:
Main[
Foo{
Bar => true,
Baz => false
}
]