xtext with xcore as meta model [message #1081418] |
Wed, 07 August 2013 07:57 |
|
Hi,
I am using .xcore file as meta model for my grammar, which looks something like this,
class Sample{
Integer bit
....
.....
....
}
And my grammar:
Sample:
'Sample'....
....
('BIT' | 'BYTE') bit=INT
This "bit=INT" I am referring from my xcore model.
MY PROBLEM IS THAT I WANT TO EITHER TYPE "BIT AND THEN BIT VALUE" OR "BYTE AND THEN BYTE VALUE" IN MY LANGUAGE.
BUT WHEN I WRITE "BYTE AND BYTE VALUE" , I AM CONVERTING BITS INTO BYTES AND THEN STORING IT IN SAME METAMODEL FIELD "bit".
SO LATER WHEN I READ THE "RESOURCE" I WILL GET THE BIT VALUE BUT I AM UNAWARE WHETHER IT IS "BIT OR BYTE"...
"I DON'T WANT TO STORE ONE MORE VARIABLE FOR BYTE IN XCORE".
CAN ANYONE HELP ME OUT WITH THIS PROBLEM ? OR ANY BETTER SUGGESTIONS FOR THIS ??
Thanks in advance !
I tried with this also
('BIT' bit=INT | 'BYTE' bit=BYTE ) ;
BYTE: INT;
But it gives me:
"Cannot find compatible feature bit in sealed EClass Sample from imported package http://somepath: The existing feature 'bit' has an incompatible type 'EIntegerObject' [java.lang.Integer]. The expected type is 'Byte'."
Any suggestions from anyone?
Thanks in advance!
Arshad
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04159 seconds