Package com.google.caja.parser.js

Examples of com.google.caja.parser.js.Block.appendChild()


            return L_TYPE_MAP.get(f);
          }
        })
    );

    definitions.appendChild(mapFromEnum(
        ltypes.entrySet(),
        "LOADERTYPES",
        new Function<Entry<AttribKey, LoaderType>, String>() {
          public String apply(Entry<AttribKey, LoaderType> f) {
            return f.getKey().toString();
View Full Code Here


    if (currentBlock == null) { return; }

    Block block = new Block(FilePosition.UNKNOWN, currentBlock);
    if (currentBlockTranslated) {
      Block wrapper = new Block();
      wrapper.appendChild(new TranslatedCode(block));
      js.add(new SafeJsChunk(currentSource, wrapper));
    } else {
      js.add(new SafeJsChunk(currentSource, block));
    }
    currentBlock = null;
View Full Code Here

    assertTrue(n.children().get(0).isImmutable());
    assertTrue(n.children().get(0).children().get(0).isImmutable());
    assertTrue(n.children().get(1).isImmutable());
    assertTrue(n.children().get(1).children().get(0).isImmutable());
    try {
      n.appendChild(new Noop(FilePosition.UNKNOWN));
      fail();
    } catch (UnsupportedOperationException e) { /* OK */ }
    try {
      n.setComments(Arrays.asList(
          Token.instance("test", JsTokenType.COMMENT, FilePosition.UNKNOWN)));
View Full Code Here

    Map<ElKey, EnumSet<EFlag>> eflags = elementFlags(schema);
    Map<AttribKey, UriEffect> uriEffects = uriEffects(schema);
    Map<AttribKey, LoaderType> ltypes = loaderTypes(schema);

    Block definitions = new Block();
    definitions.appendChild(QuasiBuilder.substV("var html4 = {};"));

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(HTML.Attribute.Type.class),
        "atype",
        new Function<HTML.Attribute.Type, String>() {
View Full Code Here

    Map<AttribKey, LoaderType> ltypes = loaderTypes(schema);

    Block definitions = new Block();
    definitions.appendChild(QuasiBuilder.substV("var html4 = {};"));

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(HTML.Attribute.Type.class),
        "atype",
        new Function<HTML.Attribute.Type, String>() {
          public String apply(HTML.Attribute.Type f) {
            return f.name();
View Full Code Here

            || SCRIPT_SRC.equals(key)) {
          keys.add(StringLiteral.valueOf(unk, key.toString()));
          values.add(new IntegerLiteral(unk, A_TYPE_MAP.get(e.getValue())));
        }
      }
      definitions.appendChild(new ExpressionStmt(unk, (Expression)
          QuasiBuilder.substV(
              "html4.ATTRIBS = { @k*: @v* };",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }
View Full Code Here

              "html4.ATTRIBS = { @k*: @v* };",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(EFlag.class),
        "eflags",
        new Function<EFlag, String>() {
          public String apply(EFlag f) {
            return f.name();
View Full Code Here

        int value = 0;
        for (EFlag f : e.getValue()) { value |= f.bitMask; }
        keys.add(StringLiteral.valueOf(unk, key.toString()));
        values.add(new IntegerLiteral(unk, value));
      }
      definitions.appendChild(new ExpressionStmt(unk, (Expression)
          QuasiBuilder.substV(
              "html4.ELEMENTS = { @k*: @v* };",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }
View Full Code Here

              "html4.ELEMENTS = { @k*: @v* };",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(UriEffect.class),
        "ueffects",
        new Function<UriEffect, String>() {
          public String apply(UriEffect f) {
            return f.name();
View Full Code Here

            return A_UEFFECT_MAP.get(f);
          }
        })
    );

    definitions.appendChild(mapFromEnum(
        uriEffects.entrySet(),
        "URIEFFECTS",
        new Function<Entry<AttribKey, UriEffect>, String>() {
          public String apply(Entry<AttribKey, UriEffect> f) {
            return f.getKey().toString();
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.