Hi!
I've just started mu journey with Xtext. I've created a simple grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "h_t_t_p://www.xtext.org/example/mydsl/MyDsl"
Services:
'services' id=MYID name=ID '{'
(points+=Points)+
'}'
;
Points:
'point' id=MYID name=ID '{'
(entities+=Entity)*
defaultPoints=DefaultPoints
'}'
;
DefaultPoints:
'defaultPoints' defaultPoints+=PointId (',' defaultPoints+=PointId)*
;
PointId:
ref=[Basic];
Entity:
Basic | Advanced
;
Basic:
'basic' id=MYID name=ID '{'
'}'
;
Advanced:
'advanced' id=MYID name=ID '{'
'group' '{'
defaultPoints+=PointId (',' defaultPoints+=PointId)*
'}'
'}'
;
terminal MYID:
'A'..'Z' '-' INT;
Below is an example of use:
services S-2 whole_config {
point P-1 point1 {
basic B-1 basic11 {
}
basic B-2 basic12 {
}
basic B-3 basic13 {
}
advanced A-1 advanced11 {
group {
basic11 //here is ok
}
}
defaultPoints basic11 //here is ok
}
point P-2 point2 {
basic B-3 basic21 {
}
basic B-4 basic22 {
}
basic B-5 basic23 {
}
advanced A-2 advanced21 {
group {
basic11 //here I have an error
}
}
defaultPoints basic11 //here I have an error
}
}
In this grammar I use reference (in 'group' and DefaultPoints) a reference to "Basic".
Why I can not point 'basic' elements from P-1 in P-2? I can point only 'basic' elements int this same 'point'
Thank you in advance for any help