Couldn't resolve reference to ..... [message #1289999] |
Wed, 09 April 2014 20:59 |
jack feitelsonn Messages: 4 Registered: March 2014 |
Junior Member |
|
|
Hi,
I have written the next code in my xtext plugin, and it got an error in the last word ("state1"):
#############################################################
FUNCTION func
VAR
var1 : {state1,state2};
ASSIGN
init(var1) := state1;
#############################################################
The error is:
#############################################################
Couldn't resolve reference to ..... 'state1'.
#############################################################
Can anyone help me to understand what wrong in my grammar (attached below)?
Thanks in advance!
|
|
|
|
My xtext grammar: <<<<<<<<<<<=================|
##########################################################################################################################
##########################################################################################################################
##########################################################################################################################
grammar org.xtext.osy.ExtendedSMV with org.eclipse.xtext.common.Terminals
import 'http://www.eclipse.org/emf/2002/Ecore' as ecore
generate ...
Model:
(modules += Function)*
;
Function:
'FUNCTION' name=IDENTIFIER (sections += (VariableDeclaration | Assignments))*
;
VariableDeclaration:
{VariableDeclaration} 'VAR' (variables+=DeclaredVariable)*
;
DeclaredVariable returns Variable:
name=IDENTIFIER ':' type=SimpleTypeSpecifier semicolon?=';'?
;
SimpleTypeSpecifier:
{EnumType} '{' literals+=EnumVariable (',' literals+=EnumVariable)* '}'
;
EnumVariable returns Variable:
name=IDENTIFIER
;
SimpleExpression returns Expression:
ComplexIdentifier
;
Assignments:
{Assignments} 'ASSIGN' (assignments += InitAssign)*
;
InitAssign:
'init' '(' id=ComplexIdentifier ')' ':=' expression=SimpleExpression semicolon?=';'?
;
ComplexIdentifier returns Expression:
ComplexIdentifierPrimary ({BinaryExpression.left=current} '.' right=ComplexIdentifierPrimary)*;
superType:
DeclaredVariable | EnumVariable
;
ComplexIdentifierPrimary returns Expression:
{ComplexIdentifier} var=[superType|IDENTIFIER] ('[' expression=SimpleExpression ']')?
;
terminal fragment DIGIT:
('0'..'9')
;
terminal IDENTIFIER:
(('a' .. 'z') |( 'A' .. 'Z') | '_') (('a' .. 'z') | ('A' .. 'Z') | '_' | DIGIT | '$' | '#' | '-')*
;
terminal SMV_COMMENT : '--' !('\n'|'\r')* ('\r'? '\n')?;
##########################################################################################################################
##########################################################################################################################
##########################################################################################################################
[Updated on: Wed, 09 April 2014 21:00] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03244 seconds