-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy patherrorscan.c
52 lines (38 loc) · 1020 Bytes
/
errorscan.c
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
/***************************************
$Header$
Scan syntax tree for suspicious constructions that are hard to
detect during the parse phase.
***************************************/
/* COPYRIGHT */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "functions.h"
/* ================================================== */
void
error_scan(TreeNode *x)
{
struct nonterm *nt;
TreeNode *c;
int i, nc;
if (x->type == N_NONTERM) {
nt = &x->data.nonterm;
nc = nt->nchildren;
for (i=0; i<nc; i++) {
c = nt->children[i];
error_scan(c);
}
if (nt->type == FRAGMENT) {
TreeNode *c1;
c1 = child_ref(x, 0);
if ((c1->type == N_NONTERM) &&
(c1->data.nonterm.type == TERMS)) {
fprintf(stderr, "Warning: Sentence may be missing selbri at line %d column %d?\n",
x->start_line, x->start_column);
}
}
} else {
}
}
/* ================================================== */