3 #include "native-parser.h"
4 #include <talloc/talloc.h>
8 void yyerror(struct native_parser *parser, const char *fmt, ...);
11 %option nounput noinput
12 %option batch never-interactive
18 %option noyyalloc noyyfree noyyrealloc
19 %option extra-type="struct native_parser *"
32 name { BEGIN(label); return TOKEN_NAME; }
33 image { BEGIN(label); return TOKEN_IMAGE; }
34 initrd { BEGIN(label); return TOKEN_INITRD; }
35 args { BEGIN(label); return TOKEN_ARGS; }
36 dtb { BEGIN(label); return TOKEN_DTB; }
37 description { BEGIN(label); return TOKEN_DESCRIPTION; }
38 default { BEGIN(label); return TOKEN_DEFAULT; }
39 dev_description { BEGIN(label); return TOKEN_DEV_DESCRIPTION; }
42 <label>{DELIM} { BEGIN(args); return TOKEN_DELIM; }
43 <args>{WORDS} { yylval->word = strdup(yytext); return TOKEN_WORD; }
44 <args>{NEWLINE} { BEGIN(INITIAL); ; }
50 void *yyalloc(size_t bytes, void *yyscanner)
52 struct native_parser *parser = yyget_extra(yyscanner);
53 return talloc_size(parser, bytes);
56 void *yyrealloc(void *ptr, size_t bytes, void *yyscanner)
58 struct native_parser *parser = yyget_extra(yyscanner);
59 return talloc_realloc_size(parser, ptr, bytes);
62 void yyfree(void *ptr, void *yyscanner __attribute__((unused)))