File: build_code_for_errors%20and%20warnings.kbs

package info (click to toggle)
basic256 2.0.99.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,888 kB
  • sloc: cpp: 17,185; yacc: 4,025; lex: 1,466; java: 1,091; sh: 39; xml: 33; makefile: 20
file content (120 lines) | stat: -rw-r--r-- 2,694 bytes parent folder | download
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# this program will create copy/pasteable code to be places int he .y and .l file
# in the lex folder for each warning/error defined in errorcodes.h
#
# 2020-04-17 j.m.reneau
#
dim e(200)	#error
dim en(200)	#error number
dim et(200) #error text
le = 0
tab = chr(9)

open 1, "../Errorcodes.h"
while not eof(1)
	l = readline(1)
	l = replace(l,tab,' ')
	la = explode(l,' ')
	if la[0] = "#define" then
		print le, la[1], la[la[?]-1]
		e[le] = la[1]
		en[le] = int(la[la[?]-1])
		txt = ""
		open 2, "../Error.cpp"
		while not eof(2)
			tl = readline(2)
			if instr(tl,"case ";la[1]) then
				tl = readline(2)
				tl = explode(tl,'"')
				txt = tl[1]
				exit while
			endif
		end while
		close 2
		et[le]= txt
		le = le + 1
	end if
end while
close 1


# bubblesort alphabetically
for a = 0 to le-2
	for b = a+1 to le-1
		if e[b]<e[a] then
			x = e[a]
			e[a] = e[b]
			e[b] = x
			x = en[a]
			en[a] = en[b]
			en[b] = x
			x = et[a]
			et[a] = et[b]
			et[b] = x
		end if
	next b
next a


print "****************************************************************"
print "Symbols in .l file"
print "****************************************************************"
for t = 0 to le-1
	print lower(e[t]); ' ';
	for i = 1 to length(e[t])
		c = mid(e[t],i,1)
		print '[';
		if upper(c)=lower(c) then
			print c;
		else
			? upper(c);lower(c);
		endif
		print ']';
	next i
	print
next t

print "****************************************************************"
print "Symbols to terminals in .l file"
print "****************************************************************"
for t = 0 to le-1
	print '{';lower(e[t]); '}';tab;tab;tab;
	print "{ count(); return B256";e[t];"; }";
	print
next t


print "****************************************************************"
print "tokens for .y file"
print "****************************************************************"
for t = 0 to le-1
	print "%token B256";e[t]
next t

print "****************************************************************"
print "experssion code for .y file"
print "****************************************************************"
for t = 0 to le-1
	? "| B256"; e[t]; " args_none {"
	? tab; "addIntOp(OP_PUSHINT, "; e[t]; ");"
	? "}"
next t


print "****************************************************************"
print "table for wiki"
print "****************************************************************"
for t = 0 to le-1
	? "|"; e[t]; "|"; en[t];"|";et[t];"|"
next t


print "****************************************************************"
print "lines for ExitSyntaxHighliter.cpp"
print "****************************************************************"
for t = 0 to le-1
	? tab;tab;tab;'<<"'; e[t]; '"'
next t