This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dmd.permissivevisitor; | |
import dmd.transitivevisitor; | |
import dmd.tokens; | |
import dmd.root.outbuffer; | |
import core.stdc.stdio; | |
import std.stdio; | |
import std.file; | |
import std.path : buildPath, dirName; | |
import dmd.errors; | |
import dmd.parse; | |
import dmd.astbase; | |
import dmd.id; | |
import dmd.globals; | |
import dmd.identifier; | |
import core.memory; | |
extern(C++) class ImportVisitor(AST) : ParseTimeTransitiveVisitor!AST | |
{ | |
alias visit = ParseTimeTransitiveVisitor!AST.visit; | |
override void visit(AST.Import imp) | |
{ | |
} | |
} | |
void main() | |
{ | |
GC.disable(); | |
string path = __FILE_FULL_PATH__.dirName(); | |
string regex = "*.d"; | |
auto dFiles = dirEntries(path, regex, SpanMode.depth); | |
foreach (f; dFiles) | |
{ | |
string fn = f.name; | |
//writeln("Processing ", fn); | |
Id.initialize(); | |
global._init(); | |
global.params.isWindows = true; | |
global.params.is64bit = (size_t.sizeof == 8); | |
global.params.useUnitTests = true; | |
ASTBase.Type._init(); | |
auto id = Identifier.idPool(fn); | |
auto m = new ASTBase.Module(&(fn.dup)[0], id, false, false); | |
auto input = readText(fn); | |
//writeln("Started parsing..."); | |
scope diagnosticReporter = new StderrDiagnosticReporter(global.params.useDeprecated); | |
scope p = new Parser!ASTBase(m, input, false, diagnosticReporter); | |
p.nextToken(); | |
m.members = p.parseModule(); | |
//writeln("Finished parsing. Starting transitive visitor"); | |
scope vis = new ImportVisitor!ASTBase(); | |
m.accept(vis); | |
//writeln("Finished!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dmd.permissivevisitor; | |
import dmd.transitivevisitor; | |
import dmd.tokens; | |
import dmd.root.outbuffer; | |
import core.stdc.stdio; | |
import std.stdio; | |
import std.file; | |
import std.path : buildPath, dirName; | |
import dmd.errors; | |
import dmd.parse; | |
import dmd.astbase; | |
import dmd.id; | |
import dmd.globals; | |
import dmd.identifier; | |
import core.memory; | |
extern(C++) class ImportVisitor(AST) : ParseTimeTransitiveVisitor!AST | |
{ | |
alias visit = ParseTimeTransitiveVisitor!AST.visit; | |
override void visit(AST.Import imp) | |
{ | |
} | |
} | |
void main() | |
{ | |
GC.disable(); | |
string path = __FILE_FULL_PATH__.dirName(); | |
string regex = "*.d"; | |
auto dFiles = dirEntries(path, regex, SpanMode.depth); | |
foreach (f; dFiles) | |
{ | |
string fn = f.name; | |
//writeln("Processing ", fn); | |
initDMD(); | |
global.params.isWindows = true; | |
global.params.is64bit = (size_t.sizeof == 8); | |
global.params.useUnitTests = true; | |
ASTBase.Type._init(); | |
auto id = Identifier.idPool(fn); | |
auto m = new ASTBase.Module(&(fn.dup)[0], id, false, false); | |
auto input = readText(fn); | |
//writeln("Started parsing..."); | |
scope diagnosticReporter = new StderrDiagnosticReporter(global.params.useDeprecated); | |
scope p = new Parser!ASTBase(m, input, false, diagnosticReporter); | |
p.nextToken(); | |
m.members = p.parseModule(); | |
//writeln("Finished parsing. Starting transitive visitor"); | |
scope vis = new ImportVisitor!ASTBase(); | |
m.accept(vis); | |
//writeln("Finished!"); | |
deinitializeDMD(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment