diff --git a/makefile b/makefile
index eb1cf60..779cee0 100644
--- a/makefile
+++ b/makefile
@@ -10,7 +10,8 @@ SRC := \
$(shell find containers/src -name "*.d")\
$(shell find dsymbol/src -name "*.d")\
$(shell find inifiled/source/ -name "*.d")\
- $(shell find libdparse/src/std/ -name "*.d")\
+ $(shell find libdparse/src/std/experimental/ -name "*.d")\
+ $(shell find libdparse/src/dparse/ -name "*.d")\
$(shell find src/ -name "*.d")
INCLUDE_PATHS = \
-Iinifiled/source -Isrc\
diff --git a/src/analysis/asm_style.d b/src/analysis/asm_style.d
index 6b2344c..3bf0de8 100644
--- a/src/analysis/asm_style.d
+++ b/src/analysis/asm_style.d
@@ -6,8 +6,8 @@
module analysis.asm_style;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/base.d b/src/analysis/base.d
index adfd3f2..3cfc4c9 100644
--- a/src/analysis/base.d
+++ b/src/analysis/base.d
@@ -2,7 +2,7 @@ module analysis.base;
import std.container;
import std.string;
-import std.d.ast;
+import dparse.ast;
import std.array;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/builtin_property_names.d b/src/analysis/builtin_property_names.d
index 62a14a3..ad09432 100644
--- a/src/analysis/builtin_property_names.d
+++ b/src/analysis/builtin_property_names.d
@@ -7,8 +7,8 @@ module analysis.builtin_property_names;
import std.stdio;
import std.regex;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_;
diff --git a/src/analysis/comma_expression.d b/src/analysis/comma_expression.d
index 5ce999d..d4f241d 100644
--- a/src/analysis/comma_expression.d
+++ b/src/analysis/comma_expression.d
@@ -5,8 +5,8 @@
module analysis.comma_expression;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import dsymbol.scope_;
diff --git a/src/analysis/constructors.d b/src/analysis/constructors.d
index 724565e..6431f53 100644
--- a/src/analysis/constructors.d
+++ b/src/analysis/constructors.d
@@ -1,7 +1,7 @@
module analysis.constructors;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import std.stdio;
import analysis.base;
import analysis.helpers;
diff --git a/src/analysis/del.d b/src/analysis/del.d
index be14ad5..a6bf294 100644
--- a/src/analysis/del.d
+++ b/src/analysis/del.d
@@ -6,8 +6,8 @@
module analysis.del;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_;
diff --git a/src/analysis/duplicate_attribute.d b/src/analysis/duplicate_attribute.d
index 8beab67..c2d1e01 100644
--- a/src/analysis/duplicate_attribute.d
+++ b/src/analysis/duplicate_attribute.d
@@ -7,8 +7,8 @@ module analysis.duplicate_attribute;
import std.stdio;
import std.string;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/enumarrayliteral.d b/src/analysis/enumarrayliteral.d
index 9dd4e82..0b7a2bc 100644
--- a/src/analysis/enumarrayliteral.d
+++ b/src/analysis/enumarrayliteral.d
@@ -5,8 +5,8 @@
module analysis.enumarrayliteral;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import std.algorithm : canFind;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/fish.d b/src/analysis/fish.d
index 6453b06..e047970 100644
--- a/src/analysis/fish.d
+++ b/src/analysis/fish.d
@@ -6,8 +6,8 @@
module analysis.fish;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/function_attributes.d b/src/analysis/function_attributes.d
index 6da57c0..70d2b11 100644
--- a/src/analysis/function_attributes.d
+++ b/src/analysis/function_attributes.d
@@ -6,8 +6,8 @@
module analysis.function_attributes;
import analysis.base;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import std.stdio;
import dsymbol.scope_;
diff --git a/src/analysis/helpers.d b/src/analysis/helpers.d
index 7368d8a..75626ba 100644
--- a/src/analysis/helpers.d
+++ b/src/analysis/helpers.d
@@ -9,7 +9,7 @@ import std.string;
import std.traits;
import std.stdio;
-import std.d.ast;
+import dparse.ast;
import analysis.config;
import analysis.run;
import analysis.base;
@@ -53,7 +53,7 @@ S after(S)(S value, S separator)
void assertAnalyzerWarnings(string code, const StaticAnalysisConfig config, string file=__FILE__, size_t line=__LINE__)
{
import analysis.run : ParseAllocator, parseModule;
- import std.d.lexer : StringCache;
+ import dparse.lexer : StringCache;
StringCache cache = StringCache(StringCache.defaultBucketCount);
ParseAllocator p = new ParseAllocator;
diff --git a/src/analysis/if_statements.d b/src/analysis/if_statements.d
index 8316ea1..c883de3 100644
--- a/src/analysis/if_statements.d
+++ b/src/analysis/if_statements.d
@@ -4,9 +4,9 @@
// http://www.boost.org/LICENSE_1_0.txt)
module analysis.if_statements;
-import std.d.ast;
-import std.d.lexer;
-import std.d.formatter;
+import dparse.ast;
+import dparse.lexer;
+import dparse.formatter;
import analysis.base;
import dsymbol.scope_ : Scope;
@@ -78,7 +78,7 @@ private:
if (expression is null)
return;
auto app = appender!string();
- std.d.formatter.format(app, expression);
+ dparse.formatter.format(app, expression);
immutable size_t prevLocation = alreadyChecked(app.data, line, column);
if (prevLocation != size_t.max)
{
diff --git a/src/analysis/ifelsesame.d b/src/analysis/ifelsesame.d
index 2940133..89daa43 100644
--- a/src/analysis/ifelsesame.d
+++ b/src/analysis/ifelsesame.d
@@ -6,8 +6,8 @@
module analysis.ifelsesame;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/label_var_same_name_check.d b/src/analysis/label_var_same_name_check.d
index 8865c4a..db6bfd5 100644
--- a/src/analysis/label_var_same_name_check.d
+++ b/src/analysis/label_var_same_name_check.d
@@ -4,8 +4,8 @@
module analysis.label_var_same_name_check;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
diff --git a/src/analysis/length_subtraction.d b/src/analysis/length_subtraction.d
index f557bca..49cb777 100644
--- a/src/analysis/length_subtraction.d
+++ b/src/analysis/length_subtraction.d
@@ -7,8 +7,8 @@ module analysis.length_subtraction;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_;
diff --git a/src/analysis/local_imports.d b/src/analysis/local_imports.d
index 9670411..e1533cc 100644
--- a/src/analysis/local_imports.d
+++ b/src/analysis/local_imports.d
@@ -6,8 +6,8 @@
module analysis.local_imports;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_;
diff --git a/src/analysis/logic_precedence.d b/src/analysis/logic_precedence.d
index 15948dc..4ff9b66 100644
--- a/src/analysis/logic_precedence.d
+++ b/src/analysis/logic_precedence.d
@@ -6,8 +6,8 @@
module analysis.logic_precedence;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_;
diff --git a/src/analysis/mismatched_args.d b/src/analysis/mismatched_args.d
index 965d25c..4d4094d 100644
--- a/src/analysis/mismatched_args.d
+++ b/src/analysis/mismatched_args.d
@@ -3,8 +3,8 @@ module analysis.mismatched_args;
import analysis.base : BaseAnalyzer;
import dsymbol.scope_;
import dsymbol.symbol;
-import std.d.ast;
-import std.d.lexer : tok;
+import dparse.ast;
+import dparse.lexer : tok;
import dsymbol.builtin.names;
/// Checks for mismatched argument and parameter names
diff --git a/src/analysis/numbers.d b/src/analysis/numbers.d
index 9cb1041..3d19cee 100644
--- a/src/analysis/numbers.d
+++ b/src/analysis/numbers.d
@@ -7,8 +7,8 @@ module analysis.numbers;
import std.stdio;
import std.regex;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/objectconst.d b/src/analysis/objectconst.d
index 0e7778c..2ca83d7 100644
--- a/src/analysis/objectconst.d
+++ b/src/analysis/objectconst.d
@@ -7,8 +7,8 @@ module analysis.objectconst;
import std.stdio;
import std.regex;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/opequals_without_tohash.d b/src/analysis/opequals_without_tohash.d
index e9fd138..168f211 100644
--- a/src/analysis/opequals_without_tohash.d
+++ b/src/analysis/opequals_without_tohash.d
@@ -6,8 +6,8 @@
module analysis.opequals_without_tohash;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/pokemon.d b/src/analysis/pokemon.d
index b20e41e..23f7d42 100644
--- a/src/analysis/pokemon.d
+++ b/src/analysis/pokemon.d
@@ -6,8 +6,8 @@
module analysis.pokemon;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/range.d b/src/analysis/range.d
index 1d656fd..96625e9 100644
--- a/src/analysis/range.d
+++ b/src/analysis/range.d
@@ -6,8 +6,8 @@
module analysis.range;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
@@ -94,14 +94,14 @@ class BackwardsRangeCheck : BaseAnalyzer
}
}
- override void visit(const SliceExpression sliceExpression)
+ override void visit(const Index index)
{
- if (sliceExpression.lower !is null && sliceExpression.upper !is null)
+ if (index.low !is null && index.high !is null)
{
state = State.left;
- visit(sliceExpression.lower);
+ visit(index.low);
state = State.right;
- visit(sliceExpression.upper);
+ visit(index.high);
state = State.ignore;
if (hasLeft && hasRight && left > right)
{
@@ -114,7 +114,7 @@ class BackwardsRangeCheck : BaseAnalyzer
hasLeft = false;
hasRight = false;
}
- sliceExpression.accept(this);
+ index.accept(this);
}
private:
diff --git a/src/analysis/redundant_parens.d b/src/analysis/redundant_parens.d
index 87ebc85..1a177ae 100644
--- a/src/analysis/redundant_parens.d
+++ b/src/analysis/redundant_parens.d
@@ -5,8 +5,8 @@
module analysis.redundant_parens;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import dsymbol.scope_ : Scope;
diff --git a/src/analysis/run.d b/src/analysis/run.d
index d73f4a8..672ba3c 100644
--- a/src/analysis/run.d
+++ b/src/analysis/run.d
@@ -11,9 +11,9 @@ import std.conv;
import std.algorithm;
import std.range;
import std.array;
-import std.d.lexer;
-import std.d.parser;
-import std.d.ast;
+import dparse.lexer;
+import dparse.parser;
+import dparse.ast;
import std.typecons : scoped;
import std.experimental.allocator : CAllocatorImpl;
@@ -181,7 +181,7 @@ const(Module) parseModule(string fileName, ubyte[] code, ParseAllocator p,
const(Token)[] tokens = getTokensForParser(code, config, &cache);
if (linesOfCode !is null)
(*linesOfCode) += count!(a => isLineOfCode(a.type))(tokens);
- return std.d.parser.parseModule(tokens, fileName, p,
+ return dparse.parser.parseModule(tokens, fileName, p,
report ? &messageFunctionJSON : &messageFunction, errorCount, warningCount);
}
diff --git a/src/analysis/stats_collector.d b/src/analysis/stats_collector.d
index f33be48..7324274 100644
--- a/src/analysis/stats_collector.d
+++ b/src/analysis/stats_collector.d
@@ -5,8 +5,8 @@
module analysis.stats_collector;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
class StatsCollector : BaseAnalyzer
diff --git a/src/analysis/style.d b/src/analysis/style.d
index 47b13bb..4204ff4 100644
--- a/src/analysis/style.d
+++ b/src/analysis/style.d
@@ -6,8 +6,8 @@
module analysis.style;
import std.stdio;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import std.regex;
import std.array;
import std.conv;
diff --git a/src/analysis/undocumented.d b/src/analysis/undocumented.d
index 3d978a7..1b5e082 100644
--- a/src/analysis/undocumented.d
+++ b/src/analysis/undocumented.d
@@ -7,8 +7,8 @@ module analysis.undocumented;
import analysis.base;
import dsymbol.scope_ : Scope;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import std.regex : ctRegex, matchAll;
import std.stdio;
diff --git a/src/analysis/unmodified.d b/src/analysis/unmodified.d
index 6839c0a..68db453 100644
--- a/src/analysis/unmodified.d
+++ b/src/analysis/unmodified.d
@@ -7,13 +7,13 @@ module analysis.unmodified;
import analysis.base;
import dsymbol.scope_ : Scope;
import std.container;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
/**
* Checks for variables that could have been declared const or immutable
*/
-class UnmodifiedFinder:BaseAnalyzer
+class UnmodifiedFinder : BaseAnalyzer
{
alias visit = BaseAnalyzer.visit;
@@ -132,7 +132,6 @@ class UnmodifiedFinder:BaseAnalyzer
mixin PartsMightModify!AsmPrimaryExp;
mixin PartsMightModify!IndexExpression;
- mixin PartsMightModify!SliceExpression;
mixin PartsMightModify!FunctionCallExpression;
mixin PartsMightModify!IdentifierOrTemplateChain;
mixin PartsMightModify!ReturnStatement;
diff --git a/src/analysis/unused.d b/src/analysis/unused.d
index 51d164d..dd5f2ce 100644
--- a/src/analysis/unused.d
+++ b/src/analysis/unused.d
@@ -4,8 +4,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
module analysis.unused;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import std.container;
import std.regex : Regex, regex, matchAll;
@@ -69,7 +69,6 @@ class UnusedVariableCheck : BaseAnalyzer
mixin PartsUseVariables!Initializer;
mixin PartsUseVariables!InterfaceDeclaration;
mixin PartsUseVariables!NewExpression;
- mixin PartsUseVariables!SliceExpression;
mixin PartsUseVariables!StaticIfCondition;
mixin PartsUseVariables!StructDeclaration;
mixin PartsUseVariables!TemplateArgumentList;
diff --git a/src/analysis/unused_label.d b/src/analysis/unused_label.d
index 8d93f21..f6e2643 100644
--- a/src/analysis/unused_label.d
+++ b/src/analysis/unused_label.d
@@ -4,8 +4,8 @@
module analysis.unused_label;
-import std.d.ast;
-import std.d.lexer;
+import dparse.ast;
+import dparse.lexer;
import analysis.base;
import analysis.helpers;
import dsymbol.scope_ : Scope;
diff --git a/src/astprinter.d b/src/astprinter.d
index 5fa93f0..ad33b10 100644
--- a/src/astprinter.d
+++ b/src/astprinter.d
@@ -3,9 +3,9 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-import std.d.lexer;
-import std.d.ast;
-import std.d.formatter;
+import dparse.lexer;
+import dparse.ast;
+import dparse.formatter;
import std.stdio;
import std.string;
import std.array;
@@ -727,25 +727,6 @@ class XMLPrinter : ASTVisitor
output.writeln("");
}
- override void visit(const SliceExpression sliceExpression)
- {
- output.writeln("");
- visit(sliceExpression.unaryExpression);
- if (sliceExpression.lower !is null)
- {
- output.writeln("");
- visit(sliceExpression.lower);
- output.writeln("");
- }
- if (sliceExpression.upper !is null)
- {
- output.writeln("");
- visit(sliceExpression.upper);
- output.writeln("");
- }
- output.writeln("");
- }
-
override void visit(const StructDeclaration structDec)
{
output.writeln("");
@@ -970,6 +951,24 @@ class XMLPrinter : ASTVisitor
output.writeln("");
}
+ override void visit(const Index index)
+ {
+ output.writeln("");
+ if (index.high)
+ {
+ output.writeln("");
+ visit(index.low);
+ output.writeln("");
+
+ output.writeln("");
+ visit(index.high);
+ output.writeln("");
+ }
+ else
+ visit(index.low);
+ output.writeln("");
+ }
+
override void visit(const AliasInitializer aliasInitializer) { mixin (tagAndAccept!"aliasInitializer"); }
override void visit(const AliasThisDeclaration aliasThisDeclaration) { mixin (tagAndAccept!"aliasThisDeclaration"); }
override void visit(const AnonymousEnumDeclaration anonymousEnumDeclaration) { mixin (tagAndAccept!"anonymousEnumDeclaration"); }
diff --git a/src/ctags.d b/src/ctags.d
index 616226b..b68c850 100644
--- a/src/ctags.d
+++ b/src/ctags.d
@@ -5,9 +5,9 @@
module ctags;
-import std.d.parser;
-import std.d.lexer;
-import std.d.ast;
+import dparse.parser;
+import dparse.lexer;
+import dparse.ast;
import std.algorithm;
import std.range;
import std.stdio;
@@ -68,7 +68,7 @@ void doNothing(string, size_t, size_t, string, bool)
string paramsToString(Dec)(const Dec dec)
{
- import std.d.formatter : Formatter;
+ import dparse.formatter : Formatter;
auto app = appender!string();
auto formatter = new Formatter!(typeof(app))(app);
diff --git a/src/etags.d b/src/etags.d
index 4fa8fb7..5e27a15 100644
--- a/src/etags.d
+++ b/src/etags.d
@@ -6,9 +6,9 @@
module etags;
-import std.d.parser;
-import std.d.lexer;
-import std.d.ast;
+import dparse.parser;
+import dparse.lexer;
+import dparse.ast;
import std.algorithm;
import std.range;
import std.stdio;
@@ -288,7 +288,7 @@ private:
{
maketag(name.text, name.index, name.line);
}
-
+
void maketag(string text, size_t index, ulong line)
{
// skip unittests and hidden declarations
diff --git a/src/highlighter.d b/src/highlighter.d
index adb45d8..5877449 100644
--- a/src/highlighter.d
+++ b/src/highlighter.d
@@ -7,7 +7,7 @@ module highlighter;
import std.stdio;
import std.array;
-import std.d.lexer;
+import dparse.lexer;
// http://ethanschoonover.com/solarized
void highlight(R)(ref R tokens, string fileName)
diff --git a/src/imports.d b/src/imports.d
index 2cdfa96..9809c66 100644
--- a/src/imports.d
+++ b/src/imports.d
@@ -5,7 +5,7 @@
module imports;
-import std.d.ast;
+import dparse.ast;
import std.stdio;
import std.container;
diff --git a/src/main.d b/src/main.d
index ddc1f64..ef7bed9 100644
--- a/src/main.d
+++ b/src/main.d
@@ -13,9 +13,9 @@ import std.getopt;
import std.path;
import std.stdio;
import std.range;
-import std.lexer;
-import std.d.lexer;
-import std.d.parser;
+import std.experimental.lexer;
+import dparse.lexer;
+import dparse.parser;
import highlighter;
import stats;
diff --git a/src/outliner.d b/src/outliner.d
index f9772ef..1ba9e14 100644
--- a/src/outliner.d
+++ b/src/outliner.d
@@ -3,9 +3,9 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-import std.d.lexer;
-import std.d.ast;
-import std.d.formatter;
+import dparse.lexer;
+import dparse.ast;
+import dparse.formatter;
import std.stdio;
import std.string;
import std.array;
diff --git a/src/stats.d b/src/stats.d
index fc6b26e..10bc4ce 100644
--- a/src/stats.d
+++ b/src/stats.d
@@ -7,7 +7,7 @@ module stats;
import std.stdio;
import std.algorithm;
-import std.d.lexer;
+import dparse.lexer;
pure nothrow bool isLineOfCode(IdType t)
{
diff --git a/src/symbol_finder.d b/src/symbol_finder.d
index 4af1ff1..3806351 100644
--- a/src/symbol_finder.d
+++ b/src/symbol_finder.d
@@ -6,9 +6,9 @@
module symbol_finder;
import std.stdio : File;
-import std.d.lexer;
-import std.d.parser;
-import std.d.ast;
+import dparse.lexer;
+import dparse.parser;
+import dparse.ast;
import std.stdio;
import std.file:isFile;