home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / JScriptExprTerm.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  2.7 KB  |  84 lines

  1. import java.io.PrintStream;
  2.  
  3. public class JScriptExprTerm extends JScriptExprNode {
  4.    private String aTermStrg;
  5.    private JScriptParserTerm aTerm;
  6.  
  7.    public JScriptExprTerm(String var1) {
  8.       this(var1, (JScriptExprNode)null, (JScriptParserTerm)null);
  9.    }
  10.  
  11.    public JScriptExprTerm(String var1, JScriptParserTerm var2) {
  12.       this(var1, (JScriptExprNode)null, var2);
  13.    }
  14.  
  15.    public JScriptExprTerm(JScriptParserTerm var1) {
  16.       this(new String("JScriptParserTerm"), (JScriptExprNode)null, var1);
  17.    }
  18.  
  19.    public JScriptExprTerm(String var1, JScriptExprNode var2, JScriptParserTerm var3) {
  20.       super(var2);
  21.       this.aTermStrg = new String(var1);
  22.       this.aTerm = var3;
  23.    }
  24.  
  25.    public boolean IsConstant() {
  26.       return false;
  27.    }
  28.  
  29.    public boolean IsLValue() {
  30.       return this.aTerm != null;
  31.    }
  32.  
  33.    public void Show(PrintStream var1, int var2) {
  34.       if (this.aTerm != null) {
  35.          var1.print("{term:");
  36.          this.aTerm.Show(var1);
  37.          var1.println("}");
  38.       } else {
  39.          var1.println("{term:" + this.aTermStrg + "}");
  40.       }
  41.    }
  42.  
  43.    protected void DoGenerateCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JScriptParserException, JSbxException {
  44.       if (this.aTerm != null) {
  45.          if (var1.IsExpressionInForInStatement() && !((JScriptExprNode)this).HasParent() && this.aTerm.GetSubTermCount() == 1 && this.aTerm.GetSubTerm(0).GetNumberOfCallOrIndex() == 0) {
  46.             var1.AddCode(new JSP_CreateGlobal(this.aTerm.GetSubTerm(0).aIdentifier.aIdentifierName, -1));
  47.          }
  48.  
  49.          this.aTerm.GenerateRValueCode(var1);
  50.       } else {
  51.          CreateOldCodeException();
  52.       }
  53.    }
  54.  
  55.    protected void DoGenerateLValueCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JScriptParserException, JSbxException {
  56.       if (this.aTerm != null) {
  57.          this.aTerm.GenerateLValueCode(var1);
  58.       } else {
  59.          CreateOldCodeException();
  60.       }
  61.    }
  62.  
  63.    protected void DoPreGenerateCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JScriptParserException, JSbxException {
  64.       if (this.aTerm != null) {
  65.          this.aTerm.GeneratePreCode(var1);
  66.       } else {
  67.          CreateOldCodeException();
  68.       }
  69.    }
  70.  
  71.    protected void DoPostGenerateCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JScriptParserException, JSbxException {
  72.       if (this.aTerm != null) {
  73.          this.aTerm.GeneratePostCode(var1);
  74.       } else {
  75.          CreateOldCodeException();
  76.       }
  77.    }
  78.  
  79.    private static final void CreateOldCodeException() throws JScriptExprParserException {
  80.       System.out.println("WARNING: TERM has no JScirptParserTerm !!!");
  81.       throw new JScriptExprParserException(42040, "alter Code aufgerufen !!!");
  82.    }
  83. }
  84.