Package net.sf.laja.parser.template

Examples of net.sf.laja.parser.template.Statement


        if (genDecl) {
          output = data.getOutput(phase, var1, var2, var2b, null, not1);
          if (statementList != null) {
            NewStatement newStatement = new NewStatement("ElementList", name);
            newStatement.setData(not1, cs, output);
            statementList.add(new Statement(phase, baseDecl, "ElementList", name, newStatement));
          }
        }
        if (genStat) {
          AddStatement addStatement = element.getStatement(phase, name, not2, null, var1, null, null, data);
          if (addStatement != null) {
            if (statementList != null) {
              statementList.add(new Statement(phase, false, name, addStatement));
            }
          } else {
            String elementName = data.addNewVarname(name);
            element.generate(phase, false, true, true, not2, null, elementName, var1, null, null, data, statementList);
            if (statementList != null) {
              statementList.add(new Statement(phase, false, name, new AddStatement(elementName, new RefStatement(elementName))));
            }
          }
        }
      }
    } else {
      if (genDecl) {
        String output = data.getOutput(phase, var1, var2, var2b, null, not);
        if (statementList != null) {
          NewStatement newStatement = new NewStatement("Repeat", name);
          newStatement.setData(not, cs, output, repeats);
          statementList.add(new Statement(phase, baseDecl, "Repeat", name, newStatement));
        }
      }
      if (genStat) {
        String output = data.getOutput(phase, var1, var2, varname, null, this.not);
        boolean decoratable = element.decoratable(phase, this.not, null, output, var1, varname, var2b, data);

        AddStatement addStatement = element.getStatement(phase, name, this.not, null, var1, varname, "", data);

        if (decoratable && addStatement != null) {
          if (statementList != null) {
            statementList.add(new Statement(phase, false, name, addStatement));
          }
        } else if (decoratable && element.isElementList()) {
          element.generate(phase, false, false, true, this.not, null, name, var1, varname, "", data, statementList);
        } else {
          String newName = data.addNewVarname(name);
          output = data.getOutput(phase, var1, varname, "", null, this.not);
          element.generate(phase, false, true, true, false, null, newName, var1, null, "", data, statementList);
          if (statementList != null) {
            RefStatement refStatement = new RefStatement(newName);
            refStatement.setData(this.not, cs, output);
            statementList.add(new Statement(phase, false, name, new AddStatement(newName, refStatement)));
          }
        }
      }
    }
  }
View Full Code Here


    if (genDecl) {
      String output = data.getOutput(phase, var1, var2, var2b, null, not);
      if (statementList != null) {
        NewStatement newStatement = new NewStatement("Complete", name);
        newStatement.setData(not, cs, output);
        statementList.add(new Statement(phase, baseDecl, "Complete", name, newStatement));
      }
    }
  }
View Full Code Here

    if (genDecl) {
      String output = data.getOutput(phase, var1, var2, var2b, null, not);
      NewStatement newStatement = new NewStatement("Chr", name, new ChrData(intval));
      newStatement.setData(not, cs, output);
      if (statementList != null) {
        statementList.add(new Statement(phase, baseDecl, "Chr", name, newStatement));
      }
    }
  }
View Full Code Here

    if (genDecl) {
      output = data.getOutput(phase, var1, var2, var2b, null, not);
      if (statementList != null) {
        NewStatement newStatement = new NewStatement("AndList", name);
        newStatement.setData(not, cs, output);
        statementList.add(new Statement(phase, baseDecl, "AndList", name, newStatement));
      }
    }
    if (genStat) {
      generateStatement(mainAnd, "mainAnd", phase, not, name, var1, data, statementList);
      for (GrammarElement pipeTo : andElements) {
View Full Code Here

  private void generateStatement(GrammarElement pipeElement, String method, int phase, boolean not, String name, String var1, GrammarData data, StatementList statementList) {
    AddStatement addStatement = pipeElement.getStatement(phase, name, not, null, var1, null, null, data);
    if (addStatement != null) {
      addStatement.setMehtod(method);
      if (statementList != null) {
        statementList.add(new Statement(phase, false, name, addStatement));
      }
    } else {
      String elementName = data.addNewVarname(name);
      pipeElement.generate(phase, false, true, true, not, null, elementName, var1, null, null, data, statementList);
      if (statementList != null) {
        addStatement = new AddStatement(elementName, new RefStatement(elementName));
        addStatement.setMehtod(method);
        statementList.add(new Statement(phase, false, name, addStatement));
      }
    }
  }
View Full Code Here

  public void generate(int phase, boolean baseDecl, boolean genDecl, boolean genStat, boolean not, Boolean cs, String name, String var1, String var2, String var2b, GrammarData data, StatementList statementList) {
    if (genDecl) {
      if (statementList != null) {
        NewStatement newStatement = new NewStatement("ElementList", name);
        statementList.add(new Statement(phase, baseDecl, "ElementList", name, newStatement));
      }
    }
    if (genStat) {
      String output = data.getOutput(phase, var1, var2, var2b, elementName, not);
      if (output.length() == 0) {
        output = data.getOutput(phase, var1, refname, var2b, elementName, not);
      }
      if (statementList != null) {
        RefStatement refStatement = new RefStatement(elementName);
        refStatement.setData(not, cs, output);
        AddStatement addStatement = new AddStatement(elementName, refStatement);
        statementList.add(new Statement(phase, false, name, addStatement));
      }
    }
  }
View Full Code Here

      for (String s : statement) {
        comments.add(tab, defname + s);
        defname = "";
      }
      if (statementList != null && comments.hasElements()) {
        statementList.add(new Statement(phase, comments));
      }
      String name = def.getVarName();
      GrammarElement grammarElement = def.getVal();
      grammarElement.generate(phase, false, generateDeclarations, true, false, null, name, name, "*", "*", grammarData, statementList);
    }
View Full Code Here

      String output = data.getOutput(phase, var1, var2, var2b, null, not);
      if (statementList != null) {
        RangeData rangeData = new RangeData(new RangeLimit(range1), new RangeLimit(range2));
        NewStatement newStatement = new NewStatement("Range", name, rangeData);
        newStatement.setData(not, cs, output);
        statementList.add(new Statement(phase, baseDecl, "Range", name, newStatement));
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.laja.parser.template.Statement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.