Re: PATCH: simplifying regular expressions
Ben Elliston <[email protected]>
| Newsgroups | gmane.comp.sysutils.dejagnu.general |
|---|---|
| Message-ID | <20181210010343.GB15867@bapbop> |
On Sun, Dec 09, 2018 at 06:58:28PM -0600, Jacob Bachmeyer wrote:
> > A lot of regular expressions in DejaGnu are complex for no good
> > reason. This is because the regexps are placed inside quotes ("..")
> > wich are processed before being passed to the relevant function (be it
> > 'expect', 'regexp', 'regsub', etc). As long as the string is a
> > constant, it is possible to put the regexp in braces and eliminate one
> > additional level of backslash quoting. Here are a few examples from
> > lib/telnet.exp. As you can see, the regexps become quite a bit
> > clearer, even for these fairly simple cases.
> That is good for lib/telnet.exp, but some files, like
> lib/dejagnu.exp and testsuite/runtests.all/libs.exp substitute
> variables into the regexps.
This is why I said "as long as the string is constant". ;-)
For strings containing varaible substitutions, I don't think there is
much we can do.
Ben
_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEFS8+rdM1/2KWERKFZ9rcPj90NkkFAlwNu20ACgkQZ9rcPj90 NknKAQ/+LIGNArYtbFQaecEenCTSUZlhUj4i1CH/+qedFzofq67jkjx221MnHCvg mdqaPLamOEqtgyzIW9dM8isyvNAgdryl90SK+jUyeb150txIq0Zjt5WZXVUk7Z8B WdgUY6NT26NR64EKc7fjZt404plOVhH7dl7umXKIj5nJ0x8uHTv8DvrQvnRQ8AY6 h+2YAhCAw/CLUjAmpWk06iILFnjJSFhQfUCkyCa4gKRVJaiOHl4ReRNx0P/4XbYW eohzqnM+PTf1oJDhjVU7s/sumbyVYTa6CXvxLqCjVp4boQ6BHb70xcmkZt4aIVkP r62qFbCnSY9RRcuBODEaa5AuvNlQWSc6OP9o9YR6N6G/xTm/LDbmAnijPOZUWko3 qgdGWBIOFgx7qZriJPBkcBNtT92RDJ6intR03kGMSscpcFaj6579iPUBpdbatMIS OzNeHM3YU2cOVzP7tTk4UtTdR6fBW1fBTWBhPd7zKWHojwTGqLTwwECb0YD4uokb PlJ8ptpJQfoQ6+quZMT+IQDDJ/J77e+aiZ+DlSrPaQoEomt7bhFOFWOSUgNsmi7v b7R8TQfO9RpUPfn/hJ4R8t0fwKguRZpUGMpeaVERYv1ISeL3oJS49G6dGuwiEoSe SW2IT2hLq9tpZa5wfjLakB0vBEP0dlgOi4xOZujXwO5p6S0gV44= =QccL -----END PGP SIGNATURE-----