On 21 June 2012 11:34, Glenn Fowler <[email protected]> wrote:
>
> On Wed, 20 Jun 2012 19:14:55 +0200 Lionel Cons wrote:
>> On 20 June 2012 06:43, ольга крыжановская <[email protected]> 
>> wrote:
>> > Glenn, this looks right:
>> > xmltext='<h1><div> a text </div><!-- a comment (<disabled>) --></h1>'
>> >
>> > dummy="${xmltext//~(Ex)(?:
>> >       (<!--.+-->)+?|   # xml comments
>> >       (<.+>)+?|  # xml tags
>> >       ([^[><]]+)+?     # xml text
>> >       )/dummy}"
>> > print -v .sh.match
>> >> ----- cutme ----
>
>> <RANT>
>> I'm likely going to be sorry for this email, but:
>
>> For crying out loud.
>> For gods sake.
>> What is this?
>
>> 1. What you do with these regex is useful. Very very useful.
>> 2. What you archive is magic for those not being initiated in the
>> rituals of regex
>> 3. ksh93 and libast seem to have a very, very powerful regex engine
>
>> But:
>
>> Where... is... this... documented?
>
>> For a *long* time I would really appreciate that the --man pages for
>> grep, sed and ksh include a complete list of regex commands, including
>> examples. Also example code would be very, very nice. Neither ast-open
>> nor ast-ksh has *any* godforsaken example code. It does *not* help if
>> you have one of the best regex engines in this world when only those
>> initiated in the ways of ast regex can use it.
>> </RANT>
>
>> Sorry, bad day today. Started bad, will end in disaster.
>
> some rants make me smile in a good way
> you are completely correct about the documentation for library code I'm 
> responsible for
> given the choice between documenting and hacking, guess which way I go
> at least anything involving ast::optget() forces me document before proceeding
> (getting me to document was one of the driving forces behind optget())
> after we stabilize the current release regex is at the top of my 
> documentation list

Could you at least grab regcomp.c/grp() and condense the flag
dispatcher there into a table which contains the list of available
switches and put that in BOTH regex(3ast) and sh(1), please? I really
don't like to dive into the code just to find out how to use the ksh
regex engine.

> the particular example from Roland and Olga that triggered the rant uses
> perl constructs, in particular non-greedy matching
> I implemented it and understand how the algorithm works in comparison
> to the default greedy algorithm
> but that doesn't mean I'm fluent in its usage
> this is true for a lot of ast features
> input from the user community can have a positive impact on the example corpus
>
> if you dig in the source you can find some very interesting shell, C and RE 
> examples
> lurking in the regression tests

It'll be nice to have something like a ast-ksh-demo and ast-open-demo
package which contains some sophisticated demos. The lack of
documentation, *simple* examples and books which cover the newer ksh
features (those introduced or stabilised post release of the
Bolsky/Korn book) is very, very frustrating and IMO a major barrier
why ksh93 and libast never found widespread usage outside AT&T. You're
really shooting yourself into your feet with that. Even the bash
authors do that better these days.
If you can't do that or don't have time please ask your manager to
hire someone It usually doesn't pay off to invest a lot into software
development without having proper documentation.

> re example code
>
> in any src/** dir that contains a Makefile or Nmakefile look at *.@(rt|tst)
> in src/cmd/tests look at *.dat which are input files for the testregex test 
> harness
> testregex is not installed -- find that in $INSTALLROOT/src/cmd/tests
> to generate that
>        bin/package use
>        cd re
>        nmake test
>        testregex --man
> testregex is also documented in the manual nav at 
> www.research.att.com/sw/download/

OK. But here's another rant: You have a test harness for regex in C
but AFAIK you do not have a test harness which uses the same data to
test ${s/.../...}, ${s//.../...}, ${s#...}, ${s##...},, ${s%...},
${s%%...} ... Is that just an oversight or intentional?

Lionel

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to