790 |
static int braces_level = 0; |
static int braces_level = 0; |
791 |
static int percent_percent_count = 0; |
static int percent_percent_count = 0; |
792 |
|
|
793 |
static void handle_dollar PARAMS ((char *cp)); |
static void handle_dollar PARAMS ((char *cp, location_t location)); |
794 |
static void handle_at PARAMS ((char *cp)); |
static void handle_at PARAMS ((char *cp)); |
795 |
|
|
796 |
#define SC_COMMENT 1 |
#define SC_COMMENT 1 |
1696 |
case 82: |
case 82: |
1697 |
YY_RULE_SETUP |
YY_RULE_SETUP |
1698 |
#line 444 "scan-gram.l" |
#line 444 "scan-gram.l" |
1699 |
{ handle_dollar (yytext); } |
{ handle_dollar (yytext, *yylloc); } |
1700 |
YY_BREAK |
YY_BREAK |
1701 |
case 83: |
case 83: |
1702 |
YY_RULE_SETUP |
YY_RULE_SETUP |
2701 |
`------------------------------------------------------------------*/ |
`------------------------------------------------------------------*/ |
2702 |
|
|
2703 |
static void |
static void |
2704 |
handle_dollar (char *cp) |
handle_dollar (char *cp, location_t location) |
2705 |
{ |
{ |
2706 |
const char *type_name = NULL; |
const char *type_name = NULL; |
2707 |
|
|
2710 |
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 |
2711 |
rule actions. */ |
rule actions. */ |
2712 |
int rule_length = 0; |
int rule_length = 0; |
2713 |
symbol_list *rhs; |
symbol_list_t *rhs; |
2714 |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
2715 |
++rule_length; |
++rule_length; |
2716 |
|
|
2729 |
if (*cp == '$') |
if (*cp == '$') |
2730 |
{ |
{ |
2731 |
if (!type_name) |
if (!type_name) |
2732 |
type_name = get_type_name (0, current_rule); |
type_name = symbol_list_n_type_name_get (current_rule, location, 0); |
2733 |
if (!type_name && typed) |
if (!type_name && typed) |
2734 |
complain (_("$$ of `%s' has no declared type"), |
complain_at (location, _("$$ of `%s' has no declared type"), |
2735 |
current_rule->sym->tag); |
current_rule->sym->tag); |
2736 |
if (!type_name) |
if (!type_name) |
2737 |
type_name = ""; |
type_name = ""; |
2738 |
obstack_fgrow1 (&string_obstack, |
obstack_fgrow1 (&string_obstack, |
2743 |
int n = strtol (cp, &cp, 10); |
int n = strtol (cp, &cp, 10); |
2744 |
|
|
2745 |
if (n > rule_length) |
if (n > rule_length) |
2746 |
complain (_("invalid value: %s%d"), "$", n); |
complain_at (location, _("invalid value: %s%d"), "$", n); |
2747 |
else |
else |
2748 |
{ |
{ |
2749 |
if (!type_name && n > 0) |
if (!type_name && n > 0) |
2750 |
type_name = get_type_name (n, current_rule); |
type_name = symbol_list_n_type_name_get (current_rule, location, |
2751 |
|
n); |
2752 |
if (!type_name && typed) |
if (!type_name && typed) |
2753 |
complain (_("$%d of `%s' has no declared type"), |
complain_at (location, _("$%d of `%s' has no declared type"), |
2754 |
n, current_rule->sym->tag); |
n, current_rule->sym->tag); |
2755 |
if (!type_name) |
if (!type_name) |
2756 |
type_name = ""; |
type_name = ""; |
2780 |
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 |
2781 |
rule actions. */ |
rule actions. */ |
2782 |
int rule_length = 0; |
int rule_length = 0; |
2783 |
symbol_list *rhs; |
symbol_list_t *rhs; |
2784 |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
for (rhs = current_rule->next; rhs; rhs = rhs->next) |
2785 |
++rule_length; |
++rule_length; |
2786 |
|
|