bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be as


From: pjfarley3
Subject: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB
Date: Mon, 7 Oct 2019 19:00:59 -0400

I understand that this capability has been deemed not to be desirable for
general gawk distribution, but I wanted to have this functionality for my
own local processing needs.

I have changed interpret.h as shown in the attached patch.  The basic idea
is to permit a node type of "Node_Val" (currently prohibited) on assignment
to SYMTAB["string" or variable] if and only if:

1:       strspn(value, valid_awk_variable_chars) == strlen(value) where "
valid_awk_variable_chars" are all letters, digits, underscore and colon, and
2:      The first character of the string value is > '9' and the first
character following the last ':' (if any) is also > '9'.

The valid name test could probably be improved to account for non-ISO8859
collating sequences, but my internationalization skills aren't quite up to
that level of effort just yet.

Make check fails only symtab6 and symtab7 tests, as expected.  The system on
which the patch was developed and tested is Debian buster (10.2).  I didn't
get around yet to creating some new symtab tests to verify that invalid
names are still not accepted and will generate the existing fatal error, but
I will reply again after I have those set up and tested, if anyone is
interested.

Use or ignore as you wish.  I assign any rights I may have in the patch code
to GNU.

Peter

Attachment: interpret.patch
Description: Binary data


reply via email to

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