I have these rules

Transition: ('from' initial+=InitialState)* action=StatementSequence ; InitialState: origin=[StateDeclaration] (read ?= '?')? ; StatementSequence returns Statement: Statement ({StatementSequence.statements+=current} ';' statements+=Statement)* ; Statement: NullStatement //start with 'null' | ToStatement //start with 'to' | PatternStatement

So, I have a problem when the First statement is a PatternStatement because it doesn't start with a keywork

for example:

Example 1

from a b c to x

No problem

Example 2

from a b c null

No problem

but

Example 3

from a b c x := y

here, there is a problem. the x variable is considered as a [StateDeclaration]

the error is Couldn't resolve reference to StateDeclaration 'x'.

]]>

i do not really get your problem

(besides this little typo???)

Transition: 'from'( initial+=InitialState)* action=StatementSequence ;

This is the transition rule

Transition: 'from'( initial+=InitialState)* action=StatementSequence ;

but with this also, I have the same problem]]>

Model: states+=StateDeclaration* vars+=Variable* trans+=Transition ; StateDeclaration: "state" name=ID ; Variable: "var" name=ID ; Transition: 'from'( initial+=InitialState)* action=StatementSequence ; InitialState: origin=[StateDeclaration] (read ?= '?')? ; StatementSequence returns Statement: Statement ({StatementSequence.statements+=current} ';' statements+=Statement)* ; Statement: NullStatement //start with 'null' | ToStatement //start with 'to' | PatternStatement ; NullStatement: {NullStatement}'null' ; ToStatement: {ToStatement} 'to' ; PatternStatement: var=[Variable] ':=' exp=ID ;