Skip to content

hexadecimal value escapes #24

@ghost

Description

These are currently supported by GoAWK:

$ goawk 'BEGIN { print "hello\x21" }'
hello!

However they are not defined by POSIX:

One sequence that is not supported is hexadecimal value escapes beginning with
\x. This would allow values expressed in more than 9 bits to be used within
awk as in the ISO C standard. However, because this syntax has a
non-deterministic length, it does not permit the subsequent character to be a
hexadecimal digit. This limitation can be dealt with in the C language by the
use of lexical string concatenation. In the awk language, concatenation
could also be a solution for strings, but not for extended regular expressions
(either lexical ERE tokens or strings used dynamically as regular
expressions). Because of this limitation, the feature has not been added to
POSIX.1-2017.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html#tag_20_06_18

Gawk deals with this by disabling them via gawk --posix or
POSIXLY_CORRECT=y. If the feature is to remain it should perhaps be mentioned
here:

https://github.com/benhoyt/goawk#differences-from-awk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions