From: Paul Paterson <paulpaterson@ho...> - 2003-08-23 19:51:16
Mike Fletcher wrote:
>Paul Paterson wrote:
> > How do people usually handle case-insensitive matching?
> Usually (until now) I've just hacked it by explicitly creating
> ranges in the very few cases it came up. However, given that it's an
> occasional request, I've just added support for it to SimpleParse.
> Usage is like so:
> production := c"match without case" # not 'c' prefix
> which will match at run-time as if the production had been
> production := ([mM],[aA],[tT],[cC],[hH],' ',[wW],...)
> Implication being that case-insensitive literals are *far* heavier
> regular literals (probably a few orders of magnitude slower), as under
> the covers they are actually creating a sequential group with literal
> and range sub-elements. Runs of multiple non-case-carrying letters
> be treated as a single literal, BTW.
Wow - thanks! I'll try this out as soon as SF CVS catches up.
I'll do some timing comparisons and let you know what effect it has. I'm
not too concerned about absolute speed for my application because I
think that I can have an option for case insensitive searching (when I
will switch grammars).
I tried the new version 2.0.1a2 and it works a treat. Strangely it seems
to run quicker on my grammar. For my application I get the following,
Ran 414 tests in 171.785s
Ran 414 tests in 155.531s
0. PC doing other things
1. In the second case 8 tests failed because the case insensitivity
showed a problem in my tests (I was accidentially using a lower case
keyword as a variable).
2. .... ?
I'll fix my tests and see what happens - but in any event, this is a