summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/bin/lua/clean.lua
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-11-04 22:32:11 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-11-04 23:25:00 +0100
commit9a7dd0a0770178529c704c08bc446e3533b1f3e5 (patch)
tree2ef6b11f07074c22d44b7f2396e3a96562376974 /lib/tolua++/src/bin/lua/clean.lua
parentMerge pull request #2597 from cuberite/faviconChange (diff)
downloadcuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.tar
cuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.tar.gz
cuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.tar.bz2
cuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.tar.lz
cuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.tar.xz
cuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.tar.zst
cuberite-9a7dd0a0770178529c704c08bc446e3533b1f3e5.zip
Diffstat (limited to 'lib/tolua++/src/bin/lua/clean.lua')
m---------lib/tolua++0
-rw-r--r--lib/tolua++/src/bin/lua/clean.lua79
2 files changed, 0 insertions, 79 deletions
diff --git a/lib/tolua++ b/lib/tolua++
new file mode 160000
+Subproject 9181fc9ef73fa1c052f968d68dc60538f144a47
diff --git a/lib/tolua++/src/bin/lua/clean.lua b/lib/tolua++/src/bin/lua/clean.lua
deleted file mode 100644
index fd5b7b635..000000000
--- a/lib/tolua++/src/bin/lua/clean.lua
+++ /dev/null
@@ -1,79 +0,0 @@
--- mark up comments and strings
-STR1 = "\001"
-STR2 = "\002"
-STR3 = "\003"
-STR4 = "\004"
-REM = "\005"
-ANY = "([\001-\005])"
-ESC1 = "\006"
-ESC2 = "\007"
-
-MASK = { -- the substitution order is important
- {ESC1, "\\'"},
- {ESC2, '\\"'},
- {STR1, "'"},
- {STR2, '"'},
- {STR3, "%[%["},
- {STR4, "%]%]"},
- {REM , "%-%-"},
-}
-
-function mask (s)
- for i = 1,getn(MASK) do
- s = gsub(s,MASK[i][2],MASK[i][1])
- end
- return s
-end
-
-function unmask (s)
- for i = 1,getn(MASK) do
- s = gsub(s,MASK[i][1],MASK[i][2])
- end
- return s
-end
-
-function clean (s)
- -- check for compilation error
- local code = "return function ()\n" .. s .. "\n end"
- if not dostring(code) then
- return nil
- end
-
- if flags['C'] then
- return s
- end
-
- local S = "" -- saved string
-
- s = mask(s)
-
- -- remove blanks and comments
- while 1 do
- local b,e,d = strfind(s,ANY)
- if b then
- S = S..strsub(s,1,b-1)
- s = strsub(s,b+1)
- if d==STR1 or d==STR2 then
- e = strfind(s,d)
- S = S ..d..strsub(s,1,e)
- s = strsub(s,e+1)
- elseif d==STR3 then
- e = strfind(s,STR4)
- S = S..d..strsub(s,1,e)
- s = strsub(s,e+1)
- elseif d==REM then
- s = gsub(s,"[^\n]*(\n?)","%1",1)
- end
- else
- S = S..s
- break
- end
- end
- -- eliminate unecessary spaces
- S = gsub(S,"[ \t]+"," ")
- S = gsub(S,"[ \t]*\n[ \t]*","\n")
- S = gsub(S,"\n+","\n")
- S = unmask(S)
- return S
-end
-