diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-31 22:35:15 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-31 22:35:15 +0300 |
commit | bbeeb351c73fb1ee4ff20c3774e0477e9e8a7513 (patch) | |
tree | 95f926cd9bf02578e9c860726a56441ac00e95b2 /awkgram.c | |
parent | eb53fb0398911202d4361b869eefa6c1449ebec8 (diff) | |
parent | 902b25a40d5cc612dd7a0becb27a5a48afa49716 (diff) | |
download | egawk-bbeeb351c73fb1ee4ff20c3774e0477e9e8a7513.tar.gz egawk-bbeeb351c73fb1ee4ff20c3774e0477e9e8a7513.tar.bz2 egawk-bbeeb351c73fb1ee4ff20c3774e0477e9e8a7513.zip |
Merge branch 'master' into feature/regex-type
Diffstat (limited to 'awkgram.c')
-rw-r--r-- | awkgram.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -113,7 +113,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); @@ -184,6 +183,7 @@ static INSTRUCTION *ip_atexit = NULL; static INSTRUCTION *ip_end; static INSTRUCTION *ip_endfile; static INSTRUCTION *ip_beginfile; +INSTRUCTION *main_beginfile; static INSTRUCTION *comment = NULL; static INSTRUCTION *program_comment = NULL; @@ -4897,7 +4897,7 @@ parse_program(INSTRUCTION **pcode) ip_newfile = ip_rec = ip_atexit = ip_beginfile = ip_endfile = NULL; else { ip_endfile = instruction(Op_no_op); - ip_beginfile = instruction(Op_no_op); + main_beginfile = ip_beginfile = instruction(Op_no_op); ip_rec = instruction(Op_get_record); /* target for `next', also ip_newfile */ ip_newfile = bcalloc(Op_newfile, 2, 0); /* target for `nextfile' */ ip_newfile->target_jmp = ip_end; @@ -7237,7 +7237,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; @@ -8395,13 +8395,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; } @@ -8414,7 +8427,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); } |