/[bison]/bison/src/scan-gram.c
ViewVC logotype

Diff of /bison/src/scan-gram.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by akim, Sat Jun 15 18:23:12 2002 UTC revision 1.10 by akim, Mon Jun 17 07:04:49 2002 UTC
# Line 790  scanner_last_string_free (void) Line 790  scanner_last_string_free (void)
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
# Line 1696  YY_OBS_GROW; braces_level++; Line 1696  YY_OBS_GROW; braces_level++;
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
# Line 2701  int main() Line 2701  int main()
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    
# Line 2710  handle_dollar (char *cp) Line 2710  handle_dollar (char *cp)
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    
# Line 2729  handle_dollar (char *cp) Line 2729  handle_dollar (char *cp)
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,
# Line 2743  handle_dollar (char *cp) Line 2743  handle_dollar (char *cp)
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 = "";
# Line 2779  handle_at (char *cp) Line 2780  handle_at (char *cp)
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    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26