Hi. I've been using ANTLR (ANTLRWorks, actually, which is very nice) to
implement a project-specific search language, sort of like google's.
I've gotten it mostly working, though it's taken some time and
experimentation to understand the details. In my grammar, I've defined
a searchTerms parser rule, which is one or more searchTerm:
searchTerm+;
searchTerm matches a SEARCH_TERM token, which can be a number or word
(with some special characters like '*' allowed). The number is the
usual definition for a floating point number:
('-'|'+')?((DIGIT+)|(DIGIT*'.'DIGIT+));
which I hope is correct. (DIGIT is the fragment 0..9.) I'm also
sending whitespace to the HIDDEN channel, as is often recommended. It
seems like a side effect of this is that this input:
4.66.34
which isn't a valid number, gets parsed as two different terms: 4.66 and
.34. Is there some way to require whitespace between my search terms so
that input isn't allowed? When I was parsing words, this wasn't a
problem. I wouldn't be surprised if my design is a bit wrong still, and
that's what's put me in this position.
I can't post the entire grammar, unfortunately.
Thanks for any pointers,
Reid
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---