]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
ap_expr: follow up to r1810605.
authorYann Ylavic <ylavic@apache.org>
Tue, 3 Oct 2017 13:45:34 +0000 (13:45 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 3 Oct 2017 13:45:34 +0000 (13:45 +0000)
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

server/util_expr_parse.c
server/util_expr_parse.y

index 27b45dc33634c6fefa9331d904dcecdf43600883..003bf94c21c94c7f3bf07907daf62f7be815f71a 100644 (file)
@@ -551,11 +551,12 @@ static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "\"true\"", "\"false\"",
   "\"boolean expression\"", "\"string expression\"", "\"error token\"",
-  "\"number\"", "\"identifier\"", "\"string\"", "\"match regex\"",
-  "\"substitution regex\"", "\"match pattern of the regex\"",
-  "\"substitution pattern of the regex\"", "\"flags of the regex\"",
-  "\"regex back reference\"", "\"unary operator\"", "\"binary operator\"",
-  "\"start of string\"", "\"end of string\"", "\"start of variable name\"",
+  "\"number\"", "\"identifier\"", "\"string literal\"",
+  "\"matching regex\"", "\"substitution regex\"",
+  "\"pattern of the regex\"", "\"replacement of the regex\"",
+  "\"pattern flags of the regex\"", "\"capture reference in the regex\"",
+  "\"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 expression\"", "\"integer equal\"",
   "\"integer not equal\"", "\"integer less than\"",
@@ -567,14 +568,12 @@ static const char *const yytname[] =
   "\"string concatenation\"", "\"split operator\"", "\"join operator\"",
   "\"logical or\"", "\"logical and\"", "\"logical not\"", "\"condition\"",
   "\"comparison\"", "\"string function\"", "\"list function\"",
-  "\"list of words\"", "\"tuple of words\"", "\"word expression\"",
-  "\"any string expression\"", "\"variable expression\"",
-  "\"regular expression match\"", "\"regular expression substitution\"",
-  "\"regular expression split\"", "\"any regular expression\"",
-  "\"regular expression back reference\"", "'('", "')'", "'{'", "'}'",
-  "','", "':'", "$accept", "root", "cond", "comp", "wordlist", "words",
-  "string", "strany", "var", "word", "regex", "regsub", "regsplit",
-  "regany", "regref", "lstfunc", "strfunc", YY_NULL
+  "\"list of words\"", "\"tuple of words\"", "\"word\"", "\"string\"",
+  "\"substring\"", "\"variable\"", "\"regex substitution\"",
+  "\"regex split\"", "\"regex any\"", "\"regex capture reference\"", "'('",
+  "')'", "'{'", "'}'", "','", "':'", "$accept", "root", "cond", "comp",
+  "wordlist", "words", "string", "substr", "var", "word", "regex",
+  "regsub", "regsplit", "regany", "regref", "lstfunc", "strfunc", YY_NULL
 };
 #endif
 
@@ -2023,7 +2022,7 @@ yyreduce:
 
 
 /* Line 1787 of yacc.c  */
-#line 2027 "util_expr_parse.c"
+#line 2026 "util_expr_parse.c"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
index ce1d6188dff205000d6c07a6767d9136943735b1..84eb054e6f40fa14bdc8a5103acf52e4ecaecc5c 100644 (file)
 
 %token  <cpVal> T_DIGIT             "number"
 %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  <cpVal> T_REG_MATCH         "match pattern of the regex"
-%token  <cpVal> T_REG_SUBST         "substitution pattern of the regex"
-%token  <cpVal> T_REG_FLAGS         "flags of the regex"
-%token  <num>   T_REG_REF           "regex back reference"
+%token  <cpVal> T_REG_MATCH         "pattern of the regex"
+%token  <cpVal> T_REG_SUBST         "replacement of the regex"
+%token  <cpVal> T_REG_FLAGS         "pattern flags of the regex"
+%token  <num>   T_REG_REF           "capture reference in the regex"
 
 %token  <cpVal> T_OP_UNARY          "unary operator"
 %token  <cpVal> T_OP_BINARY         "binary operator"
 %type   <exVal>   lstfunc           "list function"
 %type   <exVal>   wordlist          "list of words"
 %type   <exVal>   words             "tuple of words"
-%type   <exVal>   word              "word expression"
-%type   <exVal>   string            "string expression"
-%type   <exVal>   strany            "any string expression"
-%type   <exVal>   var               "variable expression"
-%type   <exVal>   regex             "regular expression match"
-%type   <exVal>   regsub            "regular expression substitution"
-%type   <exVal>   regsplit          "regular expression split"
-%type   <exVal>   regany            "any regular expression"
-%type   <exVal>   regref            "regular expression back reference"
+%type   <exVal>   word              "word"
+%type   <exVal>   string            "string"
+%type   <exVal>   substr            "substring"
+%type   <exVal>   var               "variable"
+%type   <exVal>   regex             "regex match"
+%type   <exVal>   regsub            "regex substitution"
+%type   <exVal>   regsplit          "regex split"
+%type   <exVal>   regany            "regex any"
+%type   <exVal>   regref            "regex capture reference"
 
 %{
 #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); }
           ;
 
-string    : strany                       { $$ = $1; }
-          | string strany                { $$ = ap_expr_concat_make($1, $2, ctx); }
+string    : substr                       { $$ = $1; }
+          | string substr                { $$ = ap_expr_concat_make($1, $2, ctx); }
           | 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; }
           | regref                       { $$ = $1; }
           ;