/[anubis]/anubis/src/rcfile.y
ViewVC logotype

Diff of /anubis/src/rcfile.y

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

revision 1.19 by gray, Mon Jun 30 18:07:15 2003 UTC revision 1.20 by gray, Tue Jul 1 15:21:52 2003 UTC
# Line 55  static void rc_stmt_print(RC_STMT *, int Line 55  static void rc_stmt_print(RC_STMT *, int
55  static int reg_modifier_add(int *, char *);  static int reg_modifier_add(int *, char *);
56  static int check_kw(char *ident);  static int check_kw(char *ident);
57  static int is_prog_allowed();  static int is_prog_allowed();
58    static void parse_error(const char *fmt, ...);
59    
60  static RC_SECTION *rc_section;  static RC_SECTION *rc_section;
61  static int debug_level;  static int debug_level;
62  static int error_count;  static int error_count;
# Line 184  stmt     : /* empty */ EOL Line 185  stmt     : /* empty */ EOL
185  asgn_stmt: keyword meq { verbatim(); } arglist  asgn_stmt: keyword meq { verbatim(); } arglist
186             {             {
187                     if (!check_kw($1)) {                     if (!check_kw($1)) {
188                             yyerror(_("unknown keyword"));                             parse_error(_("unknown keyword: %s"), $1);
189                             YYERROR;                             YYERROR;
190                     }                     }
191    
# Line 294  s_msgpart: msgpart Line 295  s_msgpart: msgpart
295             {             {
296                     $$ = $1;                     $$ = $1;
297                     if ($$.key)                     if ($$.key)
298                             yyerror("regexp is not allowed in this context");                             parse_error("regexp is not allowed in this context");
299             }             }
300           ;           ;
301    
# Line 468  inst_stmt: STOP Line 469  inst_stmt: STOP
469                     $$->v.inst.part = $2.part;                     $$->v.inst.part = $2.part;
470                     $$->v.inst.key  = $2.key;                     $$->v.inst.key  = $2.key;
471                     if ($3 == NULL) {                     if ($3 == NULL) {
472                             yyerror(_("missing replacement value"));                             parse_error(_("missing replacement value"));
473                     }                     }
474                     $$->v.inst.key2 = $3;                     $$->v.inst.key2 = $3;
475                     $$->v.inst.arg  = NULL;                     $$->v.inst.arg  = NULL;
# Line 486  modf_stmt: REGEX modlist Line 487  modf_stmt: REGEX modlist
487    
488  %%  %%
489    
490    static int
491    err_line_num()
492    {
493            return yychar == EOL ? cfg_line_num - 1 : cfg_line_num;
494    }
495    
496    void
497    parse_error(const char *fmt, ...)
498    {
499            char buf[LINEBUFFER];
500            va_list ap;
501    
502            va_start(ap, fmt);
503            vsnprintf(buf, sizeof buf, fmt, ap);
504            va_end(ap);
505            anubis_error(SOFT, "%s:%d: %s", cfg_file, err_line_num(), buf);
506    }
507    
508  int  int
509  yyerror(char *s)  yyerror(char *s)
510  {  {
# Line 901  reg_modifier_add(int *flag, char *opt) Line 920  reg_modifier_add(int *flag, char *opt)
920          else if (strcasecmp(opt, "icase") == 0)          else if (strcasecmp(opt, "icase") == 0)
921                  re_clear_flag(*flag, R_SCASE);                  re_clear_flag(*flag, R_SCASE);
922          else {          else {
923                  yyerror(_("Unknown regexp modifier"));                  parse_error(_("Unknown regexp modifier"));
924                  return 1;                  return 1;
925          }          }
926          return 0;          return 0;
# Line 1253  is_prog_allowed() Line 1272  is_prog_allowed()
1272                  p = anubis_find_section("RULE");                  p = anubis_find_section("RULE");
1273                    
1274          if (!p->allow_prog)          if (!p->allow_prog)
1275                  yyerror(_("program is not allowed in this section"));                  parse_error(_("program is not allowed in this section"));
1276          return p->allow_prog;          return p->allow_prog;
1277  }  }

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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