Use libdparse instead of dscanner

This commit is contained in:
Hackerpilot 2014-06-26 12:44:51 -07:00
parent 4f99f1746b
commit 3aba4955e5
10 changed files with 19 additions and 22 deletions

7
.gitmodules vendored
View File

@ -1,9 +1,6 @@
[submodule "msgpack-d"]
path = msgpack-d
url = https://github.com/msgpack/msgpack-d.git
[submodule "dscanner"]
path = dscanner
url = https://github.com/Hackerpilot/Dscanner.git
[submodule "editors/ktexteditor"]
path = editors/ktexteditor
url = https://github.com/Dav1dde/lumen.git
@ -13,3 +10,7 @@
[submodule "containers"]
path = containers
url = https://github.com/economicmodeling/containers.git
[submodule "libdparse"]
path = libdparse
url = https://github.com/Hackerpilot/libdparse.git
branch = master

View File

@ -205,8 +205,7 @@ auto getTokensBeforeCursor(const(ubyte[]) sourceCode, size_t cursorPosition,
{
LexerConfig config;
config.fileName = "stdin";
auto tokens = byToken(cast(ubyte[]) sourceCode, config, cache);
tokenArray = tokens.array();
tokenArray = getTokensForParser(cast(ubyte[]) sourceCode, config, cache);
auto sortedTokens = assumeSorted(tokenArray);
return sortedTokens.lowerBound(cast(size_t) cursorPosition);
}

View File

@ -23,13 +23,13 @@ dmd\
server.d\
stupidlog.d\
string_interning.d\
dscanner/std/d/ast.d\
dscanner/std/d/entities.d\
dscanner/std/d/lexer.d\
dscanner/std/d/parser.d\
dscanner/std/lexer.d\
dscanner/std/allocator.d\
dscanner/formatter.d\
libdparse/src/std/d/ast.d\
libdparse/src/std/d/entities.d\
libdparse/src/std/d/lexer.d\
libdparse/src/std/d/parser.d\
libdparse/src/std/lexer.d\
libdparse/src/std/allocator.d\
libdparse/src/std/d/formatter.d\
containers/src/memory/allocators.d\
containers/src/memory/appender.d\
containers/src/containers/dynamicarray.d\

@ -1 +1 @@
Subproject commit 6e9aa02eda657fd0a3e820641cbcdecc3dfbd0ce
Subproject commit 2a72525f649850f452f21e7f362f70440f487a61

View File

@ -63,7 +63,8 @@ class SimpleParser : Parser
override Unittest parseUnittest()
{
expect(tok!"unittest");
skipBraces();
if (currentIs(tok!"{"))
skipBraces();
return null;
}

View File

@ -19,7 +19,7 @@
module conversion.first;
import actypes;
import formatter;
import std.d.formatter;
import std.allocator;
import memory.allocators;
import memory.appender;

View File

@ -190,7 +190,7 @@ private:
ACSymbol* processSuffix(ACSymbol* symbol, const TypeSuffix suffix)
{
import formatter;
import std.d.formatter;
if (suffix.star)
return symbol;
if (suffix.array || suffix.type)

@ -1 +0,0 @@
Subproject commit ade1a718aced45992ecd232b1227c8779b9f9603

1
libdparse Submodule

@ -0,0 +1 @@
Subproject commit d9387eb3b275295cd0263bdc273c4b0b63f29f98

View File

@ -137,7 +137,6 @@ struct ModuleCache
ACSymbol*[] symbols;
// try
// {
import core.memory;
import std.stdio;
import std.typecons;
File f = File(cachedLocation);
@ -150,12 +149,9 @@ struct ModuleCache
config.fileName = cachedLocation;
auto parseStringCache = StringCache(StringCache.defaultBucketCount);
auto semanticAllocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024 * 64)));
DynamicArray!(Token, false) tokens;
auto tokenRange = byToken(
const(Token)[] tokens = getTokensForParser(
(source.length >= 3 && source[0 .. 3] == "\xef\xbb\xbf"c) ? source[3 .. $] : source,
config, &parseStringCache);
foreach (t; tokenRange)
tokens.insert(t);
Mallocator.it.deallocate(source);
Module m = parseModuleSimple(tokens[], cachedLocation, semanticAllocator);