0
4

1 回答 1

0

I found a workaround, not ideal, but it works. It seems that the ? in the types introduces some difficulties, but can be circumvented using an "alias" for this type:

I changed the grammar to:

syntax SomeMore = [...] MaybeSyncBlock sync;
syntax MaybeSyncBlock = SyncBlock?;
syntax SyncBlock = "sync" "{" SyncStatement* stats "}";
syntax SyncStatement = [...];

Now this works:

MaybeSyncBlock syncBlock = [MaybeSyncBlock]"sync { <syncStrings> }";
于 2016-12-22T11:49:58.500 回答