diff options
author | David Walter Seikel | 2012-01-23 21:58:02 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 21:58:02 +1000 |
commit | 2d1df4714e2736dbde7855ddcd76b4c1de822fa5 (patch) | |
tree | c80e4622631c92dbe8dd6375d187702d084c2f2b /LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua | |
parent | Remove the conflict, and the comment. lol (diff) | |
download | SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.zip SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.tar.gz SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.tar.bz2 SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.tar.xz |
Added a big bunch of example lua scripts for testing the speed of lua compiling.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua b/LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua new file mode 100644 index 0000000..b9400cc --- /dev/null +++ b/LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua | |||
@@ -0,0 +1,60 @@ | |||
1 | --[[-------------------------------------------------------------------- | ||
2 | |||
3 | test_lparser.lua | ||
4 | Test for lparser.lua | ||
5 | This file is part of Yueliang. | ||
6 | |||
7 | Copyright (c) 2005 Kein-Hong Man <khman@users.sf.net> | ||
8 | The COPYRIGHT file describes the conditions | ||
9 | under which this software may be distributed. | ||
10 | |||
11 | See the ChangeLog for more information. | ||
12 | |||
13 | ----------------------------------------------------------------------]] | ||
14 | |||
15 | ------------------------------------------------------------------------ | ||
16 | -- test the whole kaboodle | ||
17 | ------------------------------------------------------------------------ | ||
18 | |||
19 | require("../lzio") | ||
20 | require("../llex") | ||
21 | require("../lopcodes") | ||
22 | require("../ldump") | ||
23 | require("../lcode") | ||
24 | require("../lparser") | ||
25 | |||
26 | function lua_assert(test) | ||
27 | if not test then error("assertion failed!") end | ||
28 | end | ||
29 | |||
30 | luaX:init() | ||
31 | |||
32 | ------------------------------------------------------------------------ | ||
33 | -- try 1 | ||
34 | ------------------------------------------------------------------------ | ||
35 | |||
36 | local zio = luaZ:init(luaZ:make_getS("local a = 1"), nil, "=string") | ||
37 | local LuaState = {} | ||
38 | local Func = luaY:parser(LuaState, zio, nil) | ||
39 | |||
40 | --[[ | ||
41 | for i, v in Func do | ||
42 | if type(v) == "string" or type(v) == "number" then | ||
43 | print(i, v) | ||
44 | elseif type(v) == "table" then | ||
45 | print(i, "TABLE") | ||
46 | end | ||
47 | end | ||
48 | --]] | ||
49 | |||
50 | local Writer, Buff = luaU:make_setF("parse1.out") | ||
51 | luaU:dump(LuaState, Func, Writer, Buff) | ||
52 | |||
53 | ------------------------------------------------------------------------ | ||
54 | -- try 2 | ||
55 | ------------------------------------------------------------------------ | ||
56 | |||
57 | zio = luaZ:init(luaZ:make_getF("sample.lua"), nil, "@sample.lua") | ||
58 | Func = luaY:parser(LuaState, zio, nil) | ||
59 | Writer, Buff = luaU:make_setF("parse2.out") | ||
60 | luaU:dump(LuaState, Func, Writer, Buff) | ||