Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50788
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Johann Hibschman <jhibschman@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: grimace: a fluent regular expression generator in Python |
| Date | Wed, 17 Jul 2013 07:55:37 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 25 |
| Message-ID | <xjrkgppuh73cm.fsf@gmail.com> (permalink) |
| References | <mailman.4800.1374059632.3114.python-list@python.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx05.eternal-september.org; posting-host="7dfe042e387f4fa00b031ca241f7a32a"; logging-data="22793"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HBdtdJpwB43zFSYjSZcLF1yAEl/ubpz8=" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) |
| Cancel-Lock | sha1:A0CIvIctaDOA5lxDnkm59ooawmA= sha1:61w3Y01YMMFM3UDzKUU2ir6xJ44= |
| Xref | csiph.com comp.lang.python:50788 |
Show key headers only | View raw
Ben Last <ben@benlast.com> writes:
> Good points. I wanted to find a syntax that allows comments as well as
> being fluent:
> RE()
> .any_number_of.digits # Recall that any_number_of includes zero
> .followed_by.an_optional.dot.then.at_least_one.digit # The dot is
> specifically optional
> # but we must have one digit as a minimum
> .as_string()
Speaking of syntax, have you looked at pyparsing? I like their
pattern-matching syntax, and I can see it being applied to regexes.
They use an operator-heavy syntax, like:
'(' + digits * 3 + ')-' + digits * 3 + '-' + digits * 4
That seems easier for me to read than the foo.then.follow syntax.
That then makes me think of ometa, which is a fun read, but probably not
completely relevant.
Regards,
Johann
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: grimace: a fluent regular expression generator in Python Ben Last <ben@benlast.com> - 2013-07-17 10:33 +0800 Re: grimace: a fluent regular expression generator in Python Johann Hibschman <jhibschman@gmail.com> - 2013-07-17 07:55 -0500 Re: grimace: a fluent regular expression generator in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-07-18 11:51 +1200
csiph-web