diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | awkgram.c | 18 | ||||
-rw-r--r-- | awkgram.y | 26 |
3 files changed, 26 insertions, 23 deletions
@@ -1,3 +1,7 @@ +2015-06-12 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Finish converting "hard" regex to "typed" regex. + 2015-05-31 Arnold D. Robbins <arnold@skeeve.com> * field.c (posix_def_parse_field): Removed. It's no longer @@ -184,7 +188,6 @@ to malloc, test for final amount after all matches done and need to copy in the final part of the original string. - 2015-04-13 Arnold D. Robbins <arnold@skeeve.com> * regcomp.c (analyze): Prevent malloc(0). @@ -245,7 +245,7 @@ extern int yydebug; FILENAME = 261, YNUMBER = 262, YSTRING = 263, - HARD_REGEXP = 264, + TYPED_REGEXP = 264, RELOP = 265, IO_OUT = 266, IO_IN = 267, @@ -300,7 +300,7 @@ extern int yydebug; #define FILENAME 261 #define YNUMBER 262 #define YSTRING 263 -#define HARD_REGEXP 264 +#define TYPED_REGEXP 264 #define RELOP 265 #define IO_OUT 266 #define IO_IN 267 @@ -695,7 +695,7 @@ static const yytype_uint16 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "FUNC_CALL", "NAME", "REGEXP", - "FILENAME", "YNUMBER", "YSTRING", "HARD_REGEXP", "RELOP", "IO_OUT", + "FILENAME", "YNUMBER", "YSTRING", "TYPED_REGEXP", "RELOP", "IO_OUT", "IO_IN", "ASSIGNOP", "ASSIGN", "MATCHOP", "CONCAT_OP", "SUBSCRIPT", "LEX_BEGIN", "LEX_END", "LEX_IF", "LEX_ELSE", "LEX_RETURN", "LEX_DELETE", "LEX_SWITCH", "LEX_CASE", "LEX_DEFAULT", "LEX_WHILE", "LEX_DO", @@ -708,7 +708,7 @@ static const char *const yytname[] = "'!'", "UNARY", "'^'", "'$'", "'('", "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept", "program", "rule", "source", "library", "pattern", "action", "func_name", "lex_builtin", "function_prologue", - "$@1", "regexp", "$@2", "hard_regexp", "a_slash", "statements", + "$@1", "regexp", "$@2", "typed_regexp", "a_slash", "statements", "statement_term", "statement", "non_compound_stmt", "$@3", "simple_stmt", "$@4", "$@5", "opt_simple_stmt", "case_statements", "case_statement", "case_value", "print", "print_expression_list", "output_redir", "$@6", @@ -5695,7 +5695,7 @@ yylex(void) bool inhex = false; bool intlstr = false; AWKNUM d; - bool collecting_hard_regexp = false; + bool collecting_typed_regexp = false; #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) @@ -5817,9 +5817,9 @@ end_regexp: peek); } } - if (collecting_hard_regexp) { - collecting_hard_regexp = false; - lasttok = HARD_REGEXP; + if (collecting_typed_regexp) { + collecting_typed_regexp = false; + lasttok = TYPED_REGEXP; } else lasttok = REGEXP; @@ -5884,7 +5884,7 @@ retry: c = nextc(true); if (c == '/') { want_regexp = true; - collecting_hard_regexp = true; + collecting_typed_regexp = true; goto collect_regexp; } pushback(); @@ -169,7 +169,7 @@ extern double fmod(double x, double y); %} %token FUNC_CALL NAME REGEXP FILENAME -%token YNUMBER YSTRING HARD_REGEXP +%token YNUMBER YSTRING TYPED_REGEXP %token RELOP IO_OUT IO_IN %token ASSIGNOP ASSIGN MATCHOP CONCAT_OP %token SUBSCRIPT @@ -197,7 +197,7 @@ extern double fmod(double x, double y); %left MATCHOP %nonassoc RELOP '<' '>' IO_IN IO_OUT %left CONCAT_OP -%left YSTRING YNUMBER HARD_REGEXP +%left YSTRING YNUMBER TYPED_REGEXP %left '+' '-' %left '*' '/' '%' %right '!' UNARY @@ -498,8 +498,8 @@ regexp } ; -hard_regexp - : HARD_REGEXP +typed_regexp + : TYPED_REGEXP { NODE *n, *exp; char *re; @@ -1221,7 +1221,7 @@ case_value $1->opcode = Op_push; $$ = $1; } - | hard_regexp + | typed_regexp { assert($1->memory->type == Node_typedregex); $1->opcode = Op_push_re; @@ -1411,7 +1411,7 @@ fcall_expression_list fcall_exp : exp { $$ = $1; } - | hard_regexp { $$ = list_create($1); } + | typed_regexp { $$ = list_create($1); } ; /* Expressions, not including the comma operator. */ @@ -1423,7 +1423,7 @@ exp _("regular expression on right of assignment")); $$ = mk_assignment($1, $3, $2); } - | variable ASSIGN hard_regexp %prec ASSIGNOP + | variable ASSIGN typed_regexp %prec ASSIGNOP { $$ = mk_assignment($1, list_create($3), $2); } @@ -1431,7 +1431,7 @@ exp { $$ = mk_boolean($1, $3, $2); } | exp LEX_OR exp { $$ = mk_boolean($1, $3, $2); } - | exp MATCHOP hard_regexp + | exp MATCHOP typed_regexp { if ($1->lasti->opcode == Op_match_rec) warning_ln($2->source_line, @@ -3275,7 +3275,7 @@ yylex(void) bool inhex = false; bool intlstr = false; AWKNUM d; - bool collecting_hard_regexp = false; + bool collecting_typed_regexp = false; #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) @@ -3397,9 +3397,9 @@ end_regexp: peek); } } - if (collecting_hard_regexp) { - collecting_hard_regexp = false; - lasttok = HARD_REGEXP; + if (collecting_typed_regexp) { + collecting_typed_regexp = false; + lasttok = TYPED_REGEXP; } else lasttok = REGEXP; @@ -3464,7 +3464,7 @@ retry: c = nextc(true); if (c == '/') { want_regexp = true; - collecting_hard_regexp = true; + collecting_typed_regexp = true; goto collect_regexp; } pushback(); |