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)); |
static void handle_dollar PARAMS ((char *cp, location_t location)); |
84 |
static void handle_at PARAMS ((char *cp)); |
static void handle_at PARAMS ((char *cp)); |
85 |
|
|
86 |
%} |
%} |
441 |
|
|
442 |
"{" YY_OBS_GROW; braces_level++; |
"{" YY_OBS_GROW; braces_level++; |
443 |
|
|
444 |
"$"("<"[^>]+">")?(-?[0-9]+|"$") { handle_dollar (yytext); } |
"$"("<"[^>]+">")?(-?[0-9]+|"$") { handle_dollar (yytext, *yylloc); } |
445 |
"@"(-?[0-9]+|"$") { handle_at (yytext); } |
"@"(-?[0-9]+|"$") { handle_at (yytext); } |
446 |
|
|
447 |
[^$@\[\]/\'\"\{\}\n\r]+ YY_OBS_GROW; |
[^$@\[\]/\'\"\{\}\n\r]+ YY_OBS_GROW; |
520 |
`------------------------------------------------------------------*/ |
`------------------------------------------------------------------*/ |
521 |
|
|
522 |
static void |
static void |
523 |
handle_dollar (char *cp) |
handle_dollar (char *cp, location_t location) |
524 |
{ |
{ |
525 |
const char *type_name = NULL; |
const char *type_name = NULL; |
526 |
|
|
529 |
stack. It is not the same as the rule->length in the case of mid |
stack. It is not the same as the rule->length in the case of mid |
530 |
rule actions. */ |
rule actions. */ |
531 |
int rule_length = 0; |
int rule_length = 0; |
532 |
symbol_list *rhs; |
symbol_list_t *rhs; |
533 |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
534 |
++rule_length; |
++rule_length; |
535 |
|
|
548 |
if (*cp == '$') |
if (*cp == '$') |
549 |
{ |
{ |
550 |
if (!type_name) |
if (!type_name) |
551 |
type_name = get_type_name (0, current_rule); |
type_name = symbol_list_n_type_name_get (current_rule, location, 0); |
552 |
if (!type_name && typed) |
if (!type_name && typed) |
553 |
complain (_("$$ of `%s' has no declared type"), |
complain_at (location, _("$$ of `%s' has no declared type"), |
554 |
current_rule->sym->tag); |
current_rule->sym->tag); |
555 |
if (!type_name) |
if (!type_name) |
556 |
type_name = ""; |
type_name = ""; |
557 |
obstack_fgrow1 (&string_obstack, |
obstack_fgrow1 (&string_obstack, |
562 |
int n = strtol (cp, &cp, 10); |
int n = strtol (cp, &cp, 10); |
563 |
|
|
564 |
if (n > rule_length) |
if (n > rule_length) |
565 |
complain (_("invalid value: %s%d"), "$", n); |
complain_at (location, _("invalid value: %s%d"), "$", n); |
566 |
else |
else |
567 |
{ |
{ |
568 |
if (!type_name && n > 0) |
if (!type_name && n > 0) |
569 |
type_name = get_type_name (n, current_rule); |
type_name = symbol_list_n_type_name_get (current_rule, location, |
570 |
|
n); |
571 |
if (!type_name && typed) |
if (!type_name && typed) |
572 |
complain (_("$%d of `%s' has no declared type"), |
complain_at (location, _("$%d of `%s' has no declared type"), |
573 |
n, current_rule->sym->tag); |
n, current_rule->sym->tag); |
574 |
if (!type_name) |
if (!type_name) |
575 |
type_name = ""; |
type_name = ""; |
599 |
stack. It is not the same as the rule->length in the case of mid |
stack. It is not the same as the rule->length in the case of mid |
600 |
rule actions. */ |
rule actions. */ |
601 |
int rule_length = 0; |
int rule_length = 0; |
602 |
symbol_list *rhs; |
symbol_list_t *rhs; |
603 |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
604 |
++rule_length; |
++rule_length; |
605 |
|
|