more reserved names, exception v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 26 May 2019 22:15:05 +0200
branchv_0
changeset 30 5261dfd3b952
parent 29 b3d1a671315b
child 31 64d9244ee252
more reserved names, exception
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 <relpipe/writer/Factory.h>
 
-#include <relpipe/cli/RelpipeCLIException.h>
-
 #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])");