From 4c1392d8ab5e406af31a4616fde2a85fe24743fd Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 22 May 2011 22:15:43 +0200 Subject: [PATCH] retab! cfgparse.l --- src/cfgparse.l | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/cfgparse.l b/src/cfgparse.l index 5a4f47ee..41445944 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -1,13 +1,13 @@ +/* + * vim:ts=4:sw=4:expandtab + * + */ %option nounput %option noinput %option noyy_top_state %option stack %{ -/* - * vim:ts=4:sw=4:expandtab - * - */ #include #include #include @@ -25,9 +25,9 @@ int yycolumn = 1; #define YY_DECL int yylex (struct context *context) #define YY_USER_ACTION { \ - context->first_column = yycolumn; \ - context->last_column = yycolumn+yyleng-1; \ - yycolumn += yyleng; \ + context->first_column = yycolumn; \ + context->last_column = yycolumn+yyleng-1; \ + yycolumn += yyleng; \ } /* macro to first eat whitespace, then expect a string */ @@ -38,7 +38,7 @@ int yycolumn = 1; %} -EOL (\r?\n) +EOL (\r?\n) %s WANT_STRING %s WANT_QSTRING @@ -52,24 +52,24 @@ EOL (\r?\n) %% - { - /* This is called when a new line is lexed. We only want the - * first line to match to go into state BUFFER_LINE */ - if (context->line_number == 0) { - context->line_number = 1; - BEGIN(INITIAL); - yy_push_state(BUFFER_LINE); - } - } + { + /* This is called when a new line is lexed. We only want the + * first line to match to go into state BUFFER_LINE */ + if (context->line_number == 0) { + context->line_number = 1; + BEGIN(INITIAL); + yy_push_state(BUFFER_LINE); + } + } ^[^\r\n]*/{EOL}? { - /* save whole line */ - context->line_copy = sstrdup(yytext); + /* save whole line */ + context->line_copy = sstrdup(yytext); - yyless(0); - yy_pop_state(); - yy_set_bol(true); - yycolumn = 1; + yyless(0); + yy_pop_state(); + yy_set_bol(true); + yycolumn = 1; } @@ -84,7 +84,7 @@ EOL (\r?\n) return STR; } [^\n]+ { BEGIN(INITIAL); yylval.string = sstrdup(yytext); return STR; } -[a-zA-Z0-9_-]+ { yylval.string = sstrdup(yytext); return OUTPUT; } +[a-zA-Z0-9_-]+ { yylval.string = sstrdup(yytext); return OUTPUT; } ^[ \t]*#[^\n]* { return TOKCOMMENT; } [0-9a-fA-F]+ { yylval.string = sstrdup(yytext); return HEX; } [0-9]+ { yylval.number = atoi(yytext); return NUMBER; } @@ -174,8 +174,8 @@ title { yy_push_state(WANT_QSTRING); return TOK_TITLE; BEGIN(INITIAL); yy_push_state(BUFFER_LINE); } -[ \t]+ { BEGIN(WANT_STRING); } -[ \t]+ { BEGIN(WANT_STRING); } +[ \t]+ { BEGIN(WANT_STRING); } +[ \t]+ { BEGIN(WANT_STRING); } [ \t]+ { /* ignore whitespace */ ; } \"[^\"]+\" { /* if ASSIGN_COND then */ @@ -187,14 +187,14 @@ title { yy_push_state(WANT_QSTRING); return TOK_TITLE; return QUOTEDSTRING; } [^ \t]+ { BEGIN(INITIAL); yylval.string = sstrdup(yytext); return STR_NG; } -[a-zA-Z0-9_]+ { yylval.string = sstrdup(yytext); return WORD; } +[a-zA-Z0-9_]+ { yylval.string = sstrdup(yytext); return WORD; } [a-zA-Z]+ { yylval.string = sstrdup(yytext); return WORD; } . { return (int)yytext[0]; } <> { - while (yy_start_stack_ptr > 0) - yy_pop_state(); - yyterminate(); + while (yy_start_stack_ptr > 0) + yy_pop_state(); + yyterminate(); } %% -- 2.39.5