dastworx, stylefixes

This commit is contained in:
Basile Burg 2018-04-15 18:14:39 +02:00
parent 5aa6d32e7e
commit 41a4749b60
2 changed files with 103 additions and 109 deletions

View File

@ -397,7 +397,5 @@ T parseAndVisit(T : ASTVisitor)(const(char)[] source)
* This function prevents that. * This function prevents that.
*/ */
void ignoreErrors(string, size_t, size_t, string, bool) void ignoreErrors(string, size_t, size_t, string, bool)
{ {}
// dont pollute output
}

View File

@ -31,7 +31,7 @@ struct Launcher
__gshared @Argument("-l") int caretLine; __gshared @Argument("-l") int caretLine;
__gshared @Argument("-o") bool option1; __gshared @Argument("-o") bool option1;
__gshared static Appender!(ubyte[]) source; __gshared Appender!(ubyte[]) source;
__gshared string[] files; __gshared string[] files;
// -o : deep visit the symbols // -o : deep visit the symbols
@ -55,25 +55,21 @@ struct Launcher
{ {
mixin(logCall); mixin(logCall);
static struct ErrorHandler Appender!(AstErrors) errors;
{
static Appender!(AstErrors) _errors;
void handleErrors(string fname, size_t line, size_t col, string message, bool err) void handleErrors(string fname, size_t line, size_t col, string message, bool err)
{ {
_errors ~= construct!(AstError)(cast(ErrorType) err, message, line, col); errors ~= construct!(AstError)(cast(ErrorType) err, message, line, col);
}
} }
ErrorHandler eh;
RollbackAllocator alloc; RollbackAllocator alloc;
StringCache cache = StringCache(StringCache.defaultBucketCount); StringCache cache = StringCache(StringCache.defaultBucketCount);
LexerConfig config = LexerConfig("", StringBehavior.source); LexerConfig config = LexerConfig("", StringBehavior.source);
source.data source.data
.getTokensForParser(config, &cache) .getTokensForParser(config, &cache)
.parseModule("", &alloc, &eh.handleErrors) .parseModule("", &alloc, &handleErrors)
.listSymbols(eh._errors.data, deepSymList); .listSymbols(errors.data, deepSymList);
} }
/// Writes the list of todo comments /// Writes the list of todo comments