Package com.lastcalc

Examples of com.lastcalc.SequentialParser


   
  }
 
  public void hookedUpProperly(){
   
    final SequentialParser sp=SequentialParser.create();
   
    TokenList pr=sp.parseNext(TokenList.createD("6","!"));
   
    Assert.assertEquals(1,pr.size());
    Assert.assertEquals(LargeInteger.valueOf(720), pr.get(0));
   
  }
View Full Code Here


        for (final Node n : Help.getHelpDoc().body().childNodes()) {
          helpDiv.appendChild(n.clone());
        }

        int lineNo = 1;
        final SequentialParser sp = SequentialParser.create();
                Element worksheetElement = doc.body().select("#worksheet").first();
        for (final Line qa : worksheet.qaPairs) {
          sp.processNextAnswer(qa.answer);
          final Element lineEl = worksheetElement.appendElement("div").addClass("line")
              .attr("id", "line" + lineNo);
          if (lineNo == 1) {
            lineEl.addClass("firstLine");
          }
         
          final Element lineNumber=lineEl.appendElement("div").attr("class","lineNumberMarker");
          lineNumber.text(lineNo+".");
         
          final Element question = lineEl.appendElement("div").attr("class", "question")
              .attr("contentEditable", "true");
          question.text(qa.question);
          final TokenList strippedAnswer = sp.stripUDF(qa.answer);
          final AnswerType aType = WorksheetServlet.getAnswerType(strippedAnswer);
          if (aType.equals(AnswerType.NORMAL)) {
            lineEl.appendElement("div").attr("class", "equals").text("=");
            lineEl.appendElement("div").attr("class", "answer")
            .html(Renderers.toHtml("/", strippedAnswer).toString());
          } else {
            lineEl.appendElement("div").attr("class", "equals")
            .html("<span style=\"font-size:10pt;\">&#10003</span>");
            lineEl.appendElement("div").attr("class", "answer");
          }
          lineNo++;
        }
        doc.body().attr("data-variables", Misc.gson.toJson(sp.getUserDefinedKeywordMap()));
        final Element lineEl = worksheetElement.appendElement("div").addClass("line").attr("id", "line" + lineNo);
        if (lineNo == 1) {
          lineEl.addClass("firstLine");
        }
        final Element lineNumber=lineEl.appendElement("div").attr("class","lineNumberMarker");
View Full Code Here

TOP

Related Classes of com.lastcalc.SequentialParser

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.