From 2d1df4714e2736dbde7855ddcd76b4c1de822fa5 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 21:58:02 +1000 Subject: Added a big bunch of example lua scripts for testing the speed of lua compiling. --- .../orig-5.0.3/test/test_lparser.lua | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua (limited to 'LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lparser.lua') 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 @@ +--[[-------------------------------------------------------------------- + + test_lparser.lua + Test for lparser.lua + This file is part of Yueliang. + + Copyright (c) 2005 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +------------------------------------------------------------------------ +-- test the whole kaboodle +------------------------------------------------------------------------ + +require("../lzio") +require("../llex") +require("../lopcodes") +require("../ldump") +require("../lcode") +require("../lparser") + +function lua_assert(test) + if not test then error("assertion failed!") end +end + +luaX:init() + +------------------------------------------------------------------------ +-- try 1 +------------------------------------------------------------------------ + +local zio = luaZ:init(luaZ:make_getS("local a = 1"), nil, "=string") +local LuaState = {} +local Func = luaY:parser(LuaState, zio, nil) + +--[[ +for i, v in Func do + if type(v) == "string" or type(v) == "number" then + print(i, v) + elseif type(v) == "table" then + print(i, "TABLE") + end +end +--]] + +local Writer, Buff = luaU:make_setF("parse1.out") +luaU:dump(LuaState, Func, Writer, Buff) + +------------------------------------------------------------------------ +-- try 2 +------------------------------------------------------------------------ + +zio = luaZ:init(luaZ:make_getF("sample.lua"), nil, "@sample.lua") +Func = luaY:parser(LuaState, zio, nil) +Writer, Buff = luaU:make_setF("parse2.out") +luaU:dump(LuaState, Func, Writer, Buff) -- cgit v1.1