Skip to content

Commit

Permalink
Use new dparse and dsymbol
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Oct 29, 2015
1 parent a55e93a commit 73ddd29
Show file tree
Hide file tree
Showing 41 changed files with 114 additions and 116 deletions.
3 changes: 2 additions & 1 deletion makefile
Expand Up @@ -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\
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/asm_style.d
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/base.d
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/builtin_property_names.d
Expand Up @@ -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_;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/comma_expression.d
Expand Up @@ -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_;

Expand Down
4 changes: 2 additions & 2 deletions 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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/del.d
Expand Up @@ -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_;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/duplicate_attribute.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/enumarrayliteral.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/fish.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/function_attributes.d
Expand Up @@ -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_;

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/helpers.d
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/if_statements.d
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/ifelsesame.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/label_var_same_name_check.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/length_subtraction.d
Expand Up @@ -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_;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/local_imports.d
Expand Up @@ -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_;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/logic_precedence.d
Expand Up @@ -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_;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/mismatched_args.d
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/numbers.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/objectconst.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/opequals_without_tohash.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/pokemon.d
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/analysis/range.d
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -114,7 +114,7 @@ class BackwardsRangeCheck : BaseAnalyzer
hasLeft = false;
hasRight = false;
}
sliceExpression.accept(this);
index.accept(this);
}

private:
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/redundant_parens.d
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions src/analysis/run.d
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/stats_collector.d
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/style.d
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/undocumented.d
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions src/analysis/unmodified.d
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 73ddd29

Please sign in to comment.