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 |
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); |
123 |
| '(' exp ')' { $$ = $2; } |
| '(' exp ')' { $$ = $2; } |
124 |
| '(' error ')' { $$ = 1111; } |
| '(' error ')' { $$ = 1111; } |
125 |
| '!' { YYERROR; } |
| '!' { YYERROR; } |
126 |
|
| '-' error { YYERROR; } |
127 |
; |
; |
128 |
%% |
%% |
129 |
/* The input. */ |
/* The input. */ |
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 |
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 |