Cleaner handling of meta comments.

This commit is contained in:
Stefano Sanfilippo 2014-11-23 23:22:44 +01:00
parent 0f76a9da53
commit bc69779b67
2 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,7 @@
extern int lineNumber; extern int lineNumber;
extern void yyerror(const char *); extern void yyerror(const char *);
extern void meta(const char *);
%} %}
%option noyywrap %option noyywrap
@ -22,7 +23,7 @@ CHAR [a-zA-Z_]
} }
"#"[^\n]* { "#"[^\n]* {
fprintf(stderr, "META: %s\n", yytext + 1); meta(yytext + 1);
} }
"bituma"[^\n]* {} "bituma"[^\n]* {}

7
main.c
View File

@ -24,6 +24,13 @@ void emit(const char *text, ...) {
va_end(args); va_end(args);
} }
void meta(const char *text) {
while (text != '\0' && *text == ' ') {
text += 1;
}
fprintf(stderr, "META: %s\n", text);
}
int main() { int main() {
#if YYDEBUG #if YYDEBUG
yydebug = 1; yydebug = 1;