| [SOLVED] Grammar Warning The rule ... may be consumed without object instantiation. [message #846089] |
Sun, 15 April 2012 15:00  |
kon f Messages: 28 Registered: March 2012 |
Junior Member |
|
|
Hey Guys!
I'm reading the Xtext documentation and was playing around with some examples. I found a nice one that uses unordered groups to explain the modifiers of the Java language:
enum Visibility:
PUBLIC='public' | PRIVATE='private' | PROTECTED='protected';
Modifier:
(static?='static')? & (final?='final')? & visibility=Visibility;
Since the Java language also provides the none (or package) modifier, I extended the example (wrapped the visibility assignment with optional cardinality):
enum Visibility:
PUBLIC='public' | PRIVATE='private' | PROTECTED='protected';
Modifier:
(static?='static')? & (final?='final')? & (visibility=Visibility)?;
Now, I'm getting a warning: The rule 'Modifier' may be consumed without object instantiation. Add an action to ensure object creation, e.g. '{Modifier}'.
I found some similar issues on this website and understand the reason for the warning, but I wasn't able to get rid of it.
I don't know if my approach is straightforward. Thank you 
Kon
[Updated on: Sun, 15 April 2012 16:45] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06176 seconds