blob: 8821810e6da1f913ca78ad1b1916aaa6275819c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
include "../lib/parser.h"
include "../lib/prdefs.h"
# PR_ERROR - Issue an error message to the standard output, and take an
# error action acording to the severity code. Error messages can be disabled
# if the error flag is set to NO.
procedure pr_error (msg, severity)
char msg[ARB] # error message
int severity # severity code
include "lexer.com"
#bool clgetb()
int pr_geti()
begin
# Debug ?
#if (clgetb ("debug.parcode")) {
#call eprintf ("pr_error (msg=%s) (sev=%d)\n")
#call pargstr (msg)
#call pargi (severity)
#}
# Test whether to process errors, or not
if (pr_geti (FLAGERRORS) == NO)
return
# Branch on error severity code
switch (severity) {
case PERR_WARNING:
call pr_inci (NWARNINGS, 1)
call printf ("** Warning near line %d: %s%s\n")
call pargi (nlines)
call pargstr (line)
call pargstr (msg)
case PERR_SYNTAX:
call pr_inci (NERRORS, 1)
call printf ("** Error near line %d: %s%s at '%s'\n")
call pargi (nlines)
call pargstr (line)
call pargstr (msg)
call pargstr (id)
case PERR_SEMANTIC:
call pr_inci (NERRORS, 1)
call printf ("** Error near line %d: %s%s\n")
call pargi (nlines)
call pargstr (line)
call pargstr (msg)
case PERR_POSTPROC:
call pr_inci (NERRORS, 1)
call printf ("** Error: %s\n")
call pargstr (msg)
}
end
|