Hi,
I'm trying to parse language where the naming convention is not very strict and the keywords can be used as parameters (name or value). I have the following dummy grammar (each statement should be on a separate line) :
grammar test.org.xtext.example.mydsl.MyDsl hidden (WS)
generate myDsl "http://www.org.test/xtext/example/mydsl/MyDsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
Model:
(statements+=Statement EOL+)*
statements+=Statement EOL*
;
Statement:
ImportStatement|
RunStatement
;
RunStatement:
{RunQueryStatement} 'RUN' 'PROC' parameterList+=ParameterDefinition+
;
ParameterDefinition:
{VariableDefinition} paramName=ID '=' paramValue=(ID|STRING)
;
ImportStatement:
{ImportProcSatatement} 'IMPORT' 'PROC' 'FROM' fileName=STRING
;
terminal ID:
(!('\r'|'\n'|' '|'\t'|'"'|"'"|'='))+
;
terminal EOL:
('\r'? '\n')
;
terminal WS :
(' '|'\t')+
;
terminal STRING :
'"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'"') )* '"' |
"'" ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|"'") )* "'"
;
When parsing the following code :
IMPORT PROC FROM 'myfile'
RUN PROC param=PROC
I get an error on the second line "no viable alternative at input 'PROC'".
How can I change the rules to be able to parse this script?