From: Florian Forster Date: Wed, 7 Feb 2007 14:09:44 +0000 (+0100) Subject: Renamed src/parser.lex -> src/parser.l. X-Git-Tag: liboconfig-0.1.0~8 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8d61bc461d8acc2dc2df8837ba5e7b34eda58522;p=liboconfig.git Renamed src/parser.lex -> src/parser.l. --- diff --git a/src/parser.l b/src/parser.l new file mode 100644 index 0000000..1d23805 --- /dev/null +++ b/src/parser.l @@ -0,0 +1,29 @@ +WHITE_SPACE [\ \t\b] +ALNUM [A-Za-z0-9_] +QUOTED_STRING \"([^\"]+|\\.)*\" +UNQUOTED_STRING {ALNUM}+ +HEX_NUMBER 0[xX][0-9a-fA-F]+ +OCT_NUMBER 0[0-7]+ +DEC_NUMBER [\+\-]?[0-9]+ +FLOAT_NUMBER [\+\-]?[0-9]*\.[0-9]+([eE][\+\-][0-9]+)? +NUMBER ({FLOAT_NUMBER}|{HEX_NUMBER}|{OCT_NUMBER}|{DEC_NUMBER}) +BOOL_TRUE (true|yes|on) +BOOL_FALSE (false|no|off) +COMMENT #.* + +%% +{WHITE_SPACE} | +{COMMENT} {/* nothing */} + +\n {return (EOL);} +"/" {return (SLASH);} +"<" {return (OPENBRAC);} +">" {return (CLOSEBRAC);} +{NUMBER} {yylval.number = strtod (yytext, NULL); return (NUMBER);} +{BOOL_TRUE} {yylval.boolean = 1; return (TRUE);} +{BOOL_FALSE} {yylval.boolean = 0; return (FALSE);} + +{QUOTED_STRING} {yylval.string = yytext; return (QUOTED_STRING);} +{UNQUOTED_STRING} {yylval.string = yytext; return (UNQUOTED_STRING);} + +%% diff --git a/src/parser.lex b/src/parser.lex deleted file mode 100644 index 1d23805..0000000 --- a/src/parser.lex +++ /dev/null @@ -1,29 +0,0 @@ -WHITE_SPACE [\ \t\b] -ALNUM [A-Za-z0-9_] -QUOTED_STRING \"([^\"]+|\\.)*\" -UNQUOTED_STRING {ALNUM}+ -HEX_NUMBER 0[xX][0-9a-fA-F]+ -OCT_NUMBER 0[0-7]+ -DEC_NUMBER [\+\-]?[0-9]+ -FLOAT_NUMBER [\+\-]?[0-9]*\.[0-9]+([eE][\+\-][0-9]+)? -NUMBER ({FLOAT_NUMBER}|{HEX_NUMBER}|{OCT_NUMBER}|{DEC_NUMBER}) -BOOL_TRUE (true|yes|on) -BOOL_FALSE (false|no|off) -COMMENT #.* - -%% -{WHITE_SPACE} | -{COMMENT} {/* nothing */} - -\n {return (EOL);} -"/" {return (SLASH);} -"<" {return (OPENBRAC);} -">" {return (CLOSEBRAC);} -{NUMBER} {yylval.number = strtod (yytext, NULL); return (NUMBER);} -{BOOL_TRUE} {yylval.boolean = 1; return (TRUE);} -{BOOL_FALSE} {yylval.boolean = 0; return (FALSE);} - -{QUOTED_STRING} {yylval.string = yytext; return (QUOTED_STRING);} -{UNQUOTED_STRING} {yylval.string = yytext; return (UNQUOTED_STRING);} - -%%