Error in creating fragment for STRING [message #1799725] |
Wed, 12 December 2018 22:09  |
Eclipse User |
|
|
|
Hi,
I have the below code for a DSL that I'm building using Xtext in Eclipse (I'm converting a .g4 file to Xetxt: -
Domainmodel:
elements+=projection_name elements+=projection_component elements+=layer_specification
elements+=description
;
projection_name
: keywords+=KEYWORD_projection model_name+=projection_name_model_name punctuations+=SEMICOLON
;
projection_name_model_name
: identifiers+=identifier2
;
projection_component
: keywords+=KEYWORD_component component_name+=projection_component_component_name punctuations+=SEMICOLON
;
projection_component_component_name
: identifier+=identifier2
;
layer_specification
: keywords+=KEYWORD_layer layer_name+=layer_specification_layer_name punctuations+=SEMICOLON
;
layer_specification_layer_name
: identifier+=identifier2
;
description
: keywords+=KEYWORD_description string+=STRING punctuations+=SEMICOLON
;
KEYWORD_component
: ( key='component' )
;
KEYWORD_description
: ( key='description' )
;
KEYWORD_layer
: ( key='layer' )
;
KEYWORD_projection
: ( key='projection' )
;
fragment STRING
: '"' ( ('\\'|'"') | ('\\'|'"'))* '"'
;
SEMICOLON
: symbol=';'
;
identifier2
: IDENTIFIER
;
projectionmainidentifier
: IDENTIFIER
;
offlineexpressionidentifier
: IDENTIFIER
| KEYWORD_description
| KEYWORD_projection
;
IDENTIFIER
: name=ID
;
Everything is fine except for the 'fragment STRING' definition. The word 'STRING' gets underlined in red and states "A datatype rule cannot override a terminal rule."
Could you please tell me how this should be corrected?
Regards.
[Updated on: Wed, 12 December 2018 22:30] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07633 seconds