5 #include "matcher_parser_lex.h"
6 #include "matcher_parser_parse.h"
8 #define MAX_STR_CONST 512
11 char string_buf[MAX_STR_CONST];
12 char * string_buf_ptr;
14 static void add_char(char ch)
16 if (string_buf_ptr - string_buf < sizeof(string_buf))
17 *string_buf_ptr++ = ch;
21 /* this function will reinitializes the parser */
23 void matcher_parser_init(void)
29 %option prefix="matcher_parser"
30 %option outfile="lex.yy.c"
39 * a keyword consists of alpha and underscore
40 * characters, possibly preceded by a tilde (~)
46 if (-1 == (id = get_matchparser_tab_id(yytext))) {
52 "\n" return MATCHER_EOL;
53 "&" return MATCHER_AND;
54 "|" return MATCHER_OR;
57 string_buf_ptr = string_buf;
59 /* alfons - OK, the new attempt is to just swallow
60 * *EVERYTHING* and make sure everything is escaped
61 * when actually performing things. */
63 /* take care of escaped \" because this means the
64 * quote char should be skipped */
69 /* get out of the state: string ends. */
71 *string_buf_ptr = '\0';
72 yylval.str = string_buf;
73 return MATCHER_STRING;
75 /* put everything else in the output. */
81 yylval.str = yytext + 1;
82 yytext[strlen(yytext) - 1] = '\0';
83 return MATCHER_SECTION;
87 return MATCHER_INTEGER;