Package org.eclipse.dltk.compiler.env

Examples of org.eclipse.dltk.compiler.env.ModuleSource


     * if an ASTVisitor implementation is created for this, just override getFoldingVisitor() and
     * remove this method
     */
    ISourceParser pp = null;
    pp = DLTKLanguageManager.getSourceParser(RutaNature.NATURE_ID);
    ModuleDeclaration md = (ModuleDeclaration) pp.parse(new ModuleSource(code), null);
    List statements = md.getStatements();
    if (statements == null) {
      return new CodeBlock[0];
    }

View Full Code Here


    IModelElement el = this.editor.getInputModelElement();
    if (el != null && el instanceof ISourceModule) {
      md = SourceParserUtil.getModuleDeclaration((ISourceModule) el, null);
    }
    if (md == null) {
      md = (ModuleDeclaration) pp.parse(new ModuleSource(contents), null);
    }
    if (md == null) {
      return new PairBlock[0];
    }
    final List result = new ArrayList();
View Full Code Here

 
  @Test
  public void testBasic() throws Exception { testBasic$(); }
  public void testBasic$() throws Exception {
    String relativePath = "relative/path/foo.d";
    ModuleSource moduleSource = new ModuleSource(relativePath, "module blah;");
    Path filePath = DToolClient.getPathHandleForModuleSource(moduleSource);
   
    ClientModuleParseCache clientModuleCache = client.getClientModuleCache();
    assertEquals(clientModuleCache.getParsedModuleOrNull(filePath, moduleSource).module.getName(), "blah");
    assertEquals(clientModuleCache.getExistingParsedModuleNode(filePath).getName(), "blah");
   
    testCodeCompletion(moduleSource, 0,
      "blah");
    testCodeCompletion(new ModuleSource(relativePath, "module xpto;"), 0,
      "xpto");
    assertTrue(client.getServerSemanticManager().getParseCache().getEntry(MiscUtil.createPath(relativePath))
      .isWorkingCopy() == false);
   
    Path path = DToolTestResources.getTestResourcePath().resolve("dummy__non_existant.d");
    assertTrue(path.isAbsolute());
    testCodeCompletion(new ModuleSource(path.toString(), "module blah;"), 0,
        "blah");
   
    // Error case
    try {
      client.doCodeCompletion((Path) null, 0, null);
View Full Code Here

     * if an ASTVisitor implementation is created for this, just override getFoldingVisitor() and
     * remove this method
     */
    ISourceParser pp = null;
    pp = DLTKLanguageManager.getSourceParser(RutaNature.NATURE_ID);
    ModuleDeclaration md = (ModuleDeclaration) pp.parse(new ModuleSource(code), null);
    List statements = md.getStatements();
    if (statements == null) {
      return new CodeBlock[0];
    }

View Full Code Here

    IModelElement el = this.editor.getInputModelElement();
    if (el != null && el instanceof ISourceModule) {
      md = SourceParserUtil.getModuleDeclaration((ISourceModule) el, null);
    }
    if (md == null) {
      md = (ModuleDeclaration) pp.parse(new ModuleSource(contents), null);
    }
    if (md == null) {
      return new PairBlock[0];
    }
    final List result = new ArrayList();
View Full Code Here

    throws Exception
  {
    InputStream in = file.getContents();
    try {
      String path = file.getLocation().toOSString();
      return new ModuleSource(path, IOUtils.toString(in));
    }finally{
      IOUtils.closeQuietly(in);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.compiler.env.ModuleSource

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.