Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

412 lines
7.2 KiB

  1. /* routines for printing error messages */
  2. #include "defs.h"
  3. #if defined(KYLEP_CHANGE)
  4. void
  5. #endif
  6. fatal(msg)
  7. char *msg;
  8. {
  9. fprintf(stderr, "%s: f - %s\n", myname, msg);
  10. done(2);
  11. }
  12. #if defined(KYLEP_CHANGE)
  13. void
  14. #endif
  15. no_space()
  16. {
  17. fprintf(stderr, "%s: f - out of space\n", myname);
  18. done(2);
  19. }
  20. #if defined(KYLEP_CHANGE)
  21. void
  22. #endif
  23. open_error(filename)
  24. char *filename;
  25. {
  26. fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
  27. done(2);
  28. }
  29. #if defined(KYLEP_CHANGE)
  30. void
  31. #endif
  32. unexpected_EOF()
  33. {
  34. fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
  35. myname, lineno, input_file_name);
  36. done(1);
  37. }
  38. #if defined(KYLEP_CHANGE)
  39. void
  40. #endif
  41. print_pos(st_line, st_cptr)
  42. char *st_line;
  43. char *st_cptr;
  44. {
  45. register char *s;
  46. if (st_line == 0) return;
  47. for (s = st_line; *s != '\n'; ++s)
  48. {
  49. if (isprint(*s) || *s == '\t')
  50. putc(*s, stderr);
  51. else
  52. putc('?', stderr);
  53. }
  54. putc('\n', stderr);
  55. for (s = st_line; s < st_cptr; ++s)
  56. {
  57. if (*s == '\t')
  58. putc('\t', stderr);
  59. else
  60. putc(' ', stderr);
  61. }
  62. putc('^', stderr);
  63. putc('\n', stderr);
  64. }
  65. #if defined(KYLEP_CHANGE)
  66. void
  67. #endif
  68. syntax_error(st_lineno, st_line, st_cptr)
  69. int st_lineno;
  70. char *st_line;
  71. char *st_cptr;
  72. {
  73. fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n",
  74. myname, st_lineno, input_file_name);
  75. print_pos(st_line, st_cptr);
  76. done(1);
  77. }
  78. #if defined(KYLEP_CHANGE)
  79. void
  80. #endif
  81. unterminated_comment(c_lineno, c_line, c_cptr)
  82. int c_lineno;
  83. char *c_line;
  84. char *c_cptr;
  85. {
  86. fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
  87. myname, c_lineno, input_file_name);
  88. print_pos(c_line, c_cptr);
  89. done(1);
  90. }
  91. #if defined(KYLEP_CHANGE)
  92. void
  93. #endif
  94. unterminated_string(s_lineno, s_line, s_cptr)
  95. int s_lineno;
  96. char *s_line;
  97. char *s_cptr;
  98. {
  99. fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
  100. myname, s_lineno, input_file_name);
  101. print_pos(s_line, s_cptr);
  102. done(1);
  103. }
  104. #if defined(KYLEP_CHANGE)
  105. void
  106. #endif
  107. unterminated_text(t_lineno, t_line, t_cptr)
  108. int t_lineno;
  109. char *t_line;
  110. char *t_cptr;
  111. {
  112. fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
  113. myname, t_lineno, input_file_name);
  114. print_pos(t_line, t_cptr);
  115. done(1);
  116. }
  117. #if defined(KYLEP_CHANGE)
  118. void
  119. #endif
  120. unterminated_union(u_lineno, u_line, u_cptr)
  121. int u_lineno;
  122. char *u_line;
  123. char *u_cptr;
  124. {
  125. fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \
  126. declaration\n", myname, u_lineno, input_file_name);
  127. print_pos(u_line, u_cptr);
  128. done(1);
  129. }
  130. #if defined(KYLEP_CHANGE)
  131. void
  132. #endif
  133. over_unionized(u_cptr)
  134. char *u_cptr;
  135. {
  136. fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \
  137. declarations\n", myname, lineno, input_file_name);
  138. print_pos(line, u_cptr);
  139. done(1);
  140. }
  141. #if defined(KYLEP_CHANGE)
  142. void
  143. #endif
  144. illegal_tag(t_lineno, t_line, t_cptr)
  145. int t_lineno;
  146. char *t_line;
  147. char *t_cptr;
  148. {
  149. fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n",
  150. myname, t_lineno, input_file_name);
  151. print_pos(t_line, t_cptr);
  152. done(1);
  153. }
  154. #if defined(KYLEP_CHANGE)
  155. void
  156. #endif
  157. illegal_character(c_cptr)
  158. char *c_cptr;
  159. {
  160. fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n",
  161. myname, lineno, input_file_name);
  162. print_pos(line, c_cptr);
  163. done(1);
  164. }
  165. #if defined(KYLEP_CHANGE)
  166. void
  167. #endif
  168. used_reserved(s)
  169. char *s;
  170. {
  171. fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
  172. %s\n", myname, lineno, input_file_name, s);
  173. done(1);
  174. }
  175. #if defined(KYLEP_CHANGE)
  176. void
  177. #endif
  178. tokenized_start(s)
  179. char *s;
  180. {
  181. fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \
  182. declared to be a token\n", myname, lineno, input_file_name, s);
  183. done(1);
  184. }
  185. #if defined(KYLEP_CHANGE)
  186. void
  187. #endif
  188. retyped_warning(s)
  189. char *s;
  190. {
  191. fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \
  192. redeclared\n", myname, lineno, input_file_name, s);
  193. }
  194. #if defined(KYLEP_CHANGE)
  195. void
  196. #endif
  197. reprec_warning(s)
  198. char *s;
  199. {
  200. fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \
  201. redeclared\n", myname, lineno, input_file_name, s);
  202. }
  203. #if defined(KYLEP_CHANGE)
  204. void
  205. #endif
  206. revalued_warning(s)
  207. char *s;
  208. {
  209. fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \
  210. redeclared\n", myname, lineno, input_file_name, s);
  211. }
  212. #if defined(KYLEP_CHANGE)
  213. void
  214. #endif
  215. terminal_start(s)
  216. char *s;
  217. {
  218. fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \
  219. token\n", myname, lineno, input_file_name, s);
  220. done(1);
  221. }
  222. #if defined(KYLEP_CHANGE)
  223. void
  224. #endif
  225. restarted_warning()
  226. {
  227. fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
  228. redeclared\n", myname, lineno, input_file_name);
  229. }
  230. #if defined(KYLEP_CHANGE)
  231. void
  232. #endif
  233. no_grammar()
  234. {
  235. fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
  236. specified\n", myname, lineno, input_file_name);
  237. done(1);
  238. }
  239. #if defined(KYLEP_CHANGE)
  240. void
  241. #endif
  242. terminal_lhs(s_lineno)
  243. int s_lineno;
  244. {
  245. fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \
  246. of a production\n", myname, s_lineno, input_file_name);
  247. done(1);
  248. }
  249. #if defined(KYLEP_CHANGE)
  250. void
  251. #endif
  252. prec_redeclared()
  253. {
  254. fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
  255. specifiers\n", myname, lineno, input_file_name);
  256. }
  257. #if defined(KYLEP_CHANGE)
  258. void
  259. #endif
  260. unterminated_action(a_lineno, a_line, a_cptr)
  261. int a_lineno;
  262. char *a_line;
  263. char *a_cptr;
  264. {
  265. fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
  266. myname, a_lineno, input_file_name);
  267. print_pos(a_line, a_cptr);
  268. done(1);
  269. }
  270. #if defined(KYLEP_CHANGE)
  271. void
  272. #endif
  273. dollar_warning(a_lineno, i)
  274. int a_lineno;
  275. int i;
  276. {
  277. fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \
  278. end of the current rule\n", myname, a_lineno, input_file_name, i);
  279. }
  280. #if defined(KYLEP_CHANGE)
  281. void
  282. #endif
  283. dollar_error(a_lineno, a_line, a_cptr)
  284. int a_lineno;
  285. char *a_line;
  286. char *a_cptr;
  287. {
  288. fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
  289. myname, a_lineno, input_file_name);
  290. print_pos(a_line, a_cptr);
  291. done(1);
  292. }
  293. #if defined(KYLEP_CHANGE)
  294. void
  295. #endif
  296. untyped_lhs()
  297. {
  298. fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
  299. myname, lineno, input_file_name);
  300. done(1);
  301. }
  302. #if defined(KYLEP_CHANGE)
  303. void
  304. #endif
  305. untyped_rhs(i, s)
  306. int i;
  307. char *s;
  308. {
  309. fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n",
  310. myname, lineno, input_file_name, i, s);
  311. done(1);
  312. }
  313. #if defined(KYLEP_CHANGE)
  314. void
  315. #endif
  316. unknown_rhs(i)
  317. int i;
  318. {
  319. fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
  320. myname, lineno, input_file_name, i);
  321. done(1);
  322. }
  323. #if defined(KYLEP_CHANGE)
  324. void
  325. #endif
  326. default_action_warning()
  327. {
  328. fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
  329. undefined value to $$\n", myname, lineno, input_file_name);
  330. }
  331. #if defined(KYLEP_CHANGE)
  332. void
  333. #endif
  334. undefined_goal(s)
  335. char *s;
  336. {
  337. fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
  338. done(1);
  339. }
  340. #if defined(KYLEP_CHANGE)
  341. void
  342. #endif
  343. undefined_symbol_warning(s)
  344. char *s;
  345. {
  346. fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);
  347. }