Debian Codegraph @

ipl/packs/ibpag2/iohno.icn

raw
1 ############################################################################
2 #
3 # Name: iohno.icn
4 #
5 # Title: iohno (error handler, with hard-coded messages)
6 #
7 # Author: Richard L. Goerwitz
8 #
9 # Version: 1.20
10 #
11 ############################################################################
12 #
13 # This file contains iohno(n, s) - an error handler taking two
14 # arguments: 1) an integer and 2) a string. The string (2) is an
15 # optional error message. The integer (1) is one of several
16 # hard-coded error numbers (see below).
17 #
18 ############################################################################
19 #
20 # Links: rewrap
21 #
22 ############################################################################
23
24 #
25 # iohno: print error message s to stderr; abort with exit status n
26 #
27 procedure iohno(n, s)
28
29 local i, msg
30 static errlist
31 initial {
32 errlist := [[100, "unspecified failure"],
33
34 [2, "can't find iiparse.lib file"],
35
36 [4, "unexpected EOF"],
37 [5, "unknown associativity value"],
38
39 [11, "malformed right-hand side"],
40 [12, "unexpected RHS symbol type"],
41
42 [21, "malformed left-hand side"],
43
44 [30, "unknown or unimplemented % declaration"],
45 [31, "malformed token declaration"],
46 [32, "start symbol redefined"],
47 [33, "LHS symbol expected"],
48 [34, "colon missing"],
49 [35, "malformed RHS in rule declaration"],
50 [36, "undeclared character literal"],
51 [37, "illegal $integer reference"],
52 [38, "out-of-range $reference"],
53 [39, "unterminated brace { in action"],
54 [43, "bogus precedence"],
55 [44, "superfluous epsilon"],
56 [45, "superfluous %union declaration"],
57 [47, "empty or missing rules section"],
58 [48, "garbled declarations section"],
59 [49, "multiple characters within quotes"],
60
61 [40, "same prec, different (or perhaps lacking) assoc"],
62 [41, "conflict between nonassociative rules"],
63 [42, "reduce -- reduce conflict"],
64 [46, "unresolvable shift/reduce conflict"],
65
66 [50, "illegal conflict for nonassociative rules"],
67 [51, "reduce/reduce conflict"],
68 [52, "nonterminal useless and/or declared as a terminal"],
69
70 [60, "malformed $insertion point in iiparse file"],
71
72 [70, "bad action format"],
73 [71, "nonexistent rule number specified in old action"],
74 [72, "nonexistent rule number specified in new action"],
75
76 [80, "conflict in goto table"],
77
78 [90, "RHS nonterminal appears in no LHS"],
79 [91, "useless nonterminal"]
80 ]
81 }
82
83 /n := 0
84 every i := 1 to *errlist do
85 if errlist[i][1] = n then msg := errlist[i][2]
86 writes(&errout, "error ", n, " (", msg, ")")
87 if \s then {
88 write(&errout, ": ")
89 every write(&errout, "\t", rewrap(s) | rewrap())
90 }
91 else write(&errout)
92
93 exit(n)
94
95 end