# HG changeset patch # User František Kučera # Date 1558901705 -7200 # Node ID 5261dfd3b952935b0d9053436a4e15df6dd1b220 # Parent b3d1a671315b0332c5c71797f0928bd3873570cd more reserved names, exception diff -r b3d1a671315b -r 5261dfd3b952 src/AwkHandler.h --- a/src/AwkHandler.h Sat May 25 21:52:56 2019 +0200 +++ b/src/AwkHandler.h Sun May 26 22:15:05 2019 +0200 @@ -38,8 +38,6 @@ #include -#include - #include "Configuration.h" #include "AwkException.h" @@ -138,7 +136,7 @@ int error2; __pid_t waitPID1 = wait(&error1); __pid_t waitPID2 = wait(&error2); - if (error1 || error2) throw cli::RelpipeCLIException(L"The child process returned an error exit code.", cli::CLI::EXIT_CODE_UNEXPECTED_ERROR); // TODO: better exceptions? + if (error1 || error2) throw AwkException(L"The child process returned an error exit code."); awkInputWriterFD = -1; } @@ -173,7 +171,7 @@ string_t escapeAwkVariableName(const string_t& attributeName) { // cat awkgram.y | awk -v FS='\\{"|",' -v ORS='|' '/static const struct token tokentab/, /\};/ { if (/^\{/) { print $2} }' // cat AwkHandler.h | awk -v FS=' |\\(' -v ORS='|' '/awkScript.*"function/ { print $4; }' - std::wregex awkReservedNames(L"BEGIN|BEGINFILE|END|ENDFILE|adump|and|asort|asorti|atan2|bindtextdomain|break|case|close|compl|continue|cos|dcgettext|dcngettext|default|delete|do|else|eval|exit|exp|fflush|for|func|function|gensub|getline|gsub|if|in|include|index|int|intdiv0|isarray|length|load|log|lshift|match|mktime|namespace|next|nextfile|or|patsplit|print|printf|rand|return|rshift|sin|split|sprintf|sqrt|srand|stopme|strftime|strtonum|sub|substr|switch|system|systime|tolower|toupper|typeof|while|xor"); + std::wregex awkReservedNames(L"FS|OFS|NR|NF|" L"BEGIN|BEGINFILE|END|ENDFILE|adump|and|asort|asorti|atan2|bindtextdomain|break|case|close|compl|continue|cos|dcgettext|dcngettext|default|delete|do|else|eval|exit|exp|fflush|for|func|function|gensub|getline|gsub|if|in|include|index|int|intdiv0|isarray|length|load|log|lshift|match|mktime|namespace|next|nextfile|or|patsplit|print|printf|rand|return|rshift|sin|split|sprintf|sqrt|srand|stopme|strftime|strtonum|sub|substr|switch|system|systime|tolower|toupper|typeof|while|xor"); std::wregex trReservedNames(L"_escape|_unescape|_readVariables|_writeVariables|record"); std::wregex badCharacters(L"[^a-zA-Z0-9_]|^([0-9])");