summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2003-06-26 18:16:09 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2003-06-26 18:16:09 +0000
commitdb142b6e234702a39c49b978d2040a780e873091 (patch)
treeb6dfbcab46d74a832b5ff1a32bf227ac9c5aded8
parent2736a19518f589f2f5d9ae5f6a7e95b561cd112b (diff)
downloadtinyproxy-db142b6e234702a39c49b978d2040a780e873091.tar.gz
tinyproxy-db142b6e234702a39c49b978d2040a780e873091.zip
Modified the patterns to allow the new upstream directives to work as
defined in the tinyproxy.conf documentation.
Diffstat (limited to '')
-rw-r--r--src/scanner.l23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/scanner.l b/src/scanner.l
index d1664a8..738ac32 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -1,4 +1,4 @@
-/* $Id: scanner.l,v 1.20 2003-06-20 17:02:13 rjkaes Exp $
+/* $Id: scanner.l,v 1.21 2003-06-26 18:16:09 rjkaes Exp $
*
* This builds the scanner for the tinyproxy configuration file. This
* file needs to stay in sync with grammar.y. If someone knows lex and yacc
@@ -81,17 +81,22 @@ static struct keyword keywords[] = {
#define MAX_REGEXP_LEN 1024
-unsigned int scanner_lineno = 1;
-
char tiny_buf[MAX_REGEXP_LEN];
char *tiny_str;
static int check_reserved_words(char *token);
static void append_string(int length, char *str);
static void append_char(char c);
+
+#ifdef NDEBUG
+/* Turn off debugging if this is a production build. */
+yy_flex_debug = 0;
+#endif
+
+
%}
-%option noyywrap
+%option noyywrap batch yylineno debug
white [ \t]
digit [0-9]
@@ -104,14 +109,15 @@ word [^ \#'"\(\)\{\}\\;\n\t,|\.]
%%
\#.*$ ;
-\n { ++scanner_lineno; return '\n'; }
-: { return ':'; }
+\n { return '\n'; }
+":" { return ':'; }
{white}+ ;
0x{digit}+ { yylval.num = strtol(yytext, NULL, 16); return NUMBER; }
0{digit}+ { yylval.num = strtol(yytext, NULL, 8); return NUMBER; }
{digit}+ { yylval.num = atoi(yytext); return NUMBER; }
-{alpha}+ { return check_reserved_words(yytext); }
-\" {
+{alpha}({alphanum}|[-._])+ { return check_reserved_words(yytext); }
+
+\" {
tiny_str = tiny_buf;
BEGIN(string);
}
@@ -131,7 +137,6 @@ word [^ \#'"\(\)\{\}\\;\n\t,|\.]
({digit}{1,3}\.){3}{digit}{1,3} { yylval.cptr = strdup(yytext); return NUMERIC_ADDRESS; }
({digit}{1,3}\.){3}{digit}{1,3}\/{digit}+ { yylval.cptr = strdup(yytext); return NETMASK_ADDRESS; }
-([-_a-z0-9]+\.)+[a-z]+ { yylval.cptr = strdup(yytext); return STRING_ADDRESS; }
%%