Fix a number of issues found by running (most of) the gawk
test suite.
There are still a number of skipped GAWK tests (work to do), and some of GoAWK's behavior doesn't and won't ever match GAWK's 100%. I've gone for the POSIX behavior in most cases.
The full list of changes to GoAWK is:
- Support additional POSIX escape sequences in string literals:
\a \b \f \v \xhh (hex) \ooo (octal) - Fix close() to allow reopening a file after it's been closed
- Make sub/gsub backslash handling per POSIX
- Fix bug in RS="" handling:
- when input is just newlines
- when there are newlines at the start of the last record
- Add support for ' ' (space) printf flag
- Add parser/resolver errors for:
- can't use function name as a parameter
- global var %q can't also be a function
- can't call local variable %q as function
- duplicate parameter name %q
- Treat FS of a single backslash as regex
\\
(as other AWKs do)