bound an integer in xtext [message #882820] |
Thu, 07 June 2012 05:09  |
Eclipse User |
|
|
|
Hi,
just to know if it is possible to bounded an integer in xtext, that means just imagine you define your grammar and after running the workflow and the eclipse application, when you want to write your textual editor , you want one of your integer value , for example size to be in a certain range like if you choose to enter 25000 for the size that would be mark as an error and you can only choose value between for example 10 and 500.
EEPROM_MANAGEMENTTYPE :
'eEPROM_DEVICES' ( EEPROM_DEVICES+=EEPROM_DEVICESTYPE )+
(EEPROM_ZONE+=EEPROM_ZONETYPE)+
;
EEPROM_DEVICESTYPE :
name=ID code=ID
;
EEPROM_ZONETYPE :
'eEPROM_ZONE' name=ID
'size' size=INT
'offset' offset=INT
(transitions+=Transition)*
('EEPROM_BLOCK' '{' EEPROM_BLOCK+=EEPROM_BLOCKTYPE ("," EEPROM_BLOCK+=EEPROM_BLOCKTYPE)* '}')?
;
EEPROM_BLOCKTYPE :
'numberOfCopy' numberOfCopy=INT
'numberOfZone' numberOfZone=INT
'priority' priority=INT
'size' size=INT
'EEPROM_BLOCKLOCAL' (EEPROM_BLOCKLOCAL=EEPROM_BLOCKLOCALTYPE)
;
EEPROM_BLOCKLOCALTYPE :
'{'
'callBackFunction' callBackFunction=STRING
'data' data=STRING
'hasRAMImage' hasRAMImage=STRING
'include' include=Name
'isReadOnly' isReadOnly=STRING
'isSecured' isSecured=STRING
'name' name=STRING
'rAMImagePointer' rAMImagePointer=STRING
'startupInit' startupInit=STRING
'}';
Name :
'in' localName=STRING
;
Transition:
eEPROM_DEVICESTYPE=[EEPROM_DEVICESTYPE]
//'refer to' eEPROM_ZONETYPE=[EEPROM_ZONETYPE]
;
that means for the integer value numberOfCopy in my example and only want to enter value between 2 and 10 and want the other values to be mark as an error if put it.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04799 seconds