Package com.google.template.soy.soyparse

Examples of com.google.template.soy.soyparse.SoyFileSetParser


    List<SoyFileSupplier> soyFileSuppliers = Lists.newArrayList();
    for (int i = 0; i < inputs.length; ++i) {
      soyFileSuppliers.add(SoyFileSupplier.Factory.create(
          inputs[i], SoyFileKind.SRC, inputs.length == 1 ? "no-path" : "no-path-" + i));
    }
    SoyFileSetNode soyTree = new SoyFileSetParser(soyFileSuppliers)
        .setDoRunInitialParsingPasses(true)
        .setDoRunCheckingPasses(true)
        .setDoEnforceSyntaxVersionV2(false)
        .parse();
View Full Code Here


   * @throws SoySyntaxException If a syntax error is found.
   */
  public ImmutableMap<String, String> generateParseInfo(
      String javaPackage, String javaClassNameSource) throws SoySyntaxException {

    SoyFileSetNode soyTree = (new SoyFileSetParser(soyFileSuppliers)).parse();

    return (new GenerateParseInfoVisitor(javaPackage, javaClassNameSource)).exec(soyTree);
  }
View Full Code Here

   * @throws SoySyntaxException If a syntax error is found.
   */
  public SoyMsgBundle extractMsgs() throws SoySyntaxException {

    SoyFileSetNode soyTree =
        (new SoyFileSetParser(soyFileSuppliers))
            .setDoEnforceSyntaxVersionV2(false).setDoCheckOverrides(false).parse();

    return (new ExtractMsgsVisitor()).exec(soyTree);
  }
View Full Code Here

    // Defensive copy of options. (Doesn't matter now, but might forget later when it matters.)
    tofuOptions = tofuOptions.clone();

    // TODO: Allow binding a SoyTofu instance to volatile inputs.
    SoyFileSetNode soyTree = (new SoyFileSetParser(soyFileSuppliers)).parse();
    runMiddleendPasses(soyTree, true);

    // If allowExternalCalls is not explicitly set, then disallow by default for Tofu backend.
    if (generalOptions.allowExternalCalls() == null) {
      // TODO: Enable this check when all Google internal projects are compliant.
View Full Code Here

       * template name to SoyRuntime map.
       */
      private void compile() throws SoySyntaxException {

        Pair<SoyFileSetNode, List<SoyFileSupplier.Version>> soyTreeAndVersions =
            (new SoyFileSetParser(soyFileSuppliers)).parseWithVersions();
        SoyFileSetNode soyTree = soyTreeAndVersions.first;
        runMiddleendPasses(soyTree, true);

        ImmutableMap<String, SoyTemplateRuntime> result = SoyToJavaDynamicCompiler.compile(
            bundleName, compileFileSetToJavaSrc(soyTree, copyOfOptions, msgBundle));
View Full Code Here

   * @return Java source code in one big ugly blob. Can be put inside any class without needing
   *     additional imports because all class names in the generated code are fully qualified.
   */
  public String compileToJavaSrc(SoyJavaSrcOptions javaSrcOptions, SoyMsgBundle msgBundle) {

    SoyFileSetNode soyTree = (new SoyFileSetParser(soyFileSuppliers)).parse();
    runMiddleendPasses(soyTree, true);

    return compileFileSetToJavaSrc(soyTree, javaSrcOptions, msgBundle);
  }
View Full Code Here

   */
  public List<String> compileToJsSrc(SoyJsSrcOptions jsSrcOptions, @Nullable SoyMsgBundle msgBundle)
      throws SoySyntaxException {

    boolean doEnforceSyntaxVersionV2 = ! jsSrcOptions.shouldAllowDeprecatedSyntax();
    SoyFileSetNode soyTree = (new SoyFileSetParser(soyFileSuppliers))
        .setDoEnforceSyntaxVersionV2(doEnforceSyntaxVersionV2).parse();
    runMiddleendPasses(soyTree, doEnforceSyntaxVersionV2);

    return jsSrcMainProvider.get().genJsSrc(soyTree, jsSrcOptions, msgBundle);
  }
View Full Code Here

      String outputPathFormat, String inputFilePathPrefix, SoyJsSrcOptions jsSrcOptions,
      List<String> locales, @Nullable String messageFilePathFormat)
      throws SoySyntaxException, IOException {

    boolean doEnforceSyntaxVersionV2 = ! jsSrcOptions.shouldAllowDeprecatedSyntax();
    SoyFileSetNode soyTree = (new SoyFileSetParser(soyFileSuppliers))
        .setDoEnforceSyntaxVersionV2(doEnforceSyntaxVersionV2).parse();
    runMiddleendPasses(soyTree, doEnforceSyntaxVersionV2);

    if (locales.size() == 0) {
      // Not generating localized JS.
View Full Code Here

      soyFileSuppliers.add(SoyFileSupplier.Factory.create(
          soyFileContent, SoyFileKind.SRC, "no-path"));
    }

    SoyFileSetNode soyTree =
        (new SoyFileSetParser(soyFileSuppliers))
            .setDoRunInitialParsingPasses(doRunInitialParsingPasses)
            .setDoRunCheckingPasses(false)
            .parse();
    return soyTree;
  }
View Full Code Here

  public void testGenerateExtractedMsgsFile() throws Exception {

    URL testSoyFile = Resources.getResource(XliffMsgPluginTest.class, "test_data/test-v2.soy");
    SoyFileSetNode soyTree =
        (new SoyFileSetParser(SoyFileSupplier.Factory.create(testSoyFile, SoyFileKind.SRC)))
            .parse();
    SoyMsgBundle msgBundle = (new ExtractMsgsVisitor()).exec(soyTree);

    XliffMsgPlugin msgPlugin = new XliffMsgPlugin();
View Full Code Here

TOP

Related Classes of com.google.template.soy.soyparse.SoyFileSetParser

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.