]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Other/Maintained/Tools/Pccts/sorcerer/lib/errsupport.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Other / Maintained / Tools / Pccts / sorcerer / lib / errsupport.c
1 /*
2 * errsupport.c -- error support code for SORCERER output
3 *
4 * Define your own or compile and link this in.
5 *
6 * Terence Parr
7 * U of MN, AHPCRC
8 * February 1994
9 */
10 #include "sorcerer.h"
11
12 void
13 #ifdef __USE_PROTOS
14 mismatched_range( STreeParser *_parser, int looking_for, int upper_token, SORAST *found )
15 #else
16 mismatched_range( _parser, looking_for, upper_token, found )
17 int looking_for;
18 int upper_token;
19 SORAST *found;
20 STreeParser *_parser;
21 #endif
22 {
23 if ( found!=NULL ) {
24 fprintf(stderr,
25 "parse error: expected token range %d..%d found token %d\n",
26 looking_for, upper_token,
27 found->token);
28 }
29 else {
30 fprintf(stderr,
31 "parse error: expected token range %d..%d found NULL tree\n",
32 looking_for, upper_token);
33 }
34 }
35
36 void
37 #ifdef __USE_PROTOS
38 missing_wildcard(STreeParser *_parser)
39 #else
40 missing_wildcard(_parser)
41 STreeParser *_parser;
42 #endif
43 {
44 fprintf(stderr, "parse error: expected any token/tree found found NULL tree\n");
45 }
46
47 void
48 #ifdef __USE_PROTOS
49 mismatched_token( STreeParser *_parser, int looking_for, SORAST *found )
50 #else
51 mismatched_token( _parser, looking_for, found )
52 int looking_for;
53 SORAST *found;
54 STreeParser *_parser;
55 #endif
56 {
57 if ( found!=NULL ) {
58 fprintf(stderr,
59 "parse error: expected token %d found token %d\n",
60 looking_for,
61 found->token);
62 }
63 else {
64 fprintf(stderr,
65 "parse error: expected token %d found NULL tree\n",
66 looking_for);
67 }
68 }
69
70 void
71 #ifdef __USE_PROTOS
72 no_viable_alt( STreeParser *_parser, char *rulename, SORAST *root )
73 #else
74 no_viable_alt( _parser, rulename, root )
75 char *rulename;
76 SORAST *root;
77 STreeParser *_parser;
78 #endif
79 {
80 if ( root==NULL )
81 fprintf(stderr,
82 "parse error: in rule %s, no viable alternative for NULL tree\n",
83 rulename);
84 else
85 fprintf(stderr,
86 "parse error: in rule %s, no viable alternative for tree\n",
87 rulename);
88 }
89
90 void
91 #ifdef __USE_PROTOS
92 sorcerer_panic(char *err)
93 #else
94 sorcerer_panic(err)
95 char *err;
96 #endif
97 {
98 fprintf(stderr, "panic: %s\n", err);
99 exit(-1);
100 }