Dear visitor, welcome to Gaming Insight Forum.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
New SVN Feature :)
The SVN server now validates the syntax of all added or changed Lua files, that should prevent most completely broken commits
I actually wrote this for the DBMv5 repository but I think it is also a good idea for DBM4
Re: New SVN Feature :)
I just added a simple UTF-8 validator. All Lua, XML and toc files that contain invalid UTF-8 characters will be rejected.
The validator looks like this:
|
Source code
|
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
|
local function checkEncoding(proc)
local i = 1
for line in proc:lines() do
local state = 0
for char = 1, #line do
local byte = line:byte(char, char)
if byte == 0xC0 or byte == 0xC1 or byte >= 0xF5 then
return unicodeError(line, i, char)
end
if state == 0 then
if byte >= 0xF0 then
state = 3
elseif byte >= 0xE0 then
state = 2
elseif byte >= 0xC0 then
state = 1
end
else
if byte >= 0x80 and byte <= 0xBF then
state = state - 1
else
return unicodeError(line, i, char)
end
end
end
if state ~= 0 then
return unicodeError(line, i, #line)
end
i = i + 1
end
return true
end
|
Seems to work since it only reported real bugs when testing it on old revisions.