bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not urgent, maybe Non-bug "obscure feature"


From: arnold
Subject: Re: Not urgent, maybe Non-bug "obscure feature"
Date: Thu, 23 Sep 2021 03:30:14 -0600
User-agent: Heirloom mailx 12.5 7/5/10

I'm going through old mail.

I have added a note about this in the section on strongly typed
regexps. It'll be in Git shortly and in the next release.

Thanks,

Arnold

J Naman <jnaman2@gmail.com> wrote:

> I do not feel that this report is a program bug, rather it was not overtly
> documented (that I could see) that *strongly typed regexp *are treated
> politely when assigned on the Command-Line Option -v. See below. If it
> really is a bug, consider not fixing it. I like it!
> GAWK Command-Line Option         BEGIN{ # first line is a print statement
> ...
> gawk -v RS="[\\n\\f\\r]"  -f ... typeof(RS)=string ='[\n\f\r]'
> gawk -v RS=/[\\n\\f\\r]/  -f ... typeof(RS)=string ='/[\n\f\r]/'
> *NOT!* -v RS=@/[\\n\\f\\r]/ -f ... typeof(RS)=regexp ='[*\\*n*\\*f*\\*r]'
> gawk -v RS=@/[\n\f\r]/    -f ... typeof(RS)=regexp ='[\n\f\r]'
> # *Wonderful! no esc seq req'd*
>
> *gawk Ver 5.1.0* under *Windows *7 x64
>
> Ref: "The variable values given on the command line are processed for
> escape sequences (see Section 3.2 [Escape Sequences], page 48). ... The
> variable assignment feature is most useful for assigning to variables *such
> as RS* ..."
> "Unless noted otherwise, all these escape sequences apply to both string
> constants *and regexp* constants:"
> To summarize: The escape sequences in the preceding list are always
> processed first, for both string constants *and regexp* constants. This
> happens very early, as soon as awk reads your program." #! -v command
> line *before
> *awk reads your program ?!?
> 'Best, John Naman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]