Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » terminal rule interference(I have a YYYY terminal rule for years interference with INT types)
terminal rule interference [message #767697] Sun, 18 December 2011 18:01 Go to next message
Pavel  is currently offline Pavel Friend
Messages: 5
Registered: July 2011
Junior Member
Hello,
I created a rule for a year terminal type defined as:
terminal YYYY:
('1'..'2')('0'..'9')('0'..'9')('0'..'9');

However, I've noticed that anywhere I specify an INT value that is set to a number that fits the above pattern, I get an error in the editor.
For example:

DeclareInt:
"Integer" name=ID '=' value=INT

gives an error when I set:
Integer foo = 1900

but it's ok when I set:
Integer foo=22222;

I must not be using the terminal logic correctly but not sure what's the best way around this issue.
Re: terminal rule interference [message #767698 is a reply to message #767697] Sun, 18 December 2011 18:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

what about using year=INT and write a Java Validation that the int fits your needs to a year.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: terminal rule interference [message #767700 is a reply to message #767698] Sun, 18 December 2011 18:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Alteratively you could use

MyInt returns ecore::EInt: YEAR |INT;

+ a ValueConverter


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: terminal rule interference [message #767793 is a reply to message #767698] Sun, 18 December 2011 23:51 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2011-18-12 19:05, Christian Dietrich wrote:
> Hi,
>
> what about using year=INT and write a Java Validation that the int fits
> your needs to a year.
>
> ~Christian
And, I blogged about handling Date using a datatype and how to support
quick fix for dates - read more here:
http://henrik-eclipse.blogspot.com/2010/05/implementing-date-support-with-quickfix.html

Regards
- henrik
Re: terminal rule interference [message #768054 is a reply to message #767698] Mon, 19 December 2011 13:53 Go to previous message
Pavel  is currently offline Pavel Friend
Messages: 5
Registered: July 2011
Junior Member
This one worked really well. Thank you!
Previous Topic:Distinguish imported namespaces by file type
Next Topic:Resolving links in files that are not in the Project
Goto Forum:
  


Current Time: Wed Apr 24 15:55:02 GMT 2024

Powered by FUDForum. Page generated in 0.03222 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top