I have a request: Can ksh get an option to -x, like -x2 or -x<name>, where name is s colon-separated list of names of subsystems which should print additional trace output, so that patterns passed to the regex engine are printed using a $'string'? I hate it to have to attach dbx or gdb just to see how the pattern is processed by ksh's lexer/parser.
Olga On Mon, Jun 18, 2012 at 6:01 PM, Glenn Fowler <[email protected]> wrote: > > On Mon, 18 Jun 2012 17:28:43 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= > wrote: >> So what should I do? Escape the } and {? > > aha > not sure > it looks like it involves the ksh lexer/parser and how it handles the > tokenization implications of ~(...) mid-stream > dgk and I will talk about it this afternoon > >> On Mon, Jun 18, 2012 at 5:21 PM, Glenn Fowler <[email protected]> wrote: >> > >> > On Mon, 18 Jun 2012 17:04:44 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= >> > wrote: >> >> from what I understand a {x,y} in extended regular expressions should >> >> match x times but no more than y times. But ksh (ast-ksh.20120612) >> >> returns no matches at all: >> >> ksh -c 's="abbbc" ; d="${s/~(E)b{2,4}/dummy}" ; print -v .sh.match' >> > >> >> Is this a bug? >> > >> > first run with -x to checjk the parse >> > >> > ksh -cx 's="abbbc" ; d="${s/~(E)b{2,4}/dummy}" ; print -v .sh.match' >> > >> > and it does show a problem >> > -- >> > +t+ s=bbb >> > +t+ d='bbb/dummy}' <====== >> > +t+ print -v .sh.match >> > -- >> > >> > we can double verify that the regex is ok by using the regex test harness >> > -- >> > bin/package use >> > cd re >> > print $'K\t~(E)b{2,4}\tabbbc\t(1,4)' > t.dat >> > ./testregex t.dat >> > -- >> > >> > so it looks like a battle between the 2 '}' in the ${...} expansion >> > > >> -- >> , _ _ , >> { \/`o;====- Olga Kryzhanovska -====;o`\/ } >> .----'-/`-/ [email protected] \-`\-'----. >> `'-..-| / http://twitter.com/fleyta \ |-..-'` >> /\/\ Solaris/BSD//C/C++ programmer /\/\ >> `--` `--` > -- , _ _ , { \/`o;====- Olga Kryzhanovska -====;o`\/ } .----'-/`-/ [email protected] \-`\-'----. `'-..-| / http://twitter.com/fleyta \ |-..-'` /\/\ Solaris/BSD//C/C++ programmer /\/\ `--` `--` _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
