From ff256886b6d023a5d5618bcf8139ffd4f998abb3 Mon Sep 17 00:00:00 2001 From: Rene Zwanenburg Date: Tue, 17 May 2016 14:49:40 +0200 Subject: [PATCH] Fix DMD 2.071 import deprecations --- pegged/dynamic/grammar.d | 1 + pegged/dynamic/peg.d | 3 ++- pegged/grammar.d | 4 ++++ pegged/introspection.d | 1 + pegged/peg.d | 4 +++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pegged/dynamic/grammar.d b/pegged/dynamic/grammar.d index e3d3ce85..a40d1bb0 100644 --- a/pegged/dynamic/grammar.d +++ b/pegged/dynamic/grammar.d @@ -11,6 +11,7 @@ Advantages: */ module pegged.dynamic.grammar; +import std.algorithm : startsWith; import std.array; import std.stdio; diff --git a/pegged/dynamic/peg.d b/pegged/dynamic/peg.d index 904c9b40..05608819 100644 --- a/pegged/dynamic/peg.d +++ b/pegged/dynamic/peg.d @@ -1,5 +1,6 @@ module pegged.dynamic.peg; +import std.algorithm : startsWith; import std.array: join; import std.conv: to; @@ -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 } diff --git a/pegged/grammar.d b/pegged/grammar.d index bbfde333..2bb200af 100644 --- a/pegged/grammar.d +++ b/pegged/grammar.d @@ -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; @@ -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 ~ ".\"); } "; @@ -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 = [ diff --git a/pegged/introspection.d b/pegged/introspection.d index 39ae0228..5c1926a8 100644 --- a/pegged/introspection.d +++ b/pegged/introspection.d @@ -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; diff --git a/pegged/peg.d b/pegged/peg.d index e2e0ec15..4ad365b2 100644 --- a/pegged/peg.d +++ b/pegged/peg.d @@ -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 @@ -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) {