| Dynamic type of variable in grammar [message #1441152] |
Thu, 09 October 2014 06:25  |
Eclipse User |
|
|
|
Hey,
I'm trying to implement a grammar for this:
type java.lang.String default "Something";
type java.lang.Long default 0;
type java.lang.Boolean default true;
The JvmType reference is working fine, but I'm a little unsure on how to proceed with the default values. Content assist should propose to me the values allowed for the current type only of course, and validation must make sure that no unsupported types are written there by hand...
What I have so far (incomplete I know, just to test):
TypeRefDecl:
'type' type=JvmTypeRef ('default' (defInt=INT|defStr=STRING|defId=ID))? ';'
;
That basically allows me to write there a lot of different default values. Still this grammar "feels" somehow wrong. Also, how could I distinguish which one to read in my code now...?
Am I on the right track, or is there some method of doing this that I'm not aware of?
Cheers,
Markus
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04867 seconds