1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-01 07:26:57 +03:00

ap_expr: follow up to r1810605.

Better token/type descriptors for better parsing error messages.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1811010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2017-10-03 13:45:34 +00:00
parent a328d8facc
commit c0954b0bd4
2 changed files with 31 additions and 32 deletions

View File

@ -551,11 +551,12 @@ static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "\"true\"", "\"false\"", "$end", "error", "$undefined", "\"true\"", "\"false\"",
"\"boolean expression\"", "\"string expression\"", "\"error token\"", "\"boolean expression\"", "\"string expression\"", "\"error token\"",
"\"number\"", "\"identifier\"", "\"string\"", "\"match regex\"", "\"number\"", "\"identifier\"", "\"string literal\"",
"\"substitution regex\"", "\"match pattern of the regex\"", "\"matching regex\"", "\"substitution regex\"",
"\"substitution pattern of the regex\"", "\"flags of the regex\"", "\"pattern of the regex\"", "\"replacement of the regex\"",
"\"regex back reference\"", "\"unary operator\"", "\"binary operator\"", "\"pattern flags of the regex\"", "\"capture reference in the regex\"",
"\"start of string\"", "\"end of string\"", "\"start of variable name\"", "\"unary operator\"", "\"binary operator\"", "\"start of string\"",
"\"end of string\"", "\"start of variable name\"",
"\"end of variable name\"", "\"start of variable expression\"", "\"end of variable name\"", "\"start of variable expression\"",
"\"end of variable expression\"", "\"integer equal\"", "\"end of variable expression\"", "\"integer equal\"",
"\"integer not equal\"", "\"integer less than\"", "\"integer not equal\"", "\"integer less than\"",
@ -567,14 +568,12 @@ static const char *const yytname[] =
"\"string concatenation\"", "\"split operator\"", "\"join operator\"", "\"string concatenation\"", "\"split operator\"", "\"join operator\"",
"\"logical or\"", "\"logical and\"", "\"logical not\"", "\"condition\"", "\"logical or\"", "\"logical and\"", "\"logical not\"", "\"condition\"",
"\"comparison\"", "\"string function\"", "\"list function\"", "\"comparison\"", "\"string function\"", "\"list function\"",
"\"list of words\"", "\"tuple of words\"", "\"word expression\"", "\"list of words\"", "\"tuple of words\"", "\"word\"", "\"string\"",
"\"any string expression\"", "\"variable expression\"", "\"substring\"", "\"variable\"", "\"regex substitution\"",
"\"regular expression match\"", "\"regular expression substitution\"", "\"regex split\"", "\"regex any\"", "\"regex capture reference\"", "'('",
"\"regular expression split\"", "\"any regular expression\"", "')'", "'{'", "'}'", "','", "':'", "$accept", "root", "cond", "comp",
"\"regular expression back reference\"", "'('", "')'", "'{'", "'}'", "wordlist", "words", "string", "substr", "var", "word", "regex",
"','", "':'", "$accept", "root", "cond", "comp", "wordlist", "words", "regsub", "regsplit", "regany", "regref", "lstfunc", "strfunc", YY_NULL
"string", "strany", "var", "word", "regex", "regsub", "regsplit",
"regany", "regref", "lstfunc", "strfunc", YY_NULL
}; };
#endif #endif
@ -2023,7 +2022,7 @@ yyreduce:
/* Line 1787 of yacc.c */ /* Line 1787 of yacc.c */
#line 2027 "util_expr_parse.c" #line 2026 "util_expr_parse.c"
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires

View File

@ -48,14 +48,14 @@
%token <cpVal> T_DIGIT "number" %token <cpVal> T_DIGIT "number"
%token <cpVal> T_ID "identifier" %token <cpVal> T_ID "identifier"
%token <cpVal> T_STRING "string" %token <cpVal> T_STRING "string literal"
%token T_REGEX "match regex" %token T_REGEX "matching regex"
%token T_REGSUB "substitution regex" %token T_REGSUB "substitution regex"
%token <cpVal> T_REG_MATCH "match pattern of the regex" %token <cpVal> T_REG_MATCH "pattern of the regex"
%token <cpVal> T_REG_SUBST "substitution pattern of the regex" %token <cpVal> T_REG_SUBST "replacement of the regex"
%token <cpVal> T_REG_FLAGS "flags of the regex" %token <cpVal> T_REG_FLAGS "pattern flags of the regex"
%token <num> T_REG_REF "regex back reference" %token <num> T_REG_REF "capture reference in the regex"
%token <cpVal> T_OP_UNARY "unary operator" %token <cpVal> T_OP_UNARY "unary operator"
%token <cpVal> T_OP_BINARY "binary operator" %token <cpVal> T_OP_BINARY "binary operator"
@ -103,15 +103,15 @@
%type <exVal> lstfunc "list function" %type <exVal> lstfunc "list function"
%type <exVal> wordlist "list of words" %type <exVal> wordlist "list of words"
%type <exVal> words "tuple of words" %type <exVal> words "tuple of words"
%type <exVal> word "word expression" %type <exVal> word "word"
%type <exVal> string "string expression" %type <exVal> string "string"
%type <exVal> strany "any string expression" %type <exVal> substr "substring"
%type <exVal> var "variable expression" %type <exVal> var "variable"
%type <exVal> regex "regular expression match" %type <exVal> regex "regex match"
%type <exVal> regsub "regular expression substitution" %type <exVal> regsub "regex substitution"
%type <exVal> regsplit "regular expression split" %type <exVal> regsplit "regex split"
%type <exVal> regany "any regular expression" %type <exVal> regany "regex any"
%type <exVal> regref "regular expression back reference" %type <exVal> regref "regex capture reference"
%{ %{
#include "util_expr_private.h" #include "util_expr_private.h"
@ -168,12 +168,12 @@ words : word { $$ = ap_expr_make(op_ListElement, $1,
| word ',' words { $$ = ap_expr_make(op_ListElement, $1, $3, ctx); } | word ',' words { $$ = ap_expr_make(op_ListElement, $1, $3, ctx); }
; ;
string : strany { $$ = $1; } string : substr { $$ = $1; }
| string strany { $$ = ap_expr_concat_make($1, $2, ctx); } | string substr { $$ = ap_expr_concat_make($1, $2, ctx); }
| T_ERROR { YYABORT; } | T_ERROR { YYABORT; }
; ;
strany : T_STRING { $$ = ap_expr_make(op_String, $1, NULL, ctx); } substr : T_STRING { $$ = ap_expr_make(op_String, $1, NULL, ctx); }
| var { $$ = $1; } | var { $$ = $1; }
| regref { $$ = $1; } | regref { $$ = $1; }
; ;