Java 嵌套缩进语言的Xtext语法
我正试图为一种语言编写Xtext语法,如下所示:Java 嵌套缩进语言的Xtext语法,java,eclipse,eclipse-plugin,antlr,xtext,Java,Eclipse,Eclipse Plugin,Antlr,Xtext,我正试图为一种语言编写Xtext语法,如下所示: on Producer1 then ProducerConsumer1 then ProducerConsumer1_1 then ProducerConsumer1_2 then ProducerConsumer1_2_1 then ProducerConsumer2 then ProducerConsumer2_1 on Producer2 th
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)?