summaryrefslogtreecommitdiffstats
path: root/server/util_expr_scan.l
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2011-07-02 09:45:00 +0200
committerStefan Fritsch <sf@apache.org>2011-07-02 09:45:00 +0200
commit46d4791a5dffee2ea94a136a7febd04b76a05013 (patch)
tree7d5057b6a15a7a63dc66844a7f283df800985a7d /server/util_expr_scan.l
parentAdd REQUEST_STATUS variable to ap_expr (diff)
downloadapache2-46d4791a5dffee2ea94a136a7febd04b76a05013.tar.xz
apache2-46d4791a5dffee2ea94a136a7febd04b76a05013.zip
Add string valued expressions to ap_expr, do some API cleanup
- add possibility to have expressions that evaluate to a string and not to a boolean value - modify ap_expr_parse_cmd() interface to support this and make it more convenient to use in general - rename AP_EXPR_FLAGS_* to AP_EXPR_FLAG_* for consistency git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142164 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_expr_scan.l')
-rw-r--r--server/util_expr_scan.l31
1 files changed, 30 insertions, 1 deletions
diff --git a/server/util_expr_scan.l b/server/util_expr_scan.l
index e47c0e4cac..607af14073 100644
--- a/server/util_expr_scan.l
+++ b/server/util_expr_scan.l
@@ -75,6 +75,22 @@
char *regex_ptr = NULL;
char regex_del = '\0';
+%{
+ /*
+ * Set initial state for string expressions
+ */
+ if (yyextra->at_start) {
+ yyextra->at_start = 0;
+ if (yyextra->flags & AP_EXPR_FLAG_STRING_RESULT) {
+ BEGIN(str);
+ return T_EXPR_STRING;
+ }
+ else {
+ return T_EXPR_BOOL;
+ }
+ }
+%}
+
/*
* Whitespaces
*/
@@ -116,9 +132,22 @@
<str,var,vararg>\n {
PERROR("Unterminated string or variable");
}
-<str,var,vararg><<EOF>> {
+<var,vararg><<EOF>> {
PERROR("Unterminated string or variable");
}
+<str><<EOF>> {
+ if (!(yyextra->flags & AP_EXPR_FLAG_STRING_RESULT)) {
+ PERROR("Unterminated string or variable");
+ }
+ else {
+ *str_ptr = '\0';
+ yylval->cpVal = apr_pstrdup(yyextra->pool, str_buf);
+ str_ptr = str_buf;
+ BEGIN(INITIAL);
+ return T_STRING;
+ }
+}
+
<str,vararg>\\[0-7]{1,3} {
int result;