From d56f19c7d138ff644f33fdafe7dc89a46face82e Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Mon, 8 Aug 2005 16:34:49 +0000 Subject: [PATCH] checked | to 'else' (merged [316]) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@524 152afb58-edef-0310-8abb-c4023f1b3aa9 --- doc/configuration.txt | 4 ++-- src/configfile.c | 13 +++++-------- src/configparser.y | 2 +- tests/condition.conf | 6 +++--- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 017c0d11..66194973 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -75,8 +75,8 @@ Most options can be configured conditionally by using the following syntax ... nesting: match only when parent match } } - | { - ... else if + else { + ... the "else if" block } where is one of one of the following: diff --git a/src/configfile.c b/src/configfile.c index 747e14df..012e4bfa 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -654,12 +654,6 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * } break; - case '|': - t->offset++; - tid = TK_OR; - buffer_copy_string(token, "|"); - break; - case '{': t->offset++; @@ -753,6 +747,8 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * if (strcmp(token->ptr, "include") == 0) { tid = TK_INCLUDE; + } else if (strcmp(token->ptr, "else") == 0) { + tid = TK_ELSE; } else { tid = TK_LKEY; } @@ -775,9 +771,10 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * if (tid) { *token_id = tid; #if 0 - log_error_write(srv, __FILE__, __LINE__, "sbsdsdb", + log_error_write(srv, __FILE__, __LINE__, "sbsdsdbdd", "file:", t->file, - "line:", t->line, "pos:", t->line_pos, token); + "line:", t->line, "pos:", t->line_pos, + token, token->used - 1, tid); #endif return 1; diff --git a/src/configparser.y b/src/configparser.y index 854527b5..57ede869 100644 --- a/src/configparser.y +++ b/src/configparser.y @@ -268,7 +268,7 @@ aelement(A) ::= STRING(B) ARRAY_ASSIGN expression(C). { eols ::= EOL. eols ::= . -condlines(A) ::= condlines(B) eols OR condline(C). { +condlines(A) ::= condlines(B) eols ELSE condline(C). { assert(B->context_ndx < C->context_ndx); C->prev = B; B->next = C; diff --git a/tests/condition.conf b/tests/condition.conf index 7e34e493..67eaeaf2 100644 --- a/tests/condition.conf +++ b/tests/condition.conf @@ -33,13 +33,13 @@ $HTTP["host"] == "www.example.org" { server.name = "www.example.org" url.redirect = ("^" => "/match_1") } -| $HTTP["host"] == "test1.example.org" { +else $HTTP["host"] == "test1.example.org" { server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" server.name = "test1.example.org" url.redirect = ("^" => "/match_2") } # comments -| $HTTP["host"] == "test2.example.org" { +else $HTTP["host"] == "test2.example.org" { server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" server.name = "test2.example.org" url.redirect = ("^" => "/match_3") @@ -47,7 +47,7 @@ $HTTP["host"] == "www.example.org" { # comments -| $HTTP["host"] == "test3.example.org" { +else $HTTP["host"] == "test3.example.org" { server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/" server.name = "test3.example.org" url.redirect = ("^" => "/match_4")