[josm-dev] Search and | ?
Russ Nelson
nelson at crynwr.com
Sun Dec 21 02:52:57 GMT 2008
Ævar Arnfjörð Bjarmason writes:
> > Just wondering: should I fix the code or leave the documentation fixed?
>
> The code, | should work as OR but doesn't. There's a bug filed for
> this (which I didn't find).
Probably mine.
> I looked at it for a bit recently but didn't manage to fix it before
> getting distracted with other things, but I suspect one of the
> tokenizer rules is being too agressive and slurping up "foo|bar" as a
> literal token or something like that. At least that's how it gets
> parsed IIRC.
That's exactly the problem. '|' ends up being a string rather than a
token. If somebody checks this in, tell me and I'll restore the docs
to include | as a synonym for "OR". I've made other improvements to
the docs. If somebody familiar with the intended operation could give
them a once-over look, I'd appreciate it.
http://wiki.openstreetmap.org/wiki/JOSM/Search_function
nelson at nelson-desktop:~/osm/trunk$ svn diff
Index: src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java
===================================================================
--- src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java (revision 1147)
+++ src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java (working copy)
@@ -53,6 +53,8 @@
return "(";
case ')':
return ")";
+ case '|':
+ return "|";
case '"':
s = new StringBuilder(" ");
for (int nc = search.read(); nc != -1 && nc != '"'; nc = search.read())
@@ -69,7 +71,7 @@
return " "+s.toString();
}
c = (char)next;
- if (c == ' ' || c == '\t' || c == '"' || c == ':' || c == '(' || c == ')') {
+ if (c == ' ' || c == '\t' || c == '"' || c == ':' || c == '(' || c == ')' || c == '|') {
search.unread(next);
if (s.toString().equals("OR"))
return "|";
--
--my blog is at http://blog.russnelson.com | Delegislation is a slippery
Crynwr sells support for free software | PGPok | slope to prosperity.
521 Pleasant Valley Rd. | +1 315-323-1241 | Fewer laws, more freedom.
Potsdam, NY 13676-3213 | Sheepdog | (Not a GOP supporter).
More information about the josm-dev
mailing list