dcsimg
Trouble with variable usage
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andrew_Sutherland
Posted On:   Tuesday, May 20, 2003 05:46 PM

I'm getting an error with variables within a rule: statement : i:instruction (s:sumExpr)? {#statement = #([INST,#i.getText()], s);} ; Gives a compiler error when I run javac: TestParser.java:265: cannot resolve symbol symbol : variable i location: class TestParser statement_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(INST,i.getText())).add(s_AST)); This seems to fix the problem: statement : i:instruction (s:sumExpr)? {#statement = #([INST,i_AST.getText()], s);} ; Is it broken or am I missing something? thanks Andrew    More>>

I'm getting an error with variables within a rule:


statement
: i:instruction (s:sumExpr)?
{#statement = #([INST,#i.getText()], s);}
;


Gives a compiler error when I run javac:


TestParser.java:265: cannot resolve symbol
symbol : variable i
location: class TestParser
statement_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(INST,i.getText())).add(s_AST));


This seems to fix the problem:


statement
: i:instruction (s:sumExpr)?
{#statement = #([INST,i_AST.getText()], s);}
;


Is it broken or am I missing something?
thanks
Andrew

   <<Less
About | Sitemap | Contact