debuggers.hg

view tools/libxl/libxlu_cfg_y.y @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents 71af69a9d393
children
line source
1 /* -*- fundamental -*- */
3 %{
4 #define YYLEX_PARAM ctx->scanner
5 #include "libxlu_cfg_i.h"
6 #include "libxlu_cfg_l.h"
7 %}
9 %union {
10 char *string;
11 XLU_ConfigSetting *setting;
12 }
14 %locations
15 %pure-parser
16 %defines
17 %error-verbose
18 %name-prefix="xlu__cfg_yy"
19 %parse-param { CfgParseContext *ctx }
20 %lex-param { void *scanner }
22 %token <string> IDENT STRING NUMBER NEWLINE
23 %type <string> atom
24 %destructor { free($$); } atom IDENT STRING NUMBER
26 %type <setting> value valuelist values
27 %destructor { xlu__cfg_set_free($$); } value valuelist values
29 %%
31 file: /* empty */
32 | file setting
34 setting: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
35 endstmt
36 | endstmt
37 | error NEWLINE
39 endstmt: NEWLINE
40 | ';'
42 value: atom { $$= xlu__cfg_set_mk(ctx,1,$1); }
43 | '[' nlok valuelist ']' { $$= $3; }
45 atom: STRING { $$= $1; }
46 | NUMBER { $$= $1; }
48 valuelist: /* empty */ { $$= xlu__cfg_set_mk(ctx,0,0); }
49 | values { $$= $1; }
50 | values ',' nlok { $$= $1; }
52 values: atom nlok { $$= xlu__cfg_set_mk(ctx,2,$1); }
53 | values ',' nlok atom nlok { xlu__cfg_set_add(ctx,$1,$4); $$= $1; }
55 nlok:
56 /* nothing */
57 | nlok NEWLINE