/[bison]/bison/tests/calc.at
ViewVC logotype

Diff of /bison/tests/calc.at

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

revision 1.56 by adl, Wed May 14 18:41:48 2003 UTC revision 1.57 by eggert, Mon Jun 2 03:58:34 2003 UTC
# Line 1  Line 1 
1  # Checking the output filenames.                         -*- Autotest -*-  # Simple calculator.                         -*- Autotest -*-
2  # Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.  # Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3    
4  # This program is free software; you can redistribute it and/or modify  # This program is free software; you can redistribute it and/or modify
# Line 45  AT_DATA_GRAMMAR([calc.y], Line 45  AT_DATA_GRAMMAR([calc.y],
45  # include <stdlib.h>  # include <stdlib.h>
46  # include <string.h>  # include <string.h>
47  #endif  #endif
48    #if HAVE_UNISTD_H
49    # include <unistd.h>
50    #else
51    # undef alarm
52    # define alarm(seconds) /* empty */
53    #endif
54  #include <ctype.h>  #include <ctype.h>
55    
56  extern void perror (const char *s);  extern void perror (const char *s);
# Line 117  exp: Line 123  exp:
123  | '(' exp ')'        { $$ = $2;             }  | '(' exp ')'        { $$ = $2;             }
124  | '(' error ')'      { $$ = 1111;           }  | '(' error ')'      { $$ = 1111;           }
125  | '!'                { YYERROR;             }  | '!'                { YYERROR;             }
126    | '-' error          { YYERROR;             }
127  ;  ;
128  %%  %%
129  /* The input. */  /* The input. */
# Line 303  main (int argc, const char **argv) Line 310  main (int argc, const char **argv)
310    int count = 0;    int count = 0;
311    int status;    int status;
312    
313      alarm (10);
314    if (argc == 2)    if (argc == 2)
315      yyin = fopen (argv[1], "r");      yyin = fopen (argv[1], "r");
316    else    else
# Line 503  calc: error: 4444 != 1]) Line 511  calc: error: 4444 != 1])
511    
512  # The same, but this time exercising explicitly triggered syntax errors.  # The same, but this time exercising explicitly triggered syntax errors.
513  # POSIX says the lookahead causing the error should not be discarded.  # POSIX says the lookahead causing the error should not be discarded.
514  _AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [64],  _AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [62],
515  [1.9: syntax error, unexpected "number"  [1.9: syntax error, unexpected "number"
516  calc: error: 2222 != 1])  calc: error: 2222 != 1])
517    _AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [70],
518    [1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!'
519    1.11: syntax error, unexpected "number"
520    calc: error: 2222 != 1])
521  AT_BISON_OPTION_POPDEFS  AT_BISON_OPTION_POPDEFS
522    
523  AT_CLEANUP  AT_CLEANUP

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

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