Loading ...
Sorry, an error occurred while loading the content.

A question about treeprser?

Expand Messages
  • achilles7686
    Dear antlr-interest, I want to have the pr_ModuleParList rule return an StringBuffer result ,but I don t know how to assign the return value when it is
    Message 1 of 2 , Dec 12, 2004
    • 0 Attachment
      Dear antlr-interest,

      I want to have the pr_ModuleParList rule return an StringBuffer
      result ,but I don't know how to assign the return value when it is
      enclosed .


      pr_TTCN3Module returns [StringBuffer output]
      {
      output=new StringBuffer();
      StringBuffer retStr;
      }
      :
      #(
      TTCN3Module
      retStr=pr_TTCN3ModuleId
      ( pr_ModuleParList )*
      )
      {
      output.append(retStr);
      };
    • Terence Parr
      ... Howdy. Not sure I understand the question, but try having pr_ModuleParList return a StringBuffer like the others. Then, in the loop do this: (
      Message 2 of 2 , Dec 13, 2004
      • 0 Attachment
        On Dec 12, 2004, at 6:12 PM, achilles7686 wrote:
        > I want to have the pr_ModuleParList rule return an StringBuffer
        > result ,but I don't know how to assign the return value when it is
        > enclosed .
        >
        >
        > pr_TTCN3Module returns [StringBuffer output]
        > {
        > output=new StringBuffer();
        > StringBuffer retStr;
        > }
        > :
        > #(
        > TTCN3Module
        > retStr=pr_TTCN3ModuleId
        > ( pr_ModuleParList )*
        > )
        > {
        > output.append(retStr);
        > };

        Howdy. Not sure I understand the question, but try having
        pr_ModuleParList return a StringBuffer like the others. Then, in the
        loop do this:

        ( retStr=pr_ModuleParList {output.append(x);} )*

        Ter
        --
        CS Professor & Grad Director, University of San Francisco
        Creator, ANTLR Parser Generator, http://www.antlr.org
        Cofounder, http://www.jguru.com
        Cofounder, http://www.knowspam.net enjoy email again!
      Your message has been successfully submitted and would be delivered to recipients shortly.