Hi all,

I wrote a returns [String s] in my rules in order to get a return value, but
when I call the function generated by the exact rule in the main function,
there is not any return value, and the type of return value is not a String,
and the value includes a tree structure,etc, but I define it as a string in
the antlrworks, does anybody know what's the problem in my project? how can
i get the return String I defined? I am almost crazy about this annoying
problem,
here is a part of my grammar:

num    returns [String t]
        :n = Num  {$t =
$n.getText();}|b64=Base64Block{$t=$b64.getText();}|ident=Id{$t=$ident.getText();}
        ;
base1   returns[String input]
        :
b64=Base64Block{$input=$b64.getText();}|ident=Id{$input=$ident.getText();}|n
= Num  {$input = $n.getText();}
        ;
id1   returns[String input]
      :ident=Id{$input=$ident.getText();/*System.out.println($input);*/}
|b64=Base64Block{$input=$b64.getText();}|n = Num  {$input = $n.getText();}
      ;

Num   :     ( '0'..'9' ) * ;
Id   :     ( 'a'..'z' | 'A'..'Z' | '_' ) ( 'a'..'z' | 'A'..'Z' | '_' |'-'|
'0'..'9' ) *;
Base64Block  :('a'..'z'| 'A'..'Z'|'0'..'9'|'/'|'+'|'=')*;
//Base64Block      : ('a'..'z' | 'A'..'Z' | 'O'..'9' | '/' | '+' | '=')*;
ChallengeBlock   : ( 'a'..'z' | 'A'..'Z' | 'O'..'9'| ':')* ;
//fragment
WS  :  (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
    ;



thanks alot!
-- 
Su Zhang
Computer Information and Science
Kansas State University

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to