Examples of GoloOffsetParser


Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

        }
      }
    } else if (file.getName().endsWith(".golo")) {
      System.out.println(">>> AST for: " + goloFile);
      try (FileInputStream in = new FileInputStream(goloFile)) {
        ASTCompilationUnit ast = compiler.parse(goloFile, new GoloOffsetParser(in));
        ast.dump("% ");
        System.out.println();
      } catch (IOException e) {
        System.out.println("[error] " + goloFile + " does not exist or could not be opened.");
      }
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

        }
      }
    } else if (file.getName().endsWith(".golo")) {
      System.out.println(">>> IR for: " + file);
      try (FileInputStream in = new FileInputStream(goloFile)) {
        ASTCompilationUnit ast = compiler.parse(goloFile, new GoloOffsetParser(in));
        GoloModule module = compiler.check(ast);
        dumper.visitModule(module);
        System.out.println();
      } catch (IOException e) {
        System.out.println("[error] " + goloFile + " does not exist or could not be opened.");
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

          loadGoloFileCompilationUnit(directoryFile.getAbsolutePath(), units);
        }
      }
    } else if (file.getName().endsWith(".golo")) {
      try (FileInputStream in = new FileInputStream(goloFile)) {
        units.put(goloFile, new GoloOffsetParser(in).CompilationUnit());
      } catch (IOException e) {
        System.out.println("[error] " + goloFile + " does not exist or could not be opened.");
      } catch (ParseException e) {
        System.out.println("[error] " + goloFile + " has syntax errors: " + e.getMessage());
      }
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

   *
   * @param sourceReader the reader.
   * @return the parser for <code>sourceReader</code>.
   */
  protected GoloParser createGoloParser(Reader sourceReader) {
    return new GoloOffsetParser(sourceReader);
  }
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

    }
  }

  @Test
  public void markdown_processor() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();

    MarkdownProcessor processor = new MarkdownProcessor();
    String result = processor.render(compilationUnit);
    assertThat(result, containsString("# Documentation for `Documented`"));
    assertThat(result, containsString("### `with_doc(a, b)`"));
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

    assertThat(contents, containsString("* [Documented](Documented.markdown"));
  }

  @Test
  public void html_processor() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();

    HtmlProcessor processor = new HtmlProcessor();
    String result = processor.render(compilationUnit);
    assertThat(result, containsString("<h1>Documentation for Documented</h1>"));
    assertThat(result, containsString("<h3 id=\"with_doc_a_b\">with_doc(a, b)"));
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

    assertThat(contents, containsString("<a href='Documented.html'>Documented</a>"));
  }

  @Test
  public void ctags_processor() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();

    CtagsProcessor processor = new CtagsProcessor();
    String result = processor.render(compilationUnit);
    assertThat(result, containsString("Documented\tfile\t/^module[:blank:]+Documented$/;\"\tp\tline:1\tlanguage:golo"));
    assertThat(result, containsString("Point\tfile\t/^struct[:blank:]+Point[:blank:]+=/;\"\ts\tline:59\tlanguage:golo"));
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

  public static final String SRC = "src/test/resources/for-parsing-and-compilation/";

  @Test
  public void check() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();
    ModuleDocumentation doc = new ModuleDocumentation(compilationUnit);

    assertThat(doc.moduleName(), is("Documented"));
    assertThat(doc.moduleDocumentation(), containsString("    let foo = \"bar\""));
    assertThat(doc.moduleDefLine(), is(1)); //Module doc is part of the module node
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser

    return TestUtils.goloFilesIn("src/test/resources/for-parsing-and-compilation");
  }

  @Test(dataProvider = "golo-files")
  public void convert_then_apply_visitors(File goloFile) throws FileNotFoundException, ParseException {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(goloFile));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();
    ParseTreeToGoloIrVisitor visitor = new ParseTreeToGoloIrVisitor();

    GoloModule module = null;
    try {
      module = visitor.transform(compilationUnit);
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.