Skip to content

Commit

Permalink
Merge pull request #209 from ReneZwanenburg/master
Browse files Browse the repository at this point in the history
Fix DMD 2.071 import deprecations
  • Loading branch information
PhilippeSigaud committed May 18, 2016
2 parents 6b99018 + ff25688 commit 429d4a8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions pegged/dynamic/grammar.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Advantages:
*/
module pegged.dynamic.grammar;

import std.algorithm : startsWith;
import std.array;
import std.stdio;

Expand Down
3 changes: 2 additions & 1 deletion pegged/dynamic/peg.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module pegged.dynamic.peg;

import std.algorithm : startsWith;
import std.array: join;
import std.conv: to;

Expand Down Expand Up @@ -370,7 +371,7 @@ Dynamic fuse(D)(D d)
if (p.successful)
{
if (p.matches.length != 0)
p.matches = [std.array.join(p.matches)];
p.matches = [join(p.matches)];

p.children = null; // also discard children
}
Expand Down
4 changes: 4 additions & 0 deletions pegged/grammar.d
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ string grammar(Memoization withMemo = Memoization.yes)(string definition)
result =
"struct Generic" ~ shortGrammarName ~ "(TParseTree)
{
import std.functional : toDelegate;
import pegged.dynamic.grammar;
static import pegged.peg;
struct " ~ grammarName ~ "\n {
enum name = \"" ~ shortGrammarName ~ "\";
static ParseTree delegate(ParseTree)[string] before;
Expand Down Expand Up @@ -437,6 +439,7 @@ string grammar(Memoization withMemo = Memoization.yes)(string definition)
static bool isRule(string s)
{
import std.algorithm : startsWith;
return s.startsWith(\"" ~ shortGrammarName ~ ".\");
}
";
Expand Down Expand Up @@ -2755,6 +2758,7 @@ unittest // Memoization reset in composed grammars. Issue #162
unittest // Test lambda syntax in semantic actions
{
import std.array;
import std.string : strip;

auto actions = [

Expand Down
1 change: 1 addition & 0 deletions pegged/introspection.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ This module contains function to inspect a Pegged grammar.
*/
module pegged.introspection;

import std.algorithm : equal;
import std.typecons;

import pegged.parser;
Expand Down
4 changes: 3 additions & 1 deletion pegged/peg.d
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ bool softCompare(ParseTree p1, ParseTree p2)
&& p1.matches == p2.matches
&& p1.begin == p2.begin
&& p1.end == p2.end
&& std.algorithm.equal!(softCompare)(p1.children, p2.children); // the same for children
&& equal!(softCompare)(p1.children, p2.children); // the same for children
}

unittest // softCompare
Expand Down Expand Up @@ -3216,6 +3216,8 @@ mixin template decimateTree()
ParseTree[] result;
foreach(child; pt.children)
{
import std.algorithm : startsWith;

if ( (isRule(child.name) && child.matches.length != 0)
|| !child.successful && child.children.length == 0)
{
Expand Down

0 comments on commit 429d4a8

Please sign in to comment.