Update parser and fix imports for 2.071

This commit is contained in:
Hackerpilot 2016-03-27 22:37:15 -07:00
parent 2145766d89
commit 789019fc86
5 changed files with 9 additions and 7 deletions

View File

@ -4,6 +4,6 @@
"targetType": "executable",
"license": "BSL-1.0",
"dependencies": {
"libdparse": "~>0.5.0"
"libdparse": "~>0.7.0-alpha5"
}
}

@ -1 +1 @@
Subproject commit 5da4616d11efb5b788baadc421f0444d4b4776dd
Subproject commit a03641db1bfa109d860eeb6e2ffdf3c81fd9e712

View File

@ -2,7 +2,7 @@ module dfmt.editorconfig;
import std.regex : ctRegex;
static if (__VERSION__ >= 2067)
import std.traits : FieldNameTuple;
public import std.traits : FieldNameTuple;
else
{
private enum NameOf(alias T) = T.stringof;

View File

@ -7,6 +7,7 @@ module dfmt.formatter;
import dparse.lexer;
import dparse.parser;
import dparse.rollback_allocator;
import dfmt.config;
import dfmt.ast_info;
import dfmt.indentation;
@ -25,8 +26,9 @@ void format(OutputRange)(string source_desc, ubyte[] buffer, OutputRange output,
parseConfig.whitespaceBehavior = WhitespaceBehavior.skip;
StringCache cache = StringCache(StringCache.defaultBucketCount);
ASTInformation astInformation;
RollbackAllocator allocator;
auto parseTokens = getTokensForParser(buffer, parseConfig, &cache);
auto mod = parseModule(parseTokens, source_desc);
auto mod = parseModule(parseTokens, source_desc, &allocator);
auto visitor = new FormatVisitor(&astInformation);
visitor.visit(mod);
astInformation.cleanup();

View File

@ -121,7 +121,7 @@ else
// On Windows, set stdout to binary mode (needed for correct EOL writing)
// See Phobos' stdio.File.rawWrite
{
import std.stdio;
import std.stdio:fileno, _O_BINARY, setmode;
immutable fd = fileno(output.getFP());
setmode(fd, _O_BINARY);
@ -148,7 +148,7 @@ else
else
break;
}
dfmt.formatter.format("stdin", buffer, output.lockingTextWriter(), &config);
format("stdin", buffer, output.lockingTextWriter(), &config);
}
else
{
@ -174,7 +174,7 @@ else
f.rawRead(buffer);
if (inplace)
output = File(path, "wb");
dfmt.formatter.format(path, buffer, output.lockingTextWriter(), &config);
format(path, buffer, output.lockingTextWriter(), &config);
}
}
return 0;