mxTextTools Question, Number 2 :)

Cliff Crawford cjc26 at nospam.cornell.edu
Mon Jul 17 16:12:24 EDT 2000


* Stephen Hansen <stephen at cerebralmaelstrom.com> menulis:
| 
| ...works, I suspose... but, here's the harder part. I want to ignore that
| whitespace as delimiter if the next character is a special
| 
| So, "This &that" would end up capturing "This that".
| 
| For the life of me I can't even fathom how to do the above! Well, I have a
| vague conception of what needs to be done but can't get it down on
| paper(Y'know what I mean. :))

Would it be possible to have the special character come >before< the
space, rather than after?  For example, "This& that".  That might be a
bit easier to do.

If you can't do it that way, well..I don't know mxTextTools, but I do
know a little about writing parsers in general.  The way I would do it
is to have the parser jump to a special state whenever it encounters a
space; in that state, if the next character is "&" then add a space to
the text buffer and jump back to the "Text" state.

Hopefully you can translate the above into mxTextTools code. :)


-- 
cliff crawford    -><-    http://www.people.cornell.edu/pages/cjc26/
                          Synaesthesia now!            icq 68165166



More information about the Python-list mailing list