Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Couldn't resolve reference to .....
Couldn't resolve reference to ..... [message #1289999] Wed, 09 April 2014 20:59 Go to next message
jack feitelsonn is currently offline jack feitelsonnFriend
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

Re: Couldn't resolve reference to ..... [message #1290443 is a reply to message #1289999] Thu, 10 April 2014 05:59 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Mismatched quotes

Couldn####t resolve reference to ..... ####ready####.

Regards

Ed Willink

On 09/04/2014 21:59, jack feitelsonn wrote:
> Hi,
>
> I have written the next code in my xtext plugin, and it got an error
> in the last word ("ready"):
>
> #############################################################
> FUNCTION func
> VAR
> var1 : {state1,state2};
> ASSIGN
> init(var1) := state1;
> #############################################################
>
>
>
> The error is:
> #############################################################
> Couldn't resolve reference to ..... 'ready'.
> #############################################################
>
>
>
> 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')?;
>
>
> ##########################################################################################################################
>
> ##########################################################################################################################
>
> ##########################################################################################################################
>
Previous Topic:How to programmatically force indexing of new EO/Res? (Creating EObjectDescription)
Next Topic:Xtend Problem
Goto Forum:
  


Current Time: Thu Mar 28 08:30:20 GMT 2024

Powered by FUDForum. Page generated in 0.05009 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top