Package com.google.caja.parser.js

Examples of com.google.caja.parser.js.StringLiteral


        + "  signature: @signature,"
        + "  invoke: @invoke,"
        + "  unwrap: @unwrap,"
        + "  wrap: @wrap"
        + "})",
        "signature", new StringLiteral(
            FilePosition.UNKNOWN, m.getJsniSignature()),
        "invoke", getInvoke(m),
        "unwrap", getUnwrap(m),
        "wrap", getWrap(m));
  }
View Full Code Here


          } else {
            dynamicValue = (Expression) QuasiBuilder.substV(
                ""
                + "IMPORTS___./*@synthetic*/rewriteUriInAttribute___("
                + "    @value, @tagName, @attribName)",
                "value", new StringLiteral(
                    pos, uri.toString()),
                "tagName", new StringLiteral(
                    pos, attr.src.getOwnerElement().getTagName()),
                "attribName", new StringLiteral(
                    pos, attr.src.getName()));
          }
        }
        break;
      case URI_FRAGMENT:
View Full Code Here

    FilePosition pos = attr.valuePos;
    boolean unspecified = null !=
        attr.src.getUserData(TemplateCompiler.ATTRIBUTE_VALUE_WAS_UNSPECIFIED);
    Expression value = unspecified
        ? new NullLiteral(pos)
        : new StringLiteral(pos, attr.src.getValue());
    return (Expression) QuasiBuilder.substV(""
        + "IMPORTS___./*@synthetic*/rewriteTargetAttribute___("
        + "    @value, @tagName, @attribName)",
        "value", value,
        "tagName", new StringLiteral(pos, attr.src.getOwnerElement().getTagName()),
        "attribName", new StringLiteral(pos, attr.attrInfo.getKey().localName));
  }
View Full Code Here

              (a.getDefaultValue() != null
               && a.getValueCriterion().accept(a.getDefaultValue()))
              ? a.getDefaultValue() : a.getSafeValue();
          emitStaticAttr(
              a,
              new StringLiteral(FilePosition.UNKNOWN, safeValue),
              safe);
          Attr attr = el.getOwnerDocument().createAttributeNS(
              elInfo.getKey().ns.uri, elInfo.getKey().localName);
          el.setAttributeNode(attr);
        }
View Full Code Here

    List<IntegerLiteral> values = Lists.newArrayList();
    for (U e : entries) {
      // Since enum values are public, we don't want Closure compiler
      // to rewrite them, so we need quoted keys.
      String quoted = StringLiteral.toQuotedValue(keyMaker.apply(e));
      keys.add(new StringLiteral(unk, quoted));
      values.add(new IntegerLiteral(unk, valueMaker.apply(e)));
    }
    return new ExpressionStmt(unk,
        (Expression) QuasiBuilder.substV(
            "html4.@i = { @k*: @v* };",
 
View Full Code Here

  protected boolean consumeSpecimens(
      List<ParseTreeNode> specimens, Map<String, ParseTreeNode> bindings) {
    if (specimens.isEmpty()) { return false; }
    ParseTreeNode specimen = specimens.get(0);
    if (!(specimen instanceof StringLiteral)) { return false; }
    StringLiteral lit = (StringLiteral) specimen;
    String ident = lit.getUnquotedValue();
    if (!ParserBase.isJavascriptIdentifier(ident)) { return false; }

    ParseTreeNode existing = bindings.get(bindingName);
    if (existing != null
        && !(existing instanceof Identifier
             && ident.equals(existing.getValue()))) {
      return false;
    } else {
      Identifier identBinding = new Identifier(lit.getFilePosition(), ident);
      bindings.put(bindingName, identBinding);
      specimens.remove(0);
      return true;
    }
  }
View Full Code Here

      ident = ((Reference) binding).getIdentifier();
    } else {
      return false;
    }
    if (ident.getName() == null) { return false; }
    StringLiteral sl = StringLiteral.valueOf(
        ident.getFilePosition(), ident.getName());
    substitutes.add(sl);
    return true;
  }
View Full Code Here

          } else {
            dynamicValue = (Expression) QuasiBuilder.substV(
                ""
                + "IMPORTS___./*@synthetic*/rewriteUriInAttribute___("
                + "    @value, @tagName, @attribName)",
                "value", new StringLiteral(
                    pos, uri.toString()),
                "tagName", new StringLiteral(
                    pos, attr.src.getOwnerElement().getTagName()),
                "attribName", new StringLiteral(
                    pos, attr.src.getName()));
          }
        }
        break;
      case URI_FRAGMENT:
View Full Code Here

    FilePosition pos = attr.valuePos;
    boolean unspecified = null !=
        attr.src.getUserData(TemplateCompiler.ATTRIBUTE_VALUE_WAS_UNSPECIFIED);
    Expression value = unspecified
        ? new NullLiteral(pos)
        : new StringLiteral(pos, attr.src.getValue());
    return (Expression) QuasiBuilder.substV(""
        + "IMPORTS___./*@synthetic*/rewriteTargetAttribute___("
        + "    @value, @tagName, @attribName)",
        "value", value,
        "tagName", new StringLiteral(pos, attr.src.getOwnerElement().getTagName()),
        "attribName", new StringLiteral(pos, attr.attrInfo.getKey().localName));
  }
View Full Code Here

              (a.getDefaultValue() != null
               && a.getValueCriterion().accept(a.getDefaultValue()))
              ? a.getDefaultValue() : a.getSafeValue();
          emitStaticAttr(
              a,
              new StringLiteral(FilePosition.UNKNOWN, safeValue),
              safe);
          Attr attr = el.getOwnerDocument().createAttributeNS(
              elInfo.getKey().ns.uri, elInfo.getKey().localName);
          el.setAttributeNode(attr);
        }
View Full Code Here

TOP

Related Classes of com.google.caja.parser.js.StringLiteral

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.