Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Defining long in xtext and expecting rule_long error
Defining long in xtext and expecting rule_long error [message #1835100] Tue, 24 November 2020 18:49 Go to next message
Nils K. is currently offline Nils K.Friend
Messages: 13
Registered: November 2020
Junior Member
Hello,

I have an issue assigning long values and generating code from it.

I defined the long type with

terminal LONG returns ecore::ELong: ('0'..'9')+;

so I would assume any figure fitting 64bit is valid. Unfortunately, I constantly receive an error.

ERROR:Unexpected '1232323232444443', expecting rule_long.

I cannot find anything about "expecting rule_long". What does that mean?
Re: Defining long in xtext and expecting rule_long error [message #1835103 is a reply to message #1835100] Tue, 24 November 2020 19:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
please (as already said in other thread)
provide a complete grammar and unit test

the error message says: 1232323232444443 is not parsed as long in your grammar.
i dont know what other rules you have that can be conflicting


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Defining long in xtext and expecting rule_long error [message #1835104 is a reply to message #1835100] Tue, 24 November 2020 19:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

'rule_long' may be an auto-generated name that ensures that names do not clash with Java. A rule clled 'long' would be really bad.

1232323232444443 should not be a problem.

I suspect your problem is something completely different that you have not shared with us.

Regards

Ed Willink
Re: Defining long in xtext and expecting rule_long error [message #1835108 is a reply to message #1835103] Tue, 24 November 2020 19:36 Go to previous messageGo to next message
Nils K. is currently offline Nils K.Friend
Messages: 13
Registered: November 2020
Junior Member
Thanks for trying to help.

Actually, there are no other rules, or, I don't recognize them as rules.

The only additional lines are:

LongFigure:
LongValue=LONG
;

and within my generator file it is used in this way. Nevertheless it seems that function gets never called and xtext is not able to assign those long values like 1243434343434 (more than 9 figures) to my long rules/values. Is that a xtext limitation maybe? What's wrong with my terminal line defining the long figures ?

def propertyLongValue(LongFigure value){
return [...]
}
Re: Defining long in xtext and expecting rule_long error [message #1835109 is a reply to message #1835104] Tue, 24 November 2020 19:41 Go to previous messageGo to next message
Nils K. is currently offline Nils K.Friend
Messages: 13
Registered: November 2020
Junior Member
One thing I noticed about your comment was that "long" may be a bad name and I tried to play around with it. Even that did not fix it and I renamed it back to long, I noticed a new error :

"The rule LONG does not override a rule from a super grammar."

Am I required to import something to use long values maybe?
Re: Defining long in xtext and expecting rule_long error [message #1835110 is a reply to message #1835109] Tue, 24 November 2020 19:59 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Please provide complete grammar and unit test

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Want add Array slice feature for my library
Next Topic:Scope provider adaption
Goto Forum:
  


Current Time: Fri Apr 19 21:19:07 GMT 2024

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

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

Back to the top