diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-01-05 22:04:39 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-01-05 22:04:39 +0100 |
commit | fb59be5d72f86e7bfceb8a40efdf417d0385a829 (patch) | |
tree | 4f07d7c4844a0c796985e6a80f2042feffcb4081 /lexer | |
parent | 3eb450c37eee98bab34c014899b81964b01caee4 (diff) |
Fix file location in parser
Diffstat (limited to 'lexer')
-rw-r--r-- | lexer/theme-lexer.l | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 1dc9bfe3..5ace2d2a 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -1,4 +1,5 @@ %option noyywrap nounput +%option never-interactive %option bison-locations %{ @@ -16,10 +17,11 @@ GQueue *queue = NULL; yylloc->last_column+= yyleng;\ } #define YY_LLOC_START {\ - yylloc->first_line = yylloc->last_line; yylloc->first_column = yylloc->last_column;\ + yylloc->first_line = yylloc->last_line;\ + yylloc->first_column = yylloc->last_column;\ } %} -WHITESPACE [[:space:]] +WHITESPACE [[:blank:]] WORD [[:alnum:]-]+ STRING [[:print:]]+ HEX [[:xdigit:]] @@ -28,7 +30,6 @@ REAL [[:digit:]]+(\.[[:digit:]]+)? PX (px) EM (em) PERCENT (\%) -NEWLINES (\r|\n)+ LS_DASH "dash" LS_SOLID "solid" @@ -46,6 +47,7 @@ if ( queue == NULL ){ queue = g_queue_new ( ); } %} + <*>"//" { int c; while ((c = input()) != EOF){ @@ -211,22 +213,19 @@ if ( queue == NULL ){ yylval->colorval.alpha = 1.0; return T_COLOR; } +<INITIAL><<EOF>> { + g_queue_free ( queue ); + yyterminate(); +} -<*>'\n' { - printf("newlines\n"); +<*>\n { yylloc->last_column = 1; yylloc->last_line ++; }; <*>(\r\n) { - printf("newlines\n"); yylloc->last_column = 1; yylloc->last_line ++; }; - -<INITIAL><<EOF>> { - g_queue_free ( queue ); - yyterminate(); -} <*>. { fprintf(stderr, "Invalid character: '%c'\n", *yytext); yyterminate(); |