aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.y
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-07-11 08:17:14 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-07-11 08:17:14 +0300
commit9e419cfbc401e9b9fd45c8e854fdf5ae799261d5 (patch)
treed73a710963075881315d841dd41dc01ed43a20dd /awkgram.y
parentc8b9f5d5ac4e23a394dc79eccbfb824ddee531ef (diff)
downloadegawk-9e419cfbc401e9b9fd45c8e854fdf5ae799261d5.tar.gz
egawk-9e419cfbc401e9b9fd45c8e854fdf5ae799261d5.tar.bz2
egawk-9e419cfbc401e9b9fd45c8e854fdf5ae799261d5.zip
Some cleanup about checking letters and identifiers.
Diffstat (limited to 'awkgram.y')
-rw-r--r--awkgram.y14
1 files changed, 13 insertions, 1 deletions
diff --git a/awkgram.y b/awkgram.y
index d06faf8d..ddcc9d72 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -4086,7 +4086,7 @@ retry:
}
}
- if (c != '_' && ! is_alpha(c)) {
+ if (! is_letter(c)) {
yyerror(_("invalid char '%c' in expression"), c);
return lasttok = LEX_EOF;
}
@@ -6308,6 +6308,18 @@ is_alnum(int c)
}
+/*
+ * is_letter --- function to check letters
+ * isalpha() isn't good enough since it can look at the locale.
+ * Underscore counts as a letter in awk identifiers
+ */
+
+bool
+is_letter(int c)
+{
+ return (is_alpha(c) || c == '_');
+}
+
/* is_identchar --- return true if c can be in an identifier */
bool