我正在尝试为一种语言编写 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 编辑器中看到空白 block 已被确认,但未按照我的预期嵌套:
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)?
关于java - 嵌套缩进语言的 Xtext 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30924530/