97 |
/* Define the tokens together with their human representation. */ |
/* Define the tokens together with their human representation. */ |
98 |
%token GRAM_EOF 0 "end of file" |
%token GRAM_EOF 0 "end of file" |
99 |
%token STRING "string" |
%token STRING "string" |
|
%token CHARACTER "character" |
|
100 |
%token INT "integer" |
%token INT "integer" |
101 |
|
|
102 |
%token PERCENT_TOKEN "%token" |
%token PERCENT_TOKEN "%token" |
156 |
%token BRACED_CODE "{...}" |
%token BRACED_CODE "{...}" |
157 |
|
|
158 |
|
|
159 |
%type <string> CHARACTER TYPE STRING string_content |
%type <string> TYPE STRING string_content |
160 |
BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action |
BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action |
161 |
%type <integer> INT |
%type <integer> INT |
162 |
%type <symbol> ID symbol string_as_id |
%type <symbol> ID symbol string_as_id |
284 |
; |
; |
285 |
|
|
286 |
type.opt: |
type.opt: |
287 |
/* Nothing. */ { current_type = NULL;} |
/* Nothing. */ { current_type = NULL; } |
288 |
| TYPE { current_type = $1; } |
| TYPE { current_type = $1; } |
289 |
; |
; |
290 |
|
|
389 |
symbol: |
symbol: |
390 |
ID { $$ = $1; } |
ID { $$ = $1; } |
391 |
| string_as_id { $$ = $1; } |
| string_as_id { $$ = $1; } |
|
| CHARACTER { $$ = symbol_get ($1, @1); } |
|
392 |
; |
; |
393 |
|
|
394 |
action: |
action: |
441 |
fputc (' ', file); |
fputc (' ', file); |
442 |
switch (type) |
switch (type) |
443 |
{ |
{ |
|
case CHARACTER: |
|
|
fprintf (file, " = '%s'", value->string); |
|
|
break; |
|
|
|
|
444 |
case ID: |
case ID: |
445 |
fprintf (file, " = %s", value->symbol->tag); |
fprintf (file, " = %s", value->symbol->tag); |
446 |
break; |
break; |