Reputation: 305
as you know, it is possible to make a boolean feature like
tokenExist ?= 'TOKEN'?
How can i know consume more than one token like this:
tokensExist ?= ('TOKENONE' 'TOKENTWO')?
This is not valid in Xtext.
My current solution approach looks like this:
(tokensExist ?='TOKENONE' 'TOKENTWO')?
works, but does not really express what is meant
Any ideas?
Upvotes: 1
Views: 520
Reputation: 8715
Your approach is ok. You save the presence of the first (or any other) token in the sequence to the tokensExist
boolean field. The presence and order of the other tokens are guaranteed by the parser.
Upvotes: 1