Data type rules for string literals [message #1824293] |
Mon, 13 April 2020 13:51 |
Oshando Johnson 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.
|
|
|
Powered by
FUDForum. Page generated in 0.02947 seconds