#include "grub2.h"
#include "parser.h"
#include <talloc/talloc.h>
+
+void yyerror(struct grub2_parser *parser, const char *fmt, ...);
%}
%option nounput noinput
%x sqstring
%x dqstring
-WORD [^{}|&$;<> \t\n'"]+
+WORD [^{}|&$;<> \t\n'"#]+
VARNAME ([[:alpha:]][_[:alnum:]]*|[0-9]|[\?@\*#])
%%
/* discard leading & trailing whitespace, but keep inter-word delimeters */
^[ \t]+ ;
[ \t]+$ ;
-[ \t]* return TOKEN_DELIM;
+[ \t]+ return TOKEN_DELIM;
/* reserved words */
"[[" return TOKEN_LDSQBRACKET;
[ \t]*(;|\n)[ \t]* return TOKEN_EOL;
/* strip comments */
-#.*$ ;
-
+#.* ;
-. printf("unknown token '%s'\n", yytext); exit(1);
+. {
+ yyerror(yyget_extra(yyscanner), "unknown token '%s'\n", yytext);
+ yyterminate();
+ }
%%