summaryrefslogtreecommitdiffstats
path: root/server/util_expr_scan.l
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2010-11-21 18:22:26 +0100
committerStefan Fritsch <sf@apache.org>2010-11-21 18:22:26 +0100
commit6ef1911acc7e848d88e3ff505cc2a018f41cd903 (patch)
tree1e7426949ebbbaabf473b1e173951a73435b3118 /server/util_expr_scan.l
parentFix extra word (diff)
downloadapache2-6ef1911acc7e848d88e3ff505cc2a018f41cd903.tar.xz
apache2-6ef1911acc7e848d88e3ff505cc2a018f41cd903.zip
ap_expr related fixes/enhancements:
- implement regex backreferences and make them available for setting envvars in SetEnvIfExpr - implement nested function calls in %-syntax: %{func1:%{func2:arg}} - actually implement evaluation of concatenation operator (oops...) - Fix <If ... > treating an internal error as success git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_expr_scan.l')
-rw-r--r--server/util_expr_scan.l31
1 files changed, 26 insertions, 5 deletions
diff --git a/server/util_expr_scan.l b/server/util_expr_scan.l
index 05ff3a116b..79bdbc16f9 100644
--- a/server/util_expr_scan.l
+++ b/server/util_expr_scan.l
@@ -142,14 +142,30 @@
*str_ptr++ = yytext[1];
}
-<str,vararg>[^\\\n"'%}]+ {
+ /* regexp backref inside string/arg */
+<str,vararg>[$][0-9] {
+ if (str_ptr != str_buf) {
+ /* return what we have so far and scan '$x' again */
+ *str_ptr = '\0';
+ yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf);
+ str_ptr = str_buf;
+ yyless(0);
+ return T_STRING;
+ }
+ else {
+ yylval->num = yytext[1] - '0';
+ return T_REGEX_BACKREF;
+ }
+}
+
+<str,vararg>[^\\\n"'%}$]+ {
char *cp = yytext;
while (*cp != '\0')
*str_ptr++ = *cp++;
}
- /* variable inside string */
-<str>%\{ {
+ /* variable inside string/arg */
+<str,vararg>%\{ {
if (str_ptr != str_buf) {
/* return what we have so far and scan '%{' again */
*str_ptr = '\0';
@@ -164,11 +180,11 @@
}
}
-<vararg>% {
+<vararg>[%$] {
*str_ptr++ = yytext[0];
}
-<str>[%}] {
+<str>[%}$] {
*str_ptr++ = yytext[0];
}
@@ -177,6 +193,11 @@
return T_VAR_BEGIN;
}
+[$][0-9] {
+ yylval->num = yytext[1] - '0';
+ return T_REGEX_BACKREF;
+}
+
/*
* fixed name variable expansion %{XXX} and function call in %{func:arg} syntax
*/