Package com.google.template.soy.soytree

Examples of com.google.template.soy.soytree.SoyFileNode


        "{template name=\".foo\"" + (shouldAutoescape ? "" : " autoescape=\"false\"") + "}\n" +
        testPrintTags + "\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
    SoyFileNode soyFile = soyTree.getChild(0);

    List<PrintNode> printNodes = Lists.newArrayList();
    for (SoyNode child : soyFile.getChild(0).getChildren()) {
      printNodes.add((PrintNode) child);
    }

    return Pair.of(soyTree, printNodes);
  }
View Full Code Here


      throw SoySyntaxException.createWithoutMetaInfo(
          "Error opening Soy file " + filePath + ": " + ioe);
    }

    try {
      SoyFileNode soyFile =
          (new SoyFileParser(soyFileReader, soyFileSupplier.getSoyFileKind(), filePath, nodeIdGen))
              .parseSoyFile();
      if (soyFileSupplier.hasChangedSince(version)) {
        throw SoySyntaxException.createWithoutMetaInfo("Version skew in Soy file " + filePath);
      }
View Full Code Here

    if (basicTemplatesMap.containsKey(templateName)) {
      TemplateNode prevTemplate = basicTemplatesMap.get(templateName);
      // If this duplicate definition is not an explicit Soy V1 override, report error.
      if (!node.isOverride()) {
        SoyFileNode prevTemplateFile = prevTemplate.getNearestAncestor(SoyFileNode.class);
        SoyFileNode currTemplateFile = node.getNearestAncestor(SoyFileNode.class);
        if (currTemplateFile == prevTemplateFile) {
          throw SoySyntaxExceptionUtils.createWithNode(
              "Found two definitions for template name '" + templateName + "', both in the file " +
                  currTemplateFile.getFilePath() + ".",
              node);
        } else {
          String prevTemplateFilePath = prevTemplateFile.getFilePath();
          String currTemplateFilePath = currTemplateFile.getFilePath();
          if (currTemplateFilePath != null && currTemplateFilePath.equals(prevTemplateFilePath)) {
            throw SoySyntaxExceptionUtils.createWithNode(
                "Found two definitions for template name '" + templateName +
                    "' in two different files with the same name " + currTemplateFilePath +
                    " (perhaps the file was accidentally included twice).",
View Full Code Here

    // files by the inputs that go there.
    // This means that the compiled source from multiple input files might be written to a single
    // output file, as is the case when there are multiple inputs, and the output format string
    // contains no wildcards.
    for (int i = 0; i < numFiles; ++i) {
      SoyFileNode inputFile = soyTree.getChild(i);
      String inputFilePath = inputFile.getFilePath();
      String outputFilePath =
          JsSrcUtils.buildFilePath(outputPathFormat, locale, inputFilePath, inputPathsPrefix);

      BaseUtils.ensureDirsExistInPath(outputFilePath);
      outputs.put(outputFilePath, i);
View Full Code Here

        "{template .four}\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(fileContent1, fileContent2);

    SoyFileNode a = soyTree.getChild(0);
    TemplateNode a0 = a.getChild(0);
    TemplateNode a1 = a.getChild(1);
    //TemplateNode a2 = a.getChild(2);
    TemplateNode a3 = a.getChild(3);
    //TemplateNode a4 = a.getChild(4);
    TemplateNode a5 = a.getChild(5);
    TemplateNode a6 = a.getChild(6);
    SoyFileNode b = soyTree.getChild(1);
    //TemplateNode b0 = b.getChild(0);
    TemplateNode b1 = b.getChild(1);
    //TemplateNode b2 = b.getChild(2);
    TemplateNode b3 = b.getChild(3);
    TemplateNode b4 = b.getChild(4);

    IndirectParamsInfo ipi = (new FindIndirectParamsVisitor(null)).exec(a0);
    assertEquals(false, ipi.mayHaveIndirectParamsInExternalCalls);
    assertEquals(false, ipi.mayHaveIndirectParamsInExternalDelCalls);
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.SoyFileNode

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.