Commit 38110618 authored by Custom2043's avatar Custom2043
Browse files

fix +++

parent 49f37624
No preview for this file type
......@@ -22,13 +22,14 @@ equals = "="
Jump = "\r\n"|"\r"|"\n"
Space = " "|"\t"
allToken = "*"
Identifier = firstLetter:letter [{idName:(letter|digit)}]
ignore = {Space|Jump}
SearchName = id:Identifier ":"
LineHeader = [trans:transientToken] id:Identifier equals
TokenSearchToken = ([trans:transientToken] id:Identifier)|string:StringToken
TokenSearchToken = [not:notToken] ([trans:transientToken] id:Identifier)|string:StringToken|allToken
ArraySearchToken = [{minSize:digit} "-"] arrayOpen [orToken left:SearchToken] {searches:SearchToken} [right:SearchToken orToken] arrayClose ["-" {maxSize:digit}]
OptionalSearchToken = optionOpen {searches:SearchToken} optionClose
BracketSearchToken = exprOpen {searches:SearchToken} exprClose
......
......@@ -27,6 +27,11 @@ public class OrSearch extends MultipleSearch
@Override
MultipleSearch addIgnore(Ignore ignore)
{
return new BracketSearch(ignore.getRealSearch(), this);
Search[] s = new Search[this.getSearches().length];
for (int i=0;i<s.length;i++)
s[i] = TokenBuilder.addIgnoresToArray(ignore, new Search[] {this.getSearches()[i]})[0];
return new OrSearch(s);
}
}
......@@ -45,7 +45,7 @@ public class TokenBuilder extends Builder
List<Search> searchesWithIgnore = new LinkedList<>();
for (Search s : searches)
{
if (s instanceof TokenSearch || s instanceof OrSearch)
if (s instanceof TokenSearch)
searchesWithIgnore.add(s);
else if (s instanceof MultipleSearch)
searchesWithIgnore.add(((MultipleSearch)s).addIgnore(ignore));
......@@ -127,16 +127,11 @@ public class TokenBuilder extends Builder
toSearchIn = ((BracketSearch)array[i].getSearch()).getSearches();
Result[][] sortedResults = this.separateIgnoreResults(array[i].getArray(), toSearchIn);
r.add(new Result(new BracketSearch(toSearchIn), sortedResults[0]));
toSearchIn = new Search[sortedResults[1].length];
for (int j=0;j<toSearchIn.length;j++)
toSearchIn[j] = this.ignore.getRealSearch();
rIgnored.add(new Result(new BracketSearch(toSearchIn), sortedResults[1]));
}
resultWithoutIgnore.add(new Result(s, r.toArray(new Result[r.size()])));
ignoredResults.add(new Result(s, rIgnored.toArray(new Result[r.size()])));
ignoredResults.add(new Result(s, rIgnored.toArray(new Result[rIgnored.size()])));
}
else if (s instanceof OrSearch || s instanceof TokenSearch)
{
......@@ -150,7 +145,12 @@ public class TokenBuilder extends Builder
}
}
else
ignoredResults.add(results[position]);
{
if (results[position].getArray() == null)
ignoredResults.add(results[position]);
else
ignoredResults.add(results[position].getArray()[0]);
}
position ++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment