15 #include "cfgparse.tab.h"
25 /* These are the same as in YYLTYPE */
31 #define YY_DECL int yylex (struct context *context)
33 #define YY_USER_ACTION { \
34 context->first_column = yycolumn; \
35 context->last_column = yycolumn+yyleng-1; \
51 /* This is called when a new line is lexed. We only want the
52 * first line to match to go into state BUFFER_LINE */
53 if (context->line_number == 0) {
54 context->line_number = 1;
56 yy_push_state(BUFFER_LINE);
60 <BUFFER_LINE>^[^\r\n]*/{EOL}? {
62 context->line_copy = strdup(yytext);
71 <BIND_A2WS_COND>[^\n]+ { BEGIN(INITIAL); yylval.string = strdup(yytext); return STR; }
72 [0-9]+ { yylval.number = atoi(yytext); return NUMBER; }
73 bind { BEGIN(BINDCODE_COND); return TOKBINDCODE; }
74 bindcode { BEGIN(BINDCODE_COND); return TOKBINDCODE; }
75 Mod1 { yylval.number = (1 << 3); return MODIFIER; }
76 Mod2 { yylval.number = (1 << 4); return MODIFIER; }
77 Mod3 { yylval.number = (1 << 5); return MODIFIER; }
78 Mod4 { yylval.number = (1 << 6); return MODIFIER; }
79 Mod5 { yylval.number = (1 << 7); return MODIFIER; }
80 Mode_switch { yylval.number = (1 << 8); return MODIFIER; }
81 $mod { yylval.number = (1 << 9); return TOKMODVAR; }
82 control { return TOKCONTROL; }
83 ctrl { return TOKCONTROL; }
84 shift { return TOKSHIFT; }
86 if (context->line_copy) {
87 free(context->line_copy);
88 context->line_copy = NULL;
90 context->line_number++;
92 yy_push_state(BUFFER_LINE);
94 <BINDCODE_COND>[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; }
95 <BIND_AWS_COND>[ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; }
96 [ \t]+ { return WHITESPACE; }
97 . { return (int)yytext[0]; }
100 while (yy_start_stack_ptr > 0)