我正在尝试为一种语言编写Xtext语法,如下所示:
on Producer1
then ProducerConsumer1
then ProducerConsumer1_1
then ProducerConsumer1_2
then ProducerConsumer1_2_1
then ProducerConsumer2
then ProducerConsumer2_1
on Producer2
then ProducerConsumer1
使用以下语法,我可以在 Eclipse 编辑器中看到空白块被确认,但未按我的意图嵌套:
Model:
model+=On+
;
On:
'on' producer=ValidID
BEGIN
(producerConsumers+=Then)*
END
;
Then:
'then' producerConsumer=ValidID
BEGIN
(children+=Then)*
END
;
terminal BEGIN: 'synthetic:BEGIN'; // increase indentation
terminal END: 'synthetic:END'; // decrease indentation
我是Xtext的新手,希望能指出我出错的地方。
你的意思是
Then:
'then' producerConsumer=ID
(BEGIN
(children+=Then)+
END)?