Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Data type rules for string literals (Data type rule doesn't work for string literal)
Data type rules for string literals [message #1824293] Mon, 13 April 2020 13:51
Oshando Johnson is currently offline Oshando JohnsonFriend
Messages: 1
Registered: April 2020
Junior Member
I'm creating a language that should accept a Java method signature in the following format: <classname>: <return type> <method name>(<parameter list>)

The language uses the signature to create a Method like this:

Method m2 = new Method("Test: void publish(int)").in().param(0);


I want to be able to validate that the method signature is in the right format. For example, that a colon exist, there's a space before and after the method return type, etc. I came up with the following Data Type rule:

MethodSignature:
'"'ID ('.'ID)*(':') ' ' ID ' ' ID '(' (ID)*')''"'
;


However, the rule doesn't seem to work and returns the following error "extraneous input '"Test: void publish(int)"' expecting ')'". When I remove the double quotes, the validation is done using the data type rule. However, I need it to work with the double quotes because the language should model Java. I've been searching for how to create data type rules for literals but I haven't found anything helpful.

It would be really helpful if someone could help me to find a solution for this issue.
Previous Topic:Problem with Xtext running in tomcat 9.0.16 guice 4.2.3, Xtext 2.20.0
Next Topic:Suppressing the "Do you want to Add Xtext Nature" popup
Goto Forum:
  


Current Time: Thu Oct 29 11:39:22 GMT 2020

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

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

Back to the top