I'm trying to write an Xtext grammar for a language as follows:
on Producer1
then ProducerConsumer1
then ProducerConsumer1_1
then ProducerConsumer1_2
then ProducerConsumer1_2_1
then ProducerConsumer2
then ProducerConsumer2_1
on Producer2
then ProducerConsumer1
With the following grammar, I can see in the Eclipse editor that the white-space blocks are acknowledged but not nested how I intended:
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
I'm new to Xtext and would appreciate pointers on where I'm going wrong.
do you actually mean
Then:
'then' producerConsumer=ID
(BEGIN
(children+=Then)+
END)?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.