"Hiding" a rule [message #871446] |
Sun, 13 May 2012 19:56 |
Haravikk Kh\'arr Messages: 19 Registered: February 2011 |
Junior Member |
|
|
Hi there,
Been a while since I touched Xtext, but I'm back to working on a project I put on hiatus for a while.
Anyway, one thing that I never quite decided on a solution for, and still would like to solve, is how to *remove* a rule from an extended grammar.
For example; if I'm building a grammar that is an extension of Xbase, then is it possible to prevent the use of closures by somehow making that rule unusable.
I know how to override a rule, but I'm not sure I'd go about using that to prevent a rule from being used, other than to type some kind of garbage keyword in that nobody's likely to use.
[Updated on: Sun, 13 May 2012 19:57] Report message to a moderator
|
|
|
|
Re: "Hiding" a rule [message #871450 is a reply to message #871446] |
Sun, 13 May 2012 20:16 |
|
Hi,
you have to adapt the calling rules as well. e.g.
XLiteral returns XExpression:
XBooleanLiteral |
XIntLiteral |
XNullLiteral |
XStringLiteral |
XTypeLiteral
;
XConstructorCall returns XExpression:
{XConstructorCall}
'new' constructor=[types::JvmConstructor|QualifiedName]
('<' typeArguments+=JvmArgumentTypeReference (',' typeArguments+=JvmArgumentTypeReference)* '>')?
'('
(
arguments+=XShortClosure
| arguments+=XExpression (',' arguments+=XExpression)*
)?
')';
...
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03178 seconds