aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.y
diff options
context:
space:
mode:
Diffstat (limited to 'awkgram.y')
-rw-r--r--awkgram.y21
1 files changed, 17 insertions, 4 deletions
diff --git a/awkgram.y b/awkgram.y
index 2307c362..0b3a97c9 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -73,7 +73,6 @@ static INSTRUCTION *mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op)
static INSTRUCTION *mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op);
static INSTRUCTION *mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op);
static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, int redirtype);
-static NODE *make_regnode(int type, NODE *exp);
static int count_expressions(INSTRUCTION **list, bool isarg);
static INSTRUCTION *optimize_assignment(INSTRUCTION *exp);
static void add_lint(INSTRUCTION *list, LINTTYPE linttype);
@@ -4477,7 +4476,7 @@ variable(int location, char *name, NODETYPE type)
/* make_regnode --- make a regular expression node */
-static NODE *
+NODE *
make_regnode(int type, NODE *exp)
{
NODE *n;
@@ -5630,13 +5629,26 @@ lookup_builtin(const char *name)
{
int mid = check_special(name);
- if (mid == -1 || tokentab[mid].class != LEX_BUILTIN)
+ if (mid == -1)
return NULL;
+
+ switch (tokentab[mid].class) {
+ case LEX_BUILTIN:
+ case LEX_LENGTH:
+ break;
+ default:
+ return NULL;
+ }
+
#ifdef HAVE_MPFR
if (do_mpfr)
return tokentab[mid].ptr2;
#endif
+ /* And another special case... */
+ if (tokentab[mid].value == Op_sub_builtin)
+ return (builtin_func_t) do_sub;
+
return tokentab[mid].ptr;
}
@@ -5649,7 +5661,8 @@ install_builtins(void)
j = sizeof(tokentab) / sizeof(tokentab[0]);
for (i = 0; i < j; i++) {
- if ( tokentab[i].class == LEX_BUILTIN
+ if ( (tokentab[i].class == LEX_BUILTIN
+ || tokentab[i].class == LEX_LENGTH)
&& (tokentab[i].flags & DEBUG_USE) == 0) {
(void) install_symbol(tokentab[i].operator, Node_builtin_func);
}