80 |
static int braces_level = 0; |
static int braces_level = 0; |
81 |
static int percent_percent_count = 0; |
static int percent_percent_count = 0; |
82 |
|
|
83 |
static void handle_dollar PARAMS ((char *cp, location_t location)); |
static void handle_action_dollar PARAMS ((char *cp, location_t location)); |
84 |
|
static void handle_destructor_dollar PARAMS ((char *cp, location_t location)); |
85 |
static void handle_at PARAMS ((char *cp)); |
static void handle_at PARAMS ((char *cp)); |
86 |
|
|
87 |
%} |
%} |
123 |
"%debug" return PERCENT_DEBUG; |
"%debug" return PERCENT_DEBUG; |
124 |
"%define" return PERCENT_DEFINE; |
"%define" return PERCENT_DEFINE; |
125 |
"%defines" return PERCENT_DEFINES; |
"%defines" return PERCENT_DEFINES; |
126 |
|
"%destructor" return PERCENT_DESTRUCTOR; |
127 |
"%error"[-_]"verbose" return PERCENT_ERROR_VERBOSE; |
"%error"[-_]"verbose" return PERCENT_ERROR_VERBOSE; |
128 |
"%expect" return PERCENT_EXPECT; |
"%expect" return PERCENT_EXPECT; |
129 |
"%file-prefix" return PERCENT_FILE_PREFIX; |
"%file-prefix" return PERCENT_FILE_PREFIX; |
443 |
|
|
444 |
"{" YY_OBS_GROW; braces_level++; |
"{" YY_OBS_GROW; braces_level++; |
445 |
|
|
446 |
"$"("<"[^>]+">")?(-?[0-9]+|"$") { handle_dollar (yytext, *yylloc); } |
"$"("<"[^>]+">")?(-?[0-9]+|"$") { |
447 |
"@"(-?[0-9]+|"$") { handle_at (yytext); } |
switch (current_braced_code) |
448 |
|
{ |
449 |
|
case action_braced_code: |
450 |
|
handle_action_dollar (yytext, *yylloc); |
451 |
|
break; |
452 |
|
|
453 |
|
case destructor_braced_code: |
454 |
|
handle_destructor_dollar (yytext, *yylloc); |
455 |
|
break; |
456 |
|
} |
457 |
|
} |
458 |
|
"@"(-?[0-9]+|"$") { handle_at (yytext); } |
459 |
|
|
460 |
[^$@\[\]/\'\"\{\}\n\r]+ YY_OBS_GROW; |
[^$@\[\]/\'\"\{\}\n\r]+ YY_OBS_GROW; |
461 |
{eols} YY_OBS_GROW; YY_LINES; |
{eols} YY_OBS_GROW; YY_LINES; |
533 |
`------------------------------------------------------------------*/ |
`------------------------------------------------------------------*/ |
534 |
|
|
535 |
static void |
static void |
536 |
handle_dollar (char *cp, location_t location) |
handle_action_dollar (char *cp, location_t location) |
537 |
{ |
{ |
538 |
const char *type_name = NULL; |
const char *type_name = NULL; |
539 |
|
|
591 |
{ |
{ |
592 |
char buf[] = "$c"; |
char buf[] = "$c"; |
593 |
buf[1] = *cp; |
buf[1] = *cp; |
594 |
complain (_("%s is invalid"), quote (buf)); |
complain_at (location, _("%s is invalid"), quote (buf)); |
595 |
|
} |
596 |
|
} |
597 |
|
|
598 |
|
|
599 |
|
/*---------------------------------------------------------------. |
600 |
|
| CP is pointing to $$ in a destructor. This should probably be | |
601 |
|
| done once the grammar completely parsed, instead of during its | |
602 |
|
| parsing, since that means %type must be specified before | |
603 |
|
| %destructor. | |
604 |
|
`---------------------------------------------------------------*/ |
605 |
|
|
606 |
|
static void |
607 |
|
handle_destructor_dollar (char *cp, location_t location) |
608 |
|
{ |
609 |
|
++cp; |
610 |
|
if (*cp == '$') |
611 |
|
{ |
612 |
|
/* FIXME: We should find something more robust. */ |
613 |
|
obstack_sgrow (&string_obstack, "b4_dollar_dollar"); |
614 |
|
} |
615 |
|
else |
616 |
|
{ |
617 |
|
char buf[] = "$c"; |
618 |
|
buf[1] = *cp; |
619 |
|
complain_at (location, _("%s is invalid"), quote (buf)); |
620 |
} |
} |
621 |
} |
} |
622 |
|
|