Still need something in expr.xml (incl an example or two)

On Tue, Oct 3, 2017 at 9:45 AM,  <yla...@apache.org> wrote:
> Author: ylavic
> Date: Tue Oct  3 13:45:34 2017
> New Revision: 1811010
>
> URL: http://svn.apache.org/viewvc?rev=1811010&view=rev
> Log:
> ap_expr: follow up to r1810605.
>
> Better token/type descriptors for better parsing error messages.
>
>
> Modified:
>     httpd/httpd/trunk/server/util_expr_parse.c
>     httpd/httpd/trunk/server/util_expr_parse.y
>
> Modified: httpd/httpd/trunk/server/util_expr_parse.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_parse.c?rev=1811010&r1=1811009&r2=1811010&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/util_expr_parse.c (original)
> +++ httpd/httpd/trunk/server/util_expr_parse.c Tue Oct  3 13:45:34 2017
> @@ -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
>
> Modified: httpd/httpd/trunk/server/util_expr_parse.y
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_parse.y?rev=1811010&r1=1811009&r2=1811010&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/util_expr_parse.y (original)
> +++ httpd/httpd/trunk/server/util_expr_parse.y Tue Oct  3 13:45:34 2017
> @@ -48,14 +48,14 @@
>
>  %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"
> @@ -103,15 +103,15 @@
>  %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
>            | 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; }
>            ;
>
>



-- 
Eric Covener
cove...@gmail.com

Reply via email to