Commit 38110618 authored by Custom2043's avatar Custom2043
Browse files

fix +++

parent 49f37624
No preview for this file type
...@@ -22,13 +22,14 @@ equals = "=" ...@@ -22,13 +22,14 @@ equals = "="
Jump = "\r\n"|"\r"|"\n" Jump = "\r\n"|"\r"|"\n"
Space = " "|"\t" Space = " "|"\t"
allToken = "*"
Identifier = firstLetter:letter [{idName:(letter|digit)}] Identifier = firstLetter:letter [{idName:(letter|digit)}]
ignore = {Space|Jump} ignore = {Space|Jump}
SearchName = id:Identifier ":" SearchName = id:Identifier ":"
LineHeader = [trans:transientToken] id:Identifier equals 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}] ArraySearchToken = [{minSize:digit} "-"] arrayOpen [orToken left:SearchToken] {searches:SearchToken} [right:SearchToken orToken] arrayClose ["-" {maxSize:digit}]
OptionalSearchToken = optionOpen {searches:SearchToken} optionClose OptionalSearchToken = optionOpen {searches:SearchToken} optionClose
BracketSearchToken = exprOpen {searches:SearchToken} exprClose BracketSearchToken = exprOpen {searches:SearchToken} exprClose
......
...@@ -27,6 +27,11 @@ public class OrSearch extends MultipleSearch ...@@ -27,6 +27,11 @@ public class OrSearch extends MultipleSearch
@Override @Override
MultipleSearch addIgnore(Ignore ignore) 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 ...@@ -45,7 +45,7 @@ public class TokenBuilder extends Builder
List<Search> searchesWithIgnore = new LinkedList<>(); List<Search> searchesWithIgnore = new LinkedList<>();
for (Search s : searches) for (Search s : searches)
{ {
if (s instanceof TokenSearch || s instanceof OrSearch) if (s instanceof TokenSearch)
searchesWithIgnore.add(s); searchesWithIgnore.add(s);
else if (s instanceof MultipleSearch) else if (s instanceof MultipleSearch)
searchesWithIgnore.add(((MultipleSearch)s).addIgnore(ignore)); searchesWithIgnore.add(((MultipleSearch)s).addIgnore(ignore));
...@@ -127,16 +127,11 @@ public class TokenBuilder extends Builder ...@@ -127,16 +127,11 @@ public class TokenBuilder extends Builder
toSearchIn = ((BracketSearch)array[i].getSearch()).getSearches(); toSearchIn = ((BracketSearch)array[i].getSearch()).getSearches();
Result[][] sortedResults = this.separateIgnoreResults(array[i].getArray(), toSearchIn); Result[][] sortedResults = this.separateIgnoreResults(array[i].getArray(), toSearchIn);
r.add(new Result(new BracketSearch(toSearchIn), sortedResults[0])); 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])); rIgnored.add(new Result(new BracketSearch(toSearchIn), sortedResults[1]));
} }
resultWithoutIgnore.add(new Result(s, r.toArray(new Result[r.size()]))); 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) else if (s instanceof OrSearch || s instanceof TokenSearch)
{ {
...@@ -150,7 +145,12 @@ public class TokenBuilder extends Builder ...@@ -150,7 +145,12 @@ public class TokenBuilder extends Builder
} }
} }
else else
ignoredResults.add(results[position]); {
if (results[position].getArray() == null)
ignoredResults.add(results[position]);
else
ignoredResults.add(results[position].getArray()[0]);
}
position ++; position ++;
} }
......
Supports Markdown
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