Examples of StringToken


Examples of cambridge.parser.tokens.StringToken

         return expectingDQHandler(c, col, line);
      } else if (state == State.TAG_EXPECTING_SQ) {
         return expectingSQHandler(c, col, line);
      }

      return new StringToken(line, col, "" + c, getLineNo(), getColumn());
   }
View Full Code Here

Examples of cambridge.parser.tokens.StringToken

            currentTag = builder.substring(0).toLowerCase();
            state = State.TAG;
            return new OpenTagToken(line, col, builder.toString(), getLineNo(), getColumn());
         } else {
            builder.append(c);
            return new StringToken(line, col, builder.toString(), getLineNo(), getColumn());
         }
         // Expression
      } else if (c == '$' && peek(1) == '{') {
         return expressionToken(col, line, false);
      } else if (c == '%' && peek(1) == '{') {
         return expressionToken(col, line, true);
      } else {

         ArrayList<ExtensionPoint> extensionPoints = TemplateParser.getExtensionPoints();
         if (extensionPoints != null) {
            for (ExtensionPoint p : extensionPoints) {
               String opener = p.getTagOpener();
               int length = opener.length();
               if (length > 1 && c == opener.charAt(0) && opener.substring(1).equals(peekString(length - 1))) {
                  nextChar(length - 1);
                  return p.getToken(this, col, line);
               }
            }
         }

         StringBuilder builder = new StringBuilder();
         builder.append(c);

         if (consumeScriptTag && "script".equals(currentTag)) {
            while (true) {
               if (peek(1) == Tokenizer.EOL
                  || ("</script".equalsIgnoreCase(peekString(8)))
                  || (peek(1) == '$' && peek(2) == '{')) {
                  break;
               }
               builder.append(nextChar());
            }
         } else {
            while (true) {
               if (peek(1) == Tokenizer.EOL
                  || (peek(1) == '<' && CharUtil.isName(peek(2)))
                  || (peek(1) == '<' && peek(2) == '!')
                  || (peek(1) == '<' && peek(2) == '/' && CharUtil.isName(peek(3)))
                  || (peek(1) == '$' && peek(2) == '{')
                  || (peek(1) == '%' && peek(2) == '{')
                  ) {
                  break;
               }
               builder.append(nextChar());
            }
         }

         return new StringToken(line, col, builder.toString(), getLineNo(), getColumn());
      }
   }
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

            context.push(token3);
            try {
              if ((Boolean) token3.evaluate(context)) {

                // ${item2.property1}
                buffer.append(new StringToken(Arrays
                    .asList(new String[] { "item2",
                        "property1" }),
                    "item.property1").evaluate(context));

                // INNER_SUFFIX
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

    try {
      while (token1.iterator().hasNext()) {
        context.model.put(token1.getVarName(), token1.advance());
        addSpecialVariables(token1, context.model);

        buffer.append(new StringToken(Arrays.asList(new String[] {
            "item", "property1" }), "item.property1")
            .evaluate(context));

        if (!token1.isLast()) {
          buffer.append(token1.getSeparator());
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

  protected String transformCompiled(TemplateContext context) {
    StringBuilder buffer = new StringBuilder();

    buffer.append("PREFIX");

    buffer.append(new StringToken("address", "address", "NIX", "<h1>",
        "</h1>", "long", "full").evaluate(context));

    buffer.append("SUFFIX");

    return buffer.toString();
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

  @Override
  protected String transformCompiled(TemplateContext context) {
    StringBuilder buffer = new StringBuilder();

    buffer.append(new StringToken("address", "address", null, null, null,
        null, null).evaluate(context));

    return buffer.toString();
  }
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

      PlainTextToken plainTextToken = (PlainTextToken) token;
      tokenStream.consume();
      String text = plainTextToken.getText();
      codeGenerateText(text);
    } else if (token instanceof StringToken) {
      StringToken stringToken = (StringToken) token;
      tokenStream.consume();
      String variableName = stringToken.getExpression();
      addUsedVariableIfNotLocal(variableName);
      codeGenerateStringToken(stringToken);
    } else if (token instanceof ForEachToken) {
      foreach();
    } else if (token instanceof IfToken) {
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

  @Override
  protected String transformCompiled(TemplateContext context) {
    StringBuilder buffer = new StringBuilder();

    buffer.append(new StringToken("address", "address", "NIX", "<h1>",
        "</h1>", "long", "full").evaluate(context));

    return buffer.toString();
  }
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

        "trueCond" }), "bean.trueCond", true);

    context.push(token1);
    try {
      if ((Boolean) token1.evaluate(context)) {
        buffer.append(new StringToken("address", "address", null, null,
            null, null, null).evaluate(context));
      } else {
        buffer.append("NIX");
      }
    } finally {
View Full Code Here

Examples of com.floreysoft.jmte.token.StringToken

        false);

    context.push(token1);
    try {
      if ((Boolean) token1.evaluate(context)) {
        buffer.append(new StringToken("address", "address", null, null,
            null, null, null).evaluate(context));
      } else {
        buffer.append("NIX");
      }
    } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.