From 9621add2918cc4943e6693b74ae85d51dd264fcf Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 21 Apr 2014 20:59:39 +1000 Subject: We don't need the testlua directory any more. --- .../nat-5.0.3/test/bench_llex_mk2.lua | 94 ---- .../nat-5.0.3/test/bench_llex_mk3.lua | 92 ---- .../nat-5.0.3/test/bench_llex_mk4.lua | 94 ---- .../nat-5.0.3/test/parser_log/sample_01.lua | 9 - .../nat-5.0.3/test/parser_log/sample_02.lua | 10 - .../nat-5.0.3/test/parser_log/sample_03.lua | 21 - .../nat-5.0.3/test/parser_log/sample_04.lua | 31 -- .../nat-5.0.3/test/parser_log/sample_05.lua | 129 ------ .../nat-5.0.3/test/parser_log/sample_06.lua | 132 ------ .../nat-5.0.3/test/parser_log/sample_07.lua | 147 ------ .../nat-5.0.3/test/parser_log/sample_08.lua | 66 --- .../nat-5.0.3/test/parser_log/sample_09.lua | 97 ---- .../nat-5.0.3/test/parser_log/sample_10.lua | 106 ----- .../nat-5.0.3/test/parser_log/sample_11.lua | 175 -------- .../nat-5.0.3/test/parser_log/sample_12.lua | 46 -- .../nat-5.0.3/test/parser_log/sample_13.lua | 99 ---- .../nat-5.0.3/test/parser_log/sample_14.lua | 107 ----- .../nat-5.0.3/test/parser_log/sample_15.lua | 135 ------ .../nat-5.0.3/test/parser_log/sample_16.lua | 87 ---- .../nat-5.0.3/test/parser_log/sample_17.lua | 110 ----- .../nat-5.0.3/test/parser_log/sample_b_01.lua | 26 -- .../nat-5.0.3/test/parser_log/sample_b_02.lua | 35 -- .../nat-5.0.3/test/parser_log/sample_b_03.lua | 64 --- .../nat-5.0.3/test/parser_log/sample_b_04.lua | 77 ---- .../nat-5.0.3/test/parser_log/sample_b_05.lua | 43 -- .../nat-5.0.3/test/parser_log/sample_b_06.lua | 70 --- .../nat-5.0.3/test/parser_log/sample_b_07.lua | 84 ---- .../nat-5.0.3/test/parser_log/sample_b_08.lua | 159 ------- .../nat-5.0.3/test/parser_log/sample_b_09.lua | 53 --- .../nat-5.0.3/test/parser_log/sample_b_10.lua | 49 -- .../nat-5.0.3/test/parser_log/sample_b_11.lua | 79 ---- .../nat-5.0.3/test/parser_log/sample_b_12.lua | 94 ---- .../nat-5.0.3/test/parser_log/sample_b_13.lua | 117 ----- .../nat-5.0.3/test/parser_log/sample_b_14.lua | 125 ------ .../yueliang-0.4.1/nat-5.0.3/test/sample.lua | 3 - .../nat-5.0.3/test/test_llex_mk2.lua | 499 -------------------- .../nat-5.0.3/test/test_llex_mk3.lua | 500 --------------------- .../nat-5.0.3/test/test_llex_mk4.lua | 499 -------------------- .../nat-5.0.3/test/test_lparser_mk3.lua | 218 --------- .../nat-5.0.3/test/test_lparser_mk3_2.lua | 158 ------- .../nat-5.0.3/test/test_lparser_mk3b.lua | 188 -------- .../nat-5.0.3/test/test_lparser_mk3b_2.lua | 158 ------- .../nat-5.0.3/test/test_lzio_mk2.lua | 53 --- 43 files changed, 5138 deletions(-) delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk2.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk3.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk4.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_01.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_02.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_03.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_04.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_05.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_06.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_07.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_08.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_09.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_10.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_11.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_12.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_13.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_14.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_15.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_16.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_17.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_01.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_02.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_03.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_04.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_05.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_06.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_07.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_08.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_09.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_10.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_11.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_12.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_13.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_14.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/sample.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk2.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk3.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk4.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3_2.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b_2.lua delete mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua (limited to 'LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test') diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk2.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk2.lua deleted file mode 100644 index 873afd1..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk2.lua +++ /dev/null @@ -1,94 +0,0 @@ ---[[-------------------------------------------------------------------- - - bench_llex.lua - Benchmark test for llex.lua - This file is part of Yueliang. - - Copyright (c) 2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - -local zio_init = require("../lzio_mk2") -local lex_init = require("../llex_mk2") - ------------------------------------------------------------------------- --- load in a standard set of sample files --- * file set is 5.0.3 front end set sans luac.lua ------------------------------------------------------------------------- - -local fileset, totalsize = {}, 0 -for fn in string.gfind([[ -../../orig-5.0.3/lcode.lua -../../orig-5.0.3/ldump.lua -../../orig-5.0.3/llex.lua -../../orig-5.0.3/lopcodes.lua -../../orig-5.0.3/lparser.lua -../../orig-5.0.3/lzio.lua -]], "%S+") do - table.insert(fileset, fn) -end - -for i = 1, table.getn(fileset) do - local fn = fileset[i] - local inf = io.open(fn, "rb") - if not inf then - error("failed to open "..fn.." for reading") - end - local data = inf:read("*a") - local data_sz = string.len(data) - inf:close() - if not data or data_sz == 0 then - error("failed to read data from "..fn.." or file is zero-length") - end - totalsize = totalsize + data_sz - fileset[i] = data -end - ------------------------------------------------------------------------- --- benchmark tester ------------------------------------------------------------------------- - -local DURATION = 5 -- how long the benchmark should run - -local time = os.time -local lexedsize = 0 -local tnow, elapsed = time(), 0 - -while time() == tnow do end -- wait for second to click over -tnow = time() - -while true do - for i = 1, table.getn(fileset) do - ------------------------------------------------------------ - local chunk = fileset[i] - local z = zio_init(chunk) - local luaX = lex_init(z, "=string") - while true do - local tok, seminfo = luaX:lex() - if tok == "" then break end - end - ------------------------------------------------------------ - lexedsize = lexedsize + string.len(chunk) - if time() > tnow then - tnow = time() - elapsed = elapsed + 1 - if elapsed >= DURATION then - -- report performance of lexer - lexedsize = lexedsize / 1024 - local speed = lexedsize / DURATION - print("Lexer performance:") - print("Size of data lexed (KB): "..string.format("%.1f", lexedsize)) - print("Speed of lexer (KB/s): "..string.format("%.1f", speed)) - -- repeat until user breaks program - elapsed = 0 - end - end - ------------------------------------------------------------ - end--for -end--while - --- end of script diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk3.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk3.lua deleted file mode 100644 index 6b2a4a6..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk3.lua +++ /dev/null @@ -1,92 +0,0 @@ ---[[-------------------------------------------------------------------- - - bench_llex.lua - Benchmark test for llex.lua - This file is part of Yueliang. - - Copyright (c) 2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - -local lex_init = require("../llex_mk3") - ------------------------------------------------------------------------- --- load in a standard set of sample files --- * file set is 5.0.3 front end set sans luac.lua ------------------------------------------------------------------------- - -local fileset, totalsize = {}, 0 -for fn in string.gfind([[ -../../orig-5.0.3/lcode.lua -../../orig-5.0.3/ldump.lua -../../orig-5.0.3/llex.lua -../../orig-5.0.3/lopcodes.lua -../../orig-5.0.3/lparser.lua -../../orig-5.0.3/lzio.lua -]], "%S+") do - table.insert(fileset, fn) -end - -for i = 1, table.getn(fileset) do - local fn = fileset[i] - local inf = io.open(fn, "rb") - if not inf then - error("failed to open "..fn.." for reading") - end - local data = inf:read("*a") - local data_sz = string.len(data) - inf:close() - if not data or data_sz == 0 then - error("failed to read data from "..fn.." or file is zero-length") - end - totalsize = totalsize + data_sz - fileset[i] = data -end - ------------------------------------------------------------------------- --- benchmark tester ------------------------------------------------------------------------- - -local DURATION = 5 -- how long the benchmark should run - -local time = os.time -local lexedsize = 0 -local tnow, elapsed = time(), 0 - -while time() == tnow do end -- wait for second to click over -tnow = time() - -while true do - for i = 1, table.getn(fileset) do - ------------------------------------------------------------ - local chunk = fileset[i] - local luaX = lex_init(chunk, "=string") - while true do - local tok, seminfo = luaX:lex() - if tok == "" then break end - end - ------------------------------------------------------------ - lexedsize = lexedsize + string.len(chunk) - if time() > tnow then - tnow = time() - elapsed = elapsed + 1 - if elapsed >= DURATION then - -- report performance of lexer - lexedsize = lexedsize / 1024 - local speed = lexedsize / DURATION - print("Lexer performance:") - print("Size of data lexed (KB): "..string.format("%.1f", lexedsize)) - print("Speed of lexer (KB/s): "..string.format("%.1f", speed)) - -- repeat until user breaks program - elapsed = 0 - end - end - ------------------------------------------------------------ - end--for -end--while - --- end of script diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk4.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk4.lua deleted file mode 100644 index b94386b..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/bench_llex_mk4.lua +++ /dev/null @@ -1,94 +0,0 @@ ---[[-------------------------------------------------------------------- - - bench_llex.lua - Benchmark test for llex.lua - This file is part of Yueliang. - - Copyright (c) 2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - -local zio_init = require("../lzio_mk4") -local lex_init = require("../llex_mk4") - ------------------------------------------------------------------------- --- load in a standard set of sample files --- * file set is 5.0.3 front end set sans luac.lua ------------------------------------------------------------------------- - -local fileset, totalsize = {}, 0 -for fn in string.gfind([[ -../../orig-5.0.3/lcode.lua -../../orig-5.0.3/ldump.lua -../../orig-5.0.3/llex.lua -../../orig-5.0.3/lopcodes.lua -../../orig-5.0.3/lparser.lua -../../orig-5.0.3/lzio.lua -]], "%S+") do - table.insert(fileset, fn) -end - -for i = 1, table.getn(fileset) do - local fn = fileset[i] - local inf = io.open(fn, "rb") - if not inf then - error("failed to open "..fn.." for reading") - end - local data = inf:read("*a") - local data_sz = string.len(data) - inf:close() - if not data or data_sz == 0 then - error("failed to read data from "..fn.." or file is zero-length") - end - totalsize = totalsize + data_sz - fileset[i] = data -end - ------------------------------------------------------------------------- --- benchmark tester ------------------------------------------------------------------------- - -local DURATION = 5 -- how long the benchmark should run - -local time = os.time -local lexedsize = 0 -local tnow, elapsed = time(), 0 - -while time() == tnow do end -- wait for second to click over -tnow = time() - -while true do - for i = 1, table.getn(fileset) do - ------------------------------------------------------------ - local chunk = fileset[i] - local z = zio_init(chunk) - local luaX = lex_init(z, "=string") - while true do - local tok, seminfo = luaX:lex() - if tok == "" then break end - end - ------------------------------------------------------------ - lexedsize = lexedsize + string.len(chunk) - if time() > tnow then - tnow = time() - elapsed = elapsed + 1 - if elapsed >= DURATION then - -- report performance of lexer - lexedsize = lexedsize / 1024 - local speed = lexedsize / DURATION - print("Lexer performance:") - print("Size of data lexed (KB): "..string.format("%.1f", lexedsize)) - print("Speed of lexer (KB/s): "..string.format("%.1f", speed)) - -- repeat until user breaks program - elapsed = 0 - end - end - ------------------------------------------------------------ - end--for -end--while - --- end of script diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_01.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_01.lua deleted file mode 100644 index 379cc9d..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_01.lua +++ /dev/null @@ -1,9 +0,0 @@ --- START OF SOURCE -- --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_02.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_02.lua deleted file mode 100644 index 13eb2e6..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_02.lua +++ /dev/null @@ -1,10 +0,0 @@ --- START OF SOURCE -- --- foobar --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_03.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_03.lua deleted file mode 100644 index 33df29c..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_03.lua +++ /dev/null @@ -1,21 +0,0 @@ --- START OF SOURCE -- -do -end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'do' line=1 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_04.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_04.lua deleted file mode 100644 index d0fefbc..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_04.lua +++ /dev/null @@ -1,31 +0,0 @@ --- START OF SOURCE -- -do end -do end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'do' line=1 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - -- STATEMENT: begin 'do' line=2 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_05.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_05.lua deleted file mode 100644 index 8d6f962..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_05.lua +++ /dev/null @@ -1,129 +0,0 @@ --- START OF SOURCE -- -foo() -foo{} -foo"" -foo:bar() -foo=false -foo.bar=true -foo[true]=nil -foo,bar=1,"a" --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - primaryexp: ( funcargs - funcargs: begin '(' - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - primaryexp: { funcargs - funcargs: begin '{' - constructor: begin - constructor: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - primaryexp: funcargs - funcargs: begin - codestring: "" - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=4 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - primaryexp: : funcargs - checkname: - str_checkname: 'bar' - codestring: "bar" - funcargs: begin '(' - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: false - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=6 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - primaryexp: '.' field - field: operator=. - checkname: - str_checkname: 'bar' - codestring: "bar" - expr_stat: assignment k='VINDEXED' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: true - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=7 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - primaryexp: [ exp1 ] - index: begin '[' - expr: - simpleexp: true - index: end ']' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: nil - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=8 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: ',' -- next LHS element - prefixexp: - str_checkname: 'bar' - singlevar: name='bar' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1 - explist1: ',' -- continuation - expr: - simpleexp: =a - codestring: "a" - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_06.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_06.lua deleted file mode 100644 index ca7776e..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_06.lua +++ /dev/null @@ -1,132 +0,0 @@ --- START OF SOURCE -- -foo=true -foo=false -foo=nil -foo=1.23e45 -foo=-1 -foo=(0) -foo=1+2 -foo=1+2*3-4/5 --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: true - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: false - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: nil - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=4 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1.23e+45 - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - subexpr: uop='-' - simpleexp: =1 - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=6 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: begin ( expr ) - expr: - simpleexp: =0 - prefixexp: end ( expr ) - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=7 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1 - subexpr: binop='+' - simpleexp: =2 - subexpr: -- evaluate - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=8 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1 - subexpr: binop='+' - simpleexp: =2 - subexpr: binop='*' - simpleexp: =3 - subexpr: -- evaluate - subexpr: -- evaluate - subexpr: binop='-' - simpleexp: =4 - subexpr: binop='/' - simpleexp: =5 - subexpr: -- evaluate - subexpr: -- evaluate - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_07.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_07.lua deleted file mode 100644 index 8c0a738..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_07.lua +++ /dev/null @@ -1,147 +0,0 @@ --- START OF SOURCE -- -if foo then foo=1 end -if foo then foo=1 else foo=0 end -if foo then foo=1 elseif not foo then foo=0 end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'if' line=1 - if_stat: if...then - test_then_block: test condition - cond: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - cond: end - test_then_block: then block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - if_stat: end - -- STATEMENT: end 'if' - - -- STATEMENT: begin 'if' line=2 - if_stat: if...then - test_then_block: test condition - cond: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - cond: end - test_then_block: then block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - if_stat: else... - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =0 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - if_stat: end - -- STATEMENT: end 'if' - - -- STATEMENT: begin 'if' line=3 - if_stat: if...then - test_then_block: test condition - cond: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - cond: end - test_then_block: then block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =1 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - if_stat: elseif...then - test_then_block: test condition - cond: begin - expr: - subexpr: uop='not' - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - cond: end - test_then_block: then block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =0 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - if_stat: end - -- STATEMENT: end 'if' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_08.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_08.lua deleted file mode 100644 index d086c98..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_08.lua +++ /dev/null @@ -1,66 +0,0 @@ --- START OF SOURCE -- -do return end -do return 123 end -do return "foo","bar" end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'do' line=1 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'return' line=1 - return_stat: no return values - -- STATEMENT: end 'return' - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - -- STATEMENT: begin 'do' line=2 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'return' line=2 - return_stat: begin - explist1: begin - expr: - simpleexp: =123 - explist1: end - return_stat: end - -- STATEMENT: end 'return' - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - -- STATEMENT: begin 'do' line=3 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'return' line=3 - return_stat: begin - explist1: begin - expr: - simpleexp: =foo - codestring: "foo" - explist1: ',' -- continuation - expr: - simpleexp: =bar - codestring: "bar" - explist1: end - return_stat: end - -- STATEMENT: end 'return' - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_09.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_09.lua deleted file mode 100644 index 2236388..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_09.lua +++ /dev/null @@ -1,97 +0,0 @@ --- START OF SOURCE -- -while true do foo=not foo end -while foo~=42 do foo=foo-1 end -while true do break end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'while' line=1 - while_stat: begin/condition - expr: - simpleexp: true - enterblock(isbreakable=true) - while_stat: block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - subexpr: uop='not' - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - while_stat: end - -- STATEMENT: end 'while' - - -- STATEMENT: begin 'while' line=2 - while_stat: begin/condition - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - subexpr: binop='~=' - simpleexp: =42 - subexpr: -- evaluate - enterblock(isbreakable=true) - while_stat: block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - subexpr: binop='-' - simpleexp: =1 - subexpr: -- evaluate - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - while_stat: end - -- STATEMENT: end 'while' - - -- STATEMENT: begin 'while' line=3 - while_stat: begin/condition - expr: - simpleexp: true - enterblock(isbreakable=true) - while_stat: block - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'break' line=3 - break_stat: -- break out of loop - -- STATEMENT: end 'break' - leaveblock - block: end - leaveblock - while_stat: end - -- STATEMENT: end 'while' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_10.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_10.lua deleted file mode 100644 index 72f7ae3..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_10.lua +++ /dev/null @@ -1,106 +0,0 @@ --- START OF SOURCE -- -repeat foo=foo.."bar" until false -repeat foo=foo/2 until foo<1 -repeat break until false --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'repeat' line=1 - repeat_stat: begin - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - subexpr: binop='..' - simpleexp: =bar - codestring: "bar" - subexpr: -- evaluate - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - repeat_stat: condition - cond: begin - expr: - simpleexp: false - cond: end - leaveblock - repeat_stat: end - -- STATEMENT: end 'repeat' - - -- STATEMENT: begin 'repeat' line=2 - repeat_stat: begin - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - subexpr: binop='/' - simpleexp: =2 - subexpr: -- evaluate - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - repeat_stat: condition - cond: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - subexpr: binop='<' - simpleexp: =1 - subexpr: -- evaluate - cond: end - leaveblock - repeat_stat: end - -- STATEMENT: end 'repeat' - - -- STATEMENT: begin 'repeat' line=3 - repeat_stat: begin - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'break' line=3 - break_stat: -- break out of loop - -- STATEMENT: end 'break' - leaveblock - block: end - repeat_stat: condition - cond: begin - expr: - simpleexp: false - cond: end - leaveblock - repeat_stat: end - -- STATEMENT: end 'repeat' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_11.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_11.lua deleted file mode 100644 index 8af611b..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_11.lua +++ /dev/null @@ -1,175 +0,0 @@ --- START OF SOURCE -- -for i=1,10 do foo=i end -for i=1,10,2 do break end -for i in foo do bar=0 end -for i,j in foo,bar do baz=0 end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'for' line=1 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'i' - for_stat: numerical loop - fornum: begin - fornum: index start - exp1: begin - expr: - simpleexp: =1 - exp1: end - fornum: index stop - exp1: begin - expr: - simpleexp: =10 - exp1: end - fornum: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'i' - singlevar: name='i' - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - fornum: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - -- STATEMENT: begin 'for' line=2 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'i' - for_stat: numerical loop - fornum: begin - fornum: index start - exp1: begin - expr: - simpleexp: =1 - exp1: end - fornum: index stop - exp1: begin - expr: - simpleexp: =10 - exp1: end - fornum: index step - exp1: begin - expr: - simpleexp: =2 - exp1: end - fornum: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'break' line=2 - break_stat: -- break out of loop - -- STATEMENT: end 'break' - leaveblock - block: end - leaveblock - fornum: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - -- STATEMENT: begin 'for' line=3 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'i' - for_stat: list-based loop - forlist: begin - forlist: explist1 - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - explist1: end - forlist: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'bar' - singlevar: name='bar' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =0 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - forlist: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - -- STATEMENT: begin 'for' line=4 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'i' - for_stat: list-based loop - forlist: begin - str_checkname: 'j' - forlist: explist1 - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'bar' - singlevar: name='bar' - explist1: end - forlist: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=4 - prefixexp: - str_checkname: 'baz' - singlevar: name='baz' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: =0 - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - forlist: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_12.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_12.lua deleted file mode 100644 index 916fc7f..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_12.lua +++ /dev/null @@ -1,46 +0,0 @@ --- START OF SOURCE -- -local foo -local foo,bar,baz -local foo,bar="foo","bar" --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local statement - localstat: begin - str_checkname: 'foo' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=2 - local_stat: local statement - localstat: begin - str_checkname: 'foo' - str_checkname: 'bar' - str_checkname: 'baz' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=3 - local_stat: local statement - localstat: begin - str_checkname: 'foo' - str_checkname: 'bar' - localstat: -- assignment - explist1: begin - expr: - simpleexp: =foo - codestring: "foo" - explist1: ',' -- continuation - expr: - simpleexp: =bar - codestring: "bar" - explist1: end - localstat: end - -- STATEMENT: end 'local' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_13.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_13.lua deleted file mode 100644 index 8ddd3ea..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_13.lua +++ /dev/null @@ -1,99 +0,0 @@ --- START OF SOURCE -- -local function foo() return end -local function foo(a) return end -local function foo(x,y,z) return end -local function foo(x,...) return end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local function - localfunc: begin - str_checkname: 'foo' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=1 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=2 - local_stat: local function - localfunc: begin - str_checkname: 'foo' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'a' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=2 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=3 - local_stat: local function - localfunc: begin - str_checkname: 'foo' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'x' - str_checkname: 'y' - str_checkname: 'z' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=3 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=4 - local_stat: local function - localfunc: begin - str_checkname: 'foo' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'x' - parlist: ... (dots) - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=4 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_14.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_14.lua deleted file mode 100644 index aa0069a..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_14.lua +++ /dev/null @@ -1,107 +0,0 @@ --- START OF SOURCE -- -function foo() return end -function foo(a) return end -function foo(x,y,z) return end -function foo(x,...) return end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'function' line=1 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=1 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - -- STATEMENT: begin 'function' line=2 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'a' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=2 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - -- STATEMENT: begin 'function' line=3 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'x' - str_checkname: 'y' - str_checkname: 'z' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=3 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - -- STATEMENT: begin 'function' line=4 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'x' - parlist: ... (dots) - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=4 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_15.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_15.lua deleted file mode 100644 index 73cdac3..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_15.lua +++ /dev/null @@ -1,135 +0,0 @@ --- START OF SOURCE -- -function foo.bar(p) return end -function foo.bar.baz(p) return end -function foo:bar(p) return end -function foo.bar.baz(p) return end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'function' line=1 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: -- '.' field - field: operator=. - checkname: - str_checkname: 'bar' - codestring: "bar" - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'p' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=1 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - -- STATEMENT: begin 'function' line=2 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: -- '.' field - field: operator=. - checkname: - str_checkname: 'bar' - codestring: "bar" - funcname: -- '.' field - field: operator=. - checkname: - str_checkname: 'baz' - codestring: "baz" - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'p' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=2 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - -- STATEMENT: begin 'function' line=3 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: -- ':' field - field: operator=: - checkname: - str_checkname: 'bar' - codestring: "bar" - funcname: end - function_stat: body needself='true' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'p' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=3 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - -- STATEMENT: begin 'function' line=4 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar: name='foo' - funcname: -- '.' field - field: operator=. - checkname: - str_checkname: 'bar' - codestring: "bar" - funcname: -- '.' field - field: operator=. - checkname: - str_checkname: 'baz' - codestring: "baz" - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'p' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=4 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_16.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_16.lua deleted file mode 100644 index b53b2fb..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_16.lua +++ /dev/null @@ -1,87 +0,0 @@ --- START OF SOURCE -- -foo = function() return end -foo = function(x,y) return end -foo = function(...) return end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: function - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=1 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: function - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'x' - str_checkname: 'y' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=2 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: function - open_func - body: begin - body: parlist - parlist: begin - parlist: ... (dots) - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'return' line=3 - return_stat: no return values - -- STATEMENT: end 'return' - body: end - close_func - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_17.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_17.lua deleted file mode 100644 index 87634d3..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_17.lua +++ /dev/null @@ -1,110 +0,0 @@ --- START OF SOURCE -- -foo = {} -foo = { 1,2,3; "foo"; } -foo = { bar=77, baz=88, } -foo = { ["bar"]=77, ["baz"]=88, } --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: constructor - constructor: begin - constructor: end - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: constructor - constructor: begin - listfield: expr - expr: - simpleexp: =1 - listfield: expr - expr: - simpleexp: =2 - listfield: expr - expr: - simpleexp: =3 - listfield: expr - expr: - simpleexp: =foo - codestring: "foo" - constructor: end - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: constructor - constructor: begin - recfield: name - checkname: - str_checkname: 'bar' - codestring: "bar" - expr: - simpleexp: =77 - recfield: name - checkname: - str_checkname: 'baz' - codestring: "baz" - expr: - simpleexp: =88 - constructor: end - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=4 - prefixexp: - str_checkname: 'foo' - singlevar: name='foo' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: constructor - constructor: begin - recfield: [ exp1 ] - index: begin '[' - expr: - simpleexp: =bar - codestring: "bar" - index: end ']' - expr: - simpleexp: =77 - recfield: [ exp1 ] - index: begin '[' - expr: - simpleexp: =baz - codestring: "baz" - index: end ']' - expr: - simpleexp: =88 - constructor: end - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_01.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_01.lua deleted file mode 100644 index 732b4d6..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_01.lua +++ /dev/null @@ -1,26 +0,0 @@ --- START OF SOURCE -- - print(a) --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'expr' line=1 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'a' - singlevar(kind): 'VGLOBAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_02.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_02.lua deleted file mode 100644 index 9863b4a..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_02.lua +++ /dev/null @@ -1,35 +0,0 @@ --- START OF SOURCE -- - local a - print(a) --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local statement - localstat: begin - str_checkname: 'a' - new_localvar: 'a' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'a' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_03.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_03.lua deleted file mode 100644 index bc37280..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_03.lua +++ /dev/null @@ -1,64 +0,0 @@ --- START OF SOURCE -- - do - local a - print(a) - end - print(a) --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'do' line=1 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'local' line=2 - local_stat: local statement - localstat: begin - str_checkname: 'a' - new_localvar: 'a' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'a' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'a' - singlevar(kind): 'VGLOBAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_04.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_04.lua deleted file mode 100644 index b2bac4b..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_04.lua +++ /dev/null @@ -1,77 +0,0 @@ --- START OF SOURCE -- - local a,b,c - do - local b - print(b) - end - print(b) --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local statement - localstat: begin - str_checkname: 'a' - new_localvar: 'a' - str_checkname: 'b' - new_localvar: 'b' - str_checkname: 'c' - new_localvar: 'c' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'do' line=2 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'local' line=3 - local_stat: local statement - localstat: begin - str_checkname: 'b' - new_localvar: 'b' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=4 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'b' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - -- STATEMENT: begin 'expr' line=6 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'b' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_05.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_05.lua deleted file mode 100644 index 6885f01..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_05.lua +++ /dev/null @@ -1,43 +0,0 @@ --- START OF SOURCE -- - local function foo() end - bar = foo --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local function - localfunc: begin - str_checkname: 'foo' - new_localvar: 'foo' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VGLOBAL' - expr_stat: assignment k='VGLOBAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_06.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_06.lua deleted file mode 100644 index eb658ed..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_06.lua +++ /dev/null @@ -1,70 +0,0 @@ --- START OF SOURCE -- - do - local function foo() end - bar = foo - end - baz = foo --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'do' line=1 - do_stat: begin - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'local' line=2 - local_stat: local function - localfunc: begin - str_checkname: 'foo' - new_localvar: 'foo' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VGLOBAL' - expr_stat: assignment k='VGLOBAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - explist1: end - -- STATEMENT: end 'expr' - - leaveblock - block: end - do_stat: end - -- STATEMENT: end 'do' - - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'baz' - singlevar(kind): 'VGLOBAL' - expr_stat: assignment k='VGLOBAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VGLOBAL' - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_07.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_07.lua deleted file mode 100644 index 6403234..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_07.lua +++ /dev/null @@ -1,84 +0,0 @@ --- START OF SOURCE -- - local foo - local function bar() - baz = nil - foo = bar() - end - foo = bar --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local statement - localstat: begin - str_checkname: 'foo' - new_localvar: 'foo' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=2 - local_stat: local function - localfunc: begin - str_checkname: 'bar' - new_localvar: 'bar' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'baz' - singlevar(kind): 'VGLOBAL' - expr_stat: assignment k='VGLOBAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - simpleexp: nil - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=4 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VUPVAL' - expr_stat: assignment k='VUPVAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VUPVAL' - primaryexp: ( funcargs - funcargs: begin '(' - funcargs: end -- expr is a VCALL - explist1: end - -- STATEMENT: end 'expr' - - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=6 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VLOCAL' - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_08.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_08.lua deleted file mode 100644 index 594e267..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_08.lua +++ /dev/null @@ -1,159 +0,0 @@ --- START OF SOURCE -- - local foo - local function bar() - local function baz() - local foo, bar - foo = bar - foo = baz - end - foo = bar - foo = baz - end - foo = bar - foo = baz --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local statement - localstat: begin - str_checkname: 'foo' - new_localvar: 'foo' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'local' line=2 - local_stat: local function - localfunc: begin - str_checkname: 'bar' - new_localvar: 'bar' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'local' line=3 - local_stat: local function - localfunc: begin - str_checkname: 'baz' - new_localvar: 'baz' - localfunc: body - open_func - body: begin - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'local' line=4 - local_stat: local statement - localstat: begin - str_checkname: 'foo' - new_localvar: 'foo' - str_checkname: 'bar' - new_localvar: 'bar' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VLOCAL' - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=6 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'baz' - singlevar(kind): 'VUPVAL' - explist1: end - -- STATEMENT: end 'expr' - - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=8 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VUPVAL' - expr_stat: assignment k='VUPVAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VUPVAL' - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=9 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VUPVAL' - expr_stat: assignment k='VUPVAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'baz' - singlevar(kind): 'VLOCAL' - explist1: end - -- STATEMENT: end 'expr' - - body: end - close_func - localfunc: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'expr' line=11 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VLOCAL' - explist1: end - -- STATEMENT: end 'expr' - - -- STATEMENT: begin 'expr' line=12 - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - expr_stat: assignment k='VLOCAL' - assignment: '=' -- RHS elements follows - explist1: begin - expr: - prefixexp: - str_checkname: 'baz' - singlevar(kind): 'VGLOBAL' - explist1: end - -- STATEMENT: end 'expr' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_09.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_09.lua deleted file mode 100644 index bfa3920..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_09.lua +++ /dev/null @@ -1,53 +0,0 @@ --- START OF SOURCE -- - function foo:bar() - print(self) - end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'function' line=1 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar(kind): 'VGLOBAL' - funcname: -- ':' field - field: operator=: - checkname: - str_checkname: 'bar' - codestring: "bar" - funcname: end - function_stat: body needself='true' - open_func - body: begin - new_localvar: 'self' - body: parlist - parlist: begin - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'self' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_10.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_10.lua deleted file mode 100644 index 9a38883..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_10.lua +++ /dev/null @@ -1,49 +0,0 @@ --- START OF SOURCE -- - function foo(...) - print(arg) - end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'function' line=1 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar(kind): 'VGLOBAL' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - parlist: ... (dots) - new_localvar: 'arg' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'arg' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_11.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_11.lua deleted file mode 100644 index e4c9e21..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_11.lua +++ /dev/null @@ -1,79 +0,0 @@ --- START OF SOURCE -- - local c,d - function foo(a,b,c) - print(a,c,d,e) - end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'local' line=1 - local_stat: local statement - localstat: begin - str_checkname: 'c' - new_localvar: 'c' - str_checkname: 'd' - new_localvar: 'd' - localstat: end - -- STATEMENT: end 'local' - - -- STATEMENT: begin 'function' line=2 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar(kind): 'VGLOBAL' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'a' - new_localvar: 'a' - str_checkname: 'b' - new_localvar: 'b' - str_checkname: 'c' - new_localvar: 'c' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'a' - singlevar(kind): 'VLOCAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'c' - singlevar(kind): 'VLOCAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'd' - singlevar(kind): 'VUPVAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'e' - singlevar(kind): 'VGLOBAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_12.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_12.lua deleted file mode 100644 index b278ba2..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_12.lua +++ /dev/null @@ -1,94 +0,0 @@ --- START OF SOURCE -- - function foo(a,b) - local bar = function(c,d) - print(a,b,c,d) - end - end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'function' line=1 - function_stat: begin - funcname: begin - str_checkname: 'foo' - singlevar(kind): 'VGLOBAL' - funcname: end - function_stat: body needself='false' - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'a' - new_localvar: 'a' - str_checkname: 'b' - new_localvar: 'b' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'local' line=2 - local_stat: local statement - localstat: begin - str_checkname: 'bar' - new_localvar: 'bar' - localstat: -- assignment - explist1: begin - expr: - simpleexp: function - open_func - body: begin - body: parlist - parlist: begin - str_checkname: 'c' - new_localvar: 'c' - str_checkname: 'd' - new_localvar: 'd' - parlist: end - body: chunk - chunk: - -- STATEMENT: begin 'expr' line=3 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'a' - singlevar(kind): 'VUPVAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'b' - singlevar(kind): 'VUPVAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'c' - singlevar(kind): 'VLOCAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'd' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - body: end - close_func - explist1: end - localstat: end - -- STATEMENT: end 'local' - - body: end - close_func - function_stat: end - -- STATEMENT: end 'function' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_13.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_13.lua deleted file mode 100644 index 6e4850c..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_13.lua +++ /dev/null @@ -1,117 +0,0 @@ --- START OF SOURCE -- - for i = 1,10 do - print(i) - end - for i = 1,10,-2 do - print(i) - end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'for' line=1 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'i' - for_stat: numerical loop - new_localvar: 'i' - new_localvar: '(for limit)' - new_localvar: '(for step)' - fornum: begin - fornum: index start - exp1: begin - expr: - simpleexp: =1 - exp1: end - fornum: index stop - exp1: begin - expr: - simpleexp: =10 - exp1: end - fornum: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'i' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - fornum: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - -- STATEMENT: begin 'for' line=4 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'i' - for_stat: numerical loop - new_localvar: 'i' - new_localvar: '(for limit)' - new_localvar: '(for step)' - fornum: begin - fornum: index start - exp1: begin - expr: - simpleexp: =1 - exp1: end - fornum: index stop - exp1: begin - expr: - simpleexp: =10 - exp1: end - fornum: index step - exp1: begin - expr: - subexpr: uop='-' - simpleexp: =2 - exp1: end - fornum: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'i' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - fornum: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_14.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_14.lua deleted file mode 100644 index f80c33f..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/parser_log/sample_b_14.lua +++ /dev/null @@ -1,125 +0,0 @@ --- START OF SOURCE -- - for foo in bar() do - print(foo) - end - for foo,bar,baz in spring() do - print(foo,bar,baz) - end --- END OF SOURCE -- - --- TOP: begin - open_func - - chunk: - -- STATEMENT: begin 'for' line=1 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'foo' - for_stat: list-based loop - forlist: begin - new_localvar: '(for generator)' - new_localvar: '(for state)' - new_localvar: 'foo' - forlist: explist1 - explist1: begin - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - funcargs: end -- expr is a VCALL - explist1: end - forlist: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=2 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - forlist: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - -- STATEMENT: begin 'for' line=4 - for_stat: begin - enterblock(isbreakable=false) - str_checkname: 'foo' - for_stat: list-based loop - forlist: begin - new_localvar: '(for generator)' - new_localvar: '(for state)' - new_localvar: 'foo' - str_checkname: 'bar' - new_localvar: 'bar' - str_checkname: 'baz' - new_localvar: 'baz' - forlist: explist1 - explist1: begin - expr: - prefixexp: - str_checkname: 'spring' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - funcargs: end -- expr is a VCALL - explist1: end - forlist: body - enterblock(isbreakable=true) - block: begin - enterblock(isbreakable=false) - chunk: - -- STATEMENT: begin 'expr' line=5 - prefixexp: - str_checkname: 'print' - singlevar(kind): 'VGLOBAL' - primaryexp: ( funcargs - funcargs: begin '(' - explist1: begin - expr: - prefixexp: - str_checkname: 'foo' - singlevar(kind): 'VLOCAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'bar' - singlevar(kind): 'VLOCAL' - explist1: ',' -- continuation - expr: - prefixexp: - str_checkname: 'baz' - singlevar(kind): 'VLOCAL' - explist1: end - funcargs: end -- expr is a VCALL - expr_stat: function call k='VCALL' - -- STATEMENT: end 'expr' - - leaveblock - block: end - leaveblock - forlist: end - leaveblock - for_stat: end - -- STATEMENT: end 'for' - - close_func --- TOP: end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/sample.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/sample.lua deleted file mode 100644 index dc6eaee..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/sample.lua +++ /dev/null @@ -1,3 +0,0 @@ -local a = 47 -local b = "hello, world!" -print(a, b) diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk2.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk2.lua deleted file mode 100644 index ff8cec5..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk2.lua +++ /dev/null @@ -1,499 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_llex.lua - Test for llex.lua - This file is part of Yueliang. - - Copyright (c) 2005-2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - ------------------------------------------------------------------------- --- if BRIEF is not set to false, auto-test will silently succeed ------------------------------------------------------------------------- -BRIEF = true -- if set to true, messages are less verbose - -local zio_init = require("../lzio_mk2") -local lex_init = require("../llex_mk2") - ------------------------------------------------------------------------- --- simple manual tests ------------------------------------------------------------------------- - ---[[ -local function dump(z, source) - local luaX = lex_init(z, source) - while true do - local tok, seminfo = luaX:lex() - if tok == "" then - seminfo = " "..seminfo - elseif tok == "" then - seminfo = " "..seminfo - elseif tok == "" then - seminfo = " '"..seminfo.."'" - else - seminfo = "" - end - io.stdout:write(tok..seminfo.."\n") - if tok == "" then break end - end -end - -local function try_string(chunk) - dump(zio_init(chunk), "=string") -end -local function try_file(filename) - local f = "@"..filename - dump(zio_init(f), f) -end - -z = try_string("local c = z:getc()") -z = try_file("test_lzio_mk2.lua") -z = try_file("test_llex_mk2.lua") -os.exit() ---]] - ------------------------------------------------------------------------- --- auto-testing of simple test cases to validate lexer behaviour: --- * NOTE coverage has not been checked; not comprehensive --- * only test cases with non-empty comments are processed --- * if no result, then the output is displayed for manual decision --- (output may be used to set expected success or fail text) --- * cases expected to be successful may be a partial match --- * cases expected to fail may also be a partial match ------------------------------------------------------------------------- - --- [[ -local function auto_test() - local PASS, FAIL = true, false - ------------------------------------------------------------------ - -- table of test cases - ------------------------------------------------------------------ - local test_cases = - { - ------------------------------------------------------------- - --{ "comment", -- comment about the test - -- "chunk", -- chunk to test - -- PASS, -- PASS or FAIL outcome - -- "output", -- output to compare against - --}, - ------------------------------------------------------------- - { "empty chunk string, test EOS", - "", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "line number counting", - "\n\n\r\n", - PASS, "4 ", - }, - ------------------------------------------------------------- - { "various whitespaces", - " \n\t\t\n \t \t \n\n", - PASS, "5 ", - }, - ------------------------------------------------------------- - { "short comment ending in EOS", - "-- moo moo", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "short comment ending in newline", - "-- moo moo\n", - PASS, "2 ", - }, - ------------------------------------------------------------- - { "several lines of short comments", - "--moo\n-- moo moo\n\n--\tmoo\n", - PASS, "5 ", - }, - ------------------------------------------------------------- - { "basic block comment", - "--[[bovine]]", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "unterminated block comment 1", - "--[[bovine", - FAIL, ":1: unfinished long comment near ''", - }, - ------------------------------------------------------------- - { "unterminated block comment 2", - "--[[bovine]", - FAIL, ":1: unfinished long comment near ''", - }, - ------------------------------------------------------------- - { "unterminated block comment 3", - "--[[bovine\nmoo moo\nwoof", - FAIL, ":3: unfinished long comment near ''", - }, - ------------------------------------------------------------- - { "basic long string", - "\n[[bovine]]\n", - PASS, "2 = bovine\n3 ", - }, - ------------------------------------------------------------- - { "first newline consumed in long string", - "[[\nmoo]]", - PASS, "2 = moo\n2 ", - }, - ------------------------------------------------------------- - { "multiline long string", - "[[moo\nmoo moo\n]]", - PASS, "3 = moo\nmoo moo\n\n3 ", - }, - ------------------------------------------------------------- - { "unterminated long string 1", - "\n[[\nbovine", - FAIL, ":3: unfinished long string near ''", - }, - ------------------------------------------------------------- - { "unterminated long string 2", - "[[bovine]", - FAIL, ":1: unfinished long string near ''", - }, - ------------------------------------------------------------- - { "unterminated long string 3", - "[[[[ \n", - FAIL, ":2: unfinished long string near ''", - }, - ------------------------------------------------------------- - { "nested long string 1", - "[[moo[[moo]]moo]]", - PASS, "moo[[moo]]moo", - }, - ------------------------------------------------------------- - { "nested long string 2", - "[[moo[[moo[[[[]]]]moo]]moo]]", - PASS, "moo[[moo[[[[]]]]moo]]moo", - }, - ------------------------------------------------------------- - { "nested long string 3", - "[[[[[[]]]][[[[]]]]]]", - PASS, "[[[[]]]][[[[]]]]", - }, - ------------------------------------------------------------- - { "brackets in long strings 1", - "[[moo[moo]]", - PASS, "moo[moo", - }, - ------------------------------------------------------------- - { "brackets in long strings 2", - "[[moo[[moo]moo]]moo]]", - PASS, "moo[[moo]moo]]moo", - }, - ------------------------------------------------------------- - { "unprocessed escapes in long strings", - [[ [[\a\b\f\n\r\t\v\123]] ]], - PASS, [[\a\b\f\n\r\t\v\123]], - }, - ------------------------------------------------------------- - { "unbalanced long string", - "[[moo]]moo]]", - PASS, "1 = moo\n1 = moo\n1 CHAR = ']'\n1 CHAR = ']'\n1 ", - }, - ------------------------------------------------------------- - { "keywords 1", - "and break do else", - PASS, "1 and\n1 break\n1 do\n1 else\n1 ", - }, - ------------------------------------------------------------- - { "keywords 2", - "elseif end false for", - PASS, "1 elseif\n1 end\n1 false\n1 for\n1 ", - }, - ------------------------------------------------------------- - { "keywords 3", - "function if in local nil", - PASS, "1 function\n1 if\n1 in\n1 local\n1 nil\n1 ", - }, - ------------------------------------------------------------- - { "keywords 4", - "not or repeat return", - PASS, "1 not\n1 or\n1 repeat\n1 return\n1 ", - }, - ------------------------------------------------------------- - { "keywords 5", - "then true until while", - PASS, "1 then\n1 true\n1 until\n1 while\n1 ", - }, - ------------------------------------------------------------- - { "concat and dots", - ".. ...", - PASS, "1 ..\n1 ...\n1 ", - }, - ------------------------------------------------------------- - { "shbang handling 1", - "#blahblah", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "shbang handling 2", - "#blahblah\nmoo moo\n", - PASS, "2 = moo\n2 = moo\n3 ", - }, - ------------------------------------------------------------- - { "empty string", - [['']], - PASS, "1 = \n1 ", - }, - ------------------------------------------------------------- - { "single-quoted string", - [['bovine']], - PASS, "1 = bovine\n1 ", - }, - ------------------------------------------------------------- - { "double-quoted string", - [["bovine"]], - PASS, "1 = bovine\n1 ", - }, - ------------------------------------------------------------- - { "unterminated string 1", - [['moo ]], - FAIL, ":1: unfinished string near ''", - }, - ------------------------------------------------------------- - { "unterminated string 2", - [["moo \n]], - FAIL, ":1: unfinished string near ''", - }, - ------------------------------------------------------------- - { "escaped newline in string, line number counted", - "\"moo\\\nmoo\\\nmoo\"", - PASS, "3 = moo\nmoo\nmoo\n3 ", - }, - ------------------------------------------------------------- - { "escaped characters in string 1", - [["moo\amoo"]], - PASS, "1 = moo\amoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 2", - [["moo\bmoo"]], - PASS, "1 = moo\bmoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 3", - [["moo\f\n\r\t\vmoo"]], - PASS, "1 = moo\f\n\r\t\vmoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 4", - [["\\ \" \' \? \[ \]"]], - PASS, "1 = \\ \" \' \? \[ \]", - }, - ------------------------------------------------------------- - { "escaped characters in string 5", - [["\z \k \: \;"]], - PASS, "1 = z k : ;", - }, - ------------------------------------------------------------- - { "escaped characters in string 6", - [["\8 \65 \160 \180K \097097"]], - PASS, "1 = \8 \65 \160 \180K \097097\n", - }, - ------------------------------------------------------------- - { "escaped characters in string 7", - [["\666"]], - FAIL, ":1: escape sequence too large near '\"'", - }, - ------------------------------------------------------------- - { "simple numbers", - "123 123+", - PASS, "1 = 123\n1 = 123\n1 CHAR = '+'\n1 ", - }, - ------------------------------------------------------------- - { "longer numbers", - "1234567890 12345678901234567890", - PASS, "1 = 1234567890\n1 = 1.2345678901235e+19\n", - }, - ------------------------------------------------------------- - { "fractional numbers", - ".123 .12345678901234567890", - PASS, "1 = 0.123\n1 = 0.12345678901235\n", - }, - ------------------------------------------------------------- - { "more numbers with decimal points", - "12345.67890 1.1.", - PASS, "1 = 12345.6789\n1 = 1.1\n1 CHAR = '.'\n", - }, - ------------------------------------------------------------- - { "double decimal points", - ".1.1", - FAIL, ":1: malformed number near '.1.1'", - }, - ------------------------------------------------------------- - { "double dots within numbers", - "1..1", - FAIL, ":1: ambiguous syntax (dots follows digits) near '1..'", - }, - ------------------------------------------------------------- - { "incomplete exponential numbers", - "123e", - FAIL, ":1: malformed number near '123e'", - }, - ------------------------------------------------------------- - { "exponential numbers 1", - "1234e5 1234e5.", - PASS, "1 = 123400000\n1 = 123400000\n1 CHAR = '.'", - }, - ------------------------------------------------------------- - { "exponential numbers 2", - "1234e56 1.23e123", - PASS, "1 = 1.234e+59\n1 = 1.23e+123\n", - }, - ------------------------------------------------------------- - { "exponential numbers 3", - "12.34e+", - FAIL, ":1: malformed number near '12.34e+'", - }, - ------------------------------------------------------------- - { "exponential numbers 4", - "12.34e+5 123.4e-5 1234.E+5", - PASS, "1 = 1234000\n1 = 0.001234\n1 = 123400000\n", - }, - ------------------------------------------------------------- - { "single character symbols 1", - "= > < ~", - PASS, "1 CHAR = '='\n1 CHAR = '>'\n1 CHAR = '<'\n1 CHAR = '~'\n", - }, - ------------------------------------------------------------- - { "double character symbols", - "== >= <= ~=", - PASS, "1 ==\n1 >=\n1 <=\n1 ~=\n", - }, - ------------------------------------------------------------- - { "simple identifiers", - "abc ABC", - PASS, "1 = abc\n1 = ABC\n1 ", - }, - ------------------------------------------------------------- - { "more identifiers", - "_abc _ABC", - PASS, "1 = _abc\n1 = _ABC\n1 ", - }, - ------------------------------------------------------------- - { "still more identifiers", - "_aB_ _123", - PASS, "1 = _aB_\n1 = _123\n1 ", - }, - ------------------------------------------------------------- - { "invalid control character", - "\4", - FAIL, ":1: invalid control char near 'char(4)'", - }, - ------------------------------------------------------------- - { "single character symbols 2", - "` ! @ $ %", - PASS, "1 CHAR = '`'\n1 CHAR = '!'\n1 CHAR = '@'\n1 CHAR = '$'\n1 CHAR = '%'\n", - }, - ------------------------------------------------------------- - { "single character symbols 3", - "^ & * ( )", - PASS, "1 CHAR = '^'\n1 CHAR = '&'\n1 CHAR = '*'\n1 CHAR = '('\n1 CHAR = ')'\n", - }, - ------------------------------------------------------------- - { "single character symbols 4", - "_ - + \\ |", - PASS, "1 = _\n1 CHAR = '-'\n1 CHAR = '+'\n1 CHAR = '\\'\n1 CHAR = '|'\n", - }, - ------------------------------------------------------------- - { "single character symbols 5", - "{ } [ ] :", - PASS, "1 CHAR = '{'\n1 CHAR = '}'\n1 CHAR = '['\n1 CHAR = ']'\n1 CHAR = ':'\n", - }, - ------------------------------------------------------------- - { "single character symbols 6", - "; , . / ?", - PASS, "1 CHAR = ';'\n1 CHAR = ','\n1 CHAR = '.'\n1 CHAR = '/'\n1 CHAR = '?'\n", - }, - ------------------------------------------------------------- - } - ------------------------------------------------------------------ - -- perform a test case - ------------------------------------------------------------------ - function do_test_case(count, test_case) - if comment == "" then return end -- skip empty entries - local comment, chunk, outcome, matcher = unpack(test_case) - local result = PASS - local output = "" - -- initialize lexer - local z = zio_init(chunk) - local luaX = lex_init(z, "=test") - -- lexer test loop - local status, token, seminfo - repeat - -- protected call - status, token, seminfo = pcall(luaX.lex, luaX) - output = output..luaX.lineno.." " - if status then - -- successful call - if string.len(token) > 1 then - if token == "" - or token == "" - or token == "" then - token = token.." = "..seminfo - end - elseif string.byte(token) >= 32 then -- displayable chars - token = "CHAR = '"..token.."'" - else -- control characters - token = "CHAR = (".. string.byte(token)..")" - end - output = output..token.."\n" - else - -- failed call - output = output..token -- token is the error message - result = FAIL - break - end - until token == "" - -- decision making and reporting - local head = "Test "..count..": "..comment - if matcher == "" then - -- nothing to check against, display for manual check - print(head.."\nMANUAL please check manually".. - "\n--chunk---------------------------------\n"..chunk.. - "\n--actual--------------------------------\n"..output.. - "\n\n") - return - else - if outcome == PASS then - -- success expected, may be a partial match - if string.find(output, matcher, 1, 1) and result == PASS then - if not BRIEF then print(head.."\nOK expected success\n") end - return - end - else - -- failure expected, may be a partial match - if string.find(output, matcher, 1, 1) and result == FAIL then - if not BRIEF then print(head.."\nOK expected failure\n") end - return - end - end - -- failed because of unmatched string or boolean result - local function passfail(status) - if status == PASS then return "PASS" else return "FAIL" end - end - print(head.." *FAILED*".. - "\noutcome="..passfail(outcome).. - "\nactual= "..passfail(result).. - "\n--chunk---------------------------------\n"..chunk.. - "\n--expected------------------------------\n"..matcher.. - "\n--actual--------------------------------\n"..output.. - "\n\n") - end - end - ------------------------------------------------------------------ - -- perform auto testing - ------------------------------------------------------------------ - for i,test_case in ipairs(test_cases) do - do_test_case(i, test_case) - end -end - -auto_test() ---]] diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk3.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk3.lua deleted file mode 100644 index 8b0eec9..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk3.lua +++ /dev/null @@ -1,500 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_llex.lua - Test for llex.lua - This file is part of Yueliang. - - Copyright (c) 2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - ------------------------------------------------------------------------- --- if BRIEF is not set to false, auto-test will silently succeed ------------------------------------------------------------------------- -BRIEF = true -- if set to true, messages are less verbose - -local lex_init = require("../llex_mk3") - ------------------------------------------------------------------------- --- simple manual tests ------------------------------------------------------------------------- - ---[[ -local function dump(z, source) - local luaX = lex_init(z, source) - while true do - local tok, seminfo = luaX:lex() - if tok == "" then - seminfo = " "..seminfo - elseif tok == "" then - seminfo = " "..seminfo - elseif tok == "" then - seminfo = " '"..seminfo.."'" - else - seminfo = "" - end - io.stdout:write(tok..seminfo.."\n") - if tok == "" then break end - end -end - -local function try_string(chunk) - dump(chunk, "=string") -end -local function try_file(filename) - local inf = io.open(filename, "r") - if not inf then error("file not found") end - local data = inf:read("*a") - inf:close() - dump(data, "@"..filename) -end - -z = try_string("local c = z:getc()") -z = try_file("test_lzio_mk2.lua") -z = try_file("test_llex_mk2.lua") -os.exit() ---]] - ------------------------------------------------------------------------- --- auto-testing of simple test cases to validate lexer behaviour: --- * NOTE coverage has not been checked; not comprehensive --- * only test cases with non-empty comments are processed --- * if no result, then the output is displayed for manual decision --- (output may be used to set expected success or fail text) --- * cases expected to be successful may be a partial match --- * cases expected to fail may also be a partial match ------------------------------------------------------------------------- - --- [[ -local function auto_test() - local PASS, FAIL = true, false - ------------------------------------------------------------------ - -- table of test cases - ------------------------------------------------------------------ - local test_cases = - { - ------------------------------------------------------------- - --{ "comment", -- comment about the test - -- "chunk", -- chunk to test - -- PASS, -- PASS or FAIL outcome - -- "output", -- output to compare against - --}, - ------------------------------------------------------------- - { "empty chunk string, test EOS", - "", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "line number counting", - "\n\n\r\n", - PASS, "4 ", - }, - ------------------------------------------------------------- - { "various whitespaces", - " \n\t\t\n \t \t \n\n", - PASS, "5 ", - }, - ------------------------------------------------------------- - { "short comment ending in EOS", - "-- moo moo", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "short comment ending in newline", - "-- moo moo\n", - PASS, "2 ", - }, - ------------------------------------------------------------- - { "several lines of short comments", - "--moo\n-- moo moo\n\n--\tmoo\n", - PASS, "5 ", - }, - ------------------------------------------------------------- - { "basic block comment", - "--[[bovine]]", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "unterminated block comment 1", - "--[[bovine", - FAIL, ":1: unfinished long comment", - }, - ------------------------------------------------------------- - { "unterminated block comment 2", - "--[[bovine]", - FAIL, ":1: unfinished long comment", - }, - ------------------------------------------------------------- - { "unterminated block comment 3", - "--[[bovine\nmoo moo\nwoof", - FAIL, ":3: unfinished long comment", - }, - ------------------------------------------------------------- - { "basic long string", - "\n[[bovine]]\n", - PASS, "2 = bovine\n3 ", - }, - ------------------------------------------------------------- - { "first newline consumed in long string", - "[[\nmoo]]", - PASS, "2 = moo\n2 ", - }, - ------------------------------------------------------------- - { "multiline long string", - "[[moo\nmoo moo\n]]", - PASS, "3 = moo\nmoo moo\n\n3 ", - }, - ------------------------------------------------------------- - { "unterminated long string 1", - "\n[[\nbovine", - FAIL, ":3: unfinished long string", - }, - ------------------------------------------------------------- - { "unterminated long string 2", - "[[bovine]", - FAIL, ":1: unfinished long string", - }, - ------------------------------------------------------------- - { "unterminated long string 3", - "[[[[ \n", - FAIL, ":2: unfinished long string", - }, - ------------------------------------------------------------- - { "nested long string 1", - "[[moo[[moo]]moo]]", - PASS, "moo[[moo]]moo", - }, - ------------------------------------------------------------- - { "nested long string 2", - "[[moo[[moo[[[[]]]]moo]]moo]]", - PASS, "moo[[moo[[[[]]]]moo]]moo", - }, - ------------------------------------------------------------- - { "nested long string 3", - "[[[[[[]]]][[[[]]]]]]", - PASS, "[[[[]]]][[[[]]]]", - }, - ------------------------------------------------------------- - { "brackets in long strings 1", - "[[moo[moo]]", - PASS, "moo[moo", - }, - ------------------------------------------------------------- - { "brackets in long strings 2", - "[[moo[[moo]moo]]moo]]", - PASS, "moo[[moo]moo]]moo", - }, - ------------------------------------------------------------- - { "unprocessed escapes in long strings", - [[ [[\a\b\f\n\r\t\v\123]] ]], - PASS, [[\a\b\f\n\r\t\v\123]], - }, - ------------------------------------------------------------- - { "unbalanced long string", - "[[moo]]moo]]", - PASS, "1 = moo\n1 = moo\n1 CHAR = ']'\n1 CHAR = ']'\n1 ", - }, - ------------------------------------------------------------- - { "keywords 1", - "and break do else", - PASS, "1 and\n1 break\n1 do\n1 else\n1 ", - }, - ------------------------------------------------------------- - { "keywords 2", - "elseif end false for", - PASS, "1 elseif\n1 end\n1 false\n1 for\n1 ", - }, - ------------------------------------------------------------- - { "keywords 3", - "function if in local nil", - PASS, "1 function\n1 if\n1 in\n1 local\n1 nil\n1 ", - }, - ------------------------------------------------------------- - { "keywords 4", - "not or repeat return", - PASS, "1 not\n1 or\n1 repeat\n1 return\n1 ", - }, - ------------------------------------------------------------- - { "keywords 5", - "then true until while", - PASS, "1 then\n1 true\n1 until\n1 while\n1 ", - }, - ------------------------------------------------------------- - { "concat and dots", - ".. ...", - PASS, "1 ..\n1 ...\n1 ", - }, - ------------------------------------------------------------- - { "shbang handling 1", - "#blahblah", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "shbang handling 2", - "#blahblah\nmoo moo\n", - PASS, "2 = moo\n2 = moo\n3 ", - }, - ------------------------------------------------------------- - { "empty string", - [['']], - PASS, "1 = \n1 ", - }, - ------------------------------------------------------------- - { "single-quoted string", - [['bovine']], - PASS, "1 = bovine\n1 ", - }, - ------------------------------------------------------------- - { "double-quoted string", - [["bovine"]], - PASS, "1 = bovine\n1 ", - }, - ------------------------------------------------------------- - { "unterminated string 1", - [['moo ]], - FAIL, ":1: unfinished string", - }, - ------------------------------------------------------------- - { "unterminated string 2", - [["moo \n]], - FAIL, ":1: unfinished string", - }, - ------------------------------------------------------------- - { "escaped newline in string, line number counted", - "\"moo\\\nmoo\\\nmoo\"", - PASS, "3 = moo\nmoo\nmoo\n3 ", - }, - ------------------------------------------------------------- - { "escaped characters in string 1", - [["moo\amoo"]], - PASS, "1 = moo\amoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 2", - [["moo\bmoo"]], - PASS, "1 = moo\bmoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 3", - [["moo\f\n\r\t\vmoo"]], - PASS, "1 = moo\f\n\r\t\vmoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 4", - [["\\ \" \' \? \[ \]"]], - PASS, "1 = \\ \" \' \? \[ \]", - }, - ------------------------------------------------------------- - { "escaped characters in string 5", - [["\z \k \: \;"]], - PASS, "1 = z k : ;", - }, - ------------------------------------------------------------- - { "escaped characters in string 6", - [["\8 \65 \160 \180K \097097"]], - PASS, "1 = \8 \65 \160 \180K \097097\n", - }, - ------------------------------------------------------------- - { "escaped characters in string 7", - [["\666"]], - FAIL, ":1: escape sequence too large", - }, - ------------------------------------------------------------- - { "simple numbers", - "123 123+", - PASS, "1 = 123\n1 = 123\n1 CHAR = '+'\n1 ", - }, - ------------------------------------------------------------- - { "longer numbers", - "1234567890 12345678901234567890", - PASS, "1 = 1234567890\n1 = 1.2345678901235e+19\n", - }, - ------------------------------------------------------------- - { "fractional numbers", - ".123 .12345678901234567890", - PASS, "1 = 0.123\n1 = 0.12345678901235\n", - }, - ------------------------------------------------------------- - { "more numbers with decimal points", - "12345.67890 1.1.", - PASS, "1 = 12345.6789\n1 = 1.1\n1 CHAR = '.'\n", - }, - ------------------------------------------------------------- - { "double decimal points", - ".1.1", - FAIL, ":1: malformed number", - }, - ------------------------------------------------------------- - { "double dots within numbers", - "1..1", - FAIL, ":1: ambiguous syntax (dots follows digits)", - }, - ------------------------------------------------------------- - { "incomplete exponential numbers", - "123e", - FAIL, ":1: malformed number", - }, - ------------------------------------------------------------- - { "exponential numbers 1", - "1234e5 1234e5.", - PASS, "1 = 123400000\n1 = 123400000\n1 CHAR = '.'", - }, - ------------------------------------------------------------- - { "exponential numbers 2", - "1234e56 1.23e123", - PASS, "1 = 1.234e+59\n1 = 1.23e+123\n", - }, - ------------------------------------------------------------- - { "exponential numbers 3", - "12.34e+", - FAIL, ":1: malformed number", - }, - ------------------------------------------------------------- - { "exponential numbers 4", - "12.34e+5 123.4e-5 1234.E+5", - PASS, "1 = 1234000\n1 = 0.001234\n1 = 123400000\n", - }, - ------------------------------------------------------------- - { "single character symbols 1", - "= > < ~", - PASS, "1 CHAR = '='\n1 CHAR = '>'\n1 CHAR = '<'\n1 CHAR = '~'\n", - }, - ------------------------------------------------------------- - { "double character symbols", - "== >= <= ~=", - PASS, "1 ==\n1 >=\n1 <=\n1 ~=\n", - }, - ------------------------------------------------------------- - { "simple identifiers", - "abc ABC", - PASS, "1 = abc\n1 = ABC\n1 ", - }, - ------------------------------------------------------------- - { "more identifiers", - "_abc _ABC", - PASS, "1 = _abc\n1 = _ABC\n1 ", - }, - ------------------------------------------------------------- - { "still more identifiers", - "_aB_ _123", - PASS, "1 = _aB_\n1 = _123\n1 ", - }, - ------------------------------------------------------------- - { "invalid control character", - "\4", - FAIL, ":1: invalid control char", - }, - ------------------------------------------------------------- - { "single character symbols 2", - "` ! @ $ %", - PASS, "1 CHAR = '`'\n1 CHAR = '!'\n1 CHAR = '@'\n1 CHAR = '$'\n1 CHAR = '%'\n", - }, - ------------------------------------------------------------- - { "single character symbols 3", - "^ & * ( )", - PASS, "1 CHAR = '^'\n1 CHAR = '&'\n1 CHAR = '*'\n1 CHAR = '('\n1 CHAR = ')'\n", - }, - ------------------------------------------------------------- - { "single character symbols 4", - "_ - + \\ |", - PASS, "1 = _\n1 CHAR = '-'\n1 CHAR = '+'\n1 CHAR = '\\'\n1 CHAR = '|'\n", - }, - ------------------------------------------------------------- - { "single character symbols 5", - "{ } [ ] :", - PASS, "1 CHAR = '{'\n1 CHAR = '}'\n1 CHAR = '['\n1 CHAR = ']'\n1 CHAR = ':'\n", - }, - ------------------------------------------------------------- - { "single character symbols 6", - "; , . / ?", - PASS, "1 CHAR = ';'\n1 CHAR = ','\n1 CHAR = '.'\n1 CHAR = '/'\n1 CHAR = '?'\n", - }, - ------------------------------------------------------------- - } - ------------------------------------------------------------------ - -- perform a test case - ------------------------------------------------------------------ - function do_test_case(count, test_case) - if comment == "" then return end -- skip empty entries - local comment, chunk, outcome, matcher = unpack(test_case) - local result = PASS - local output = "" - -- initialize lexer - local luaX = lex_init(chunk, "=test") - -- lexer test loop - local status, token, seminfo - repeat - -- protected call - status, token, seminfo = pcall(luaX.lex, luaX) - output = output..luaX.ln.." " - if status then - -- successful call - if string.len(token) > 1 then - if token == "" - or token == "" - or token == "" then - token = token.." = "..seminfo - end - elseif string.byte(token) >= 32 then -- displayable chars - token = "CHAR = '"..token.."'" - else -- control characters - token = "CHAR = (".. string.byte(token)..")" - end - output = output..token.."\n" - else - -- failed call - output = output..token -- token is the error message - result = FAIL - break - end - until token == "" - -- decision making and reporting - local head = "Test "..count..": "..comment - if matcher == "" then - -- nothing to check against, display for manual check - print(head.."\nMANUAL please check manually".. - "\n--chunk---------------------------------\n"..chunk.. - "\n--actual--------------------------------\n"..output.. - "\n\n") - return - else - if outcome == PASS then - -- success expected, may be a partial match - if string.find(output, matcher, 1, 1) and result == PASS then - if not BRIEF then print(head.."\nOK expected success\n") end - return - end - else - -- failure expected, may be a partial match - if string.find(output, matcher, 1, 1) and result == FAIL then - if not BRIEF then print(head.."\nOK expected failure\n") end - return - end - end - -- failed because of unmatched string or boolean result - local function passfail(status) - if status == PASS then return "PASS" else return "FAIL" end - end - print(head.." *FAILED*".. - "\noutcome="..passfail(outcome).. - "\nactual= "..passfail(result).. - "\n--chunk---------------------------------\n"..chunk.. - "\n--expected------------------------------\n"..matcher.. - "\n--actual--------------------------------\n"..output.. - "\n\n") - end - end - ------------------------------------------------------------------ - -- perform auto testing - ------------------------------------------------------------------ - for i,test_case in ipairs(test_cases) do - do_test_case(i, test_case) - end -end - -auto_test() ---]] diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk4.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk4.lua deleted file mode 100644 index 316a9bf..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_llex_mk4.lua +++ /dev/null @@ -1,499 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_llex.lua - Test for llex.lua - This file is part of Yueliang. - - Copyright (c) 2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - ------------------------------------------------------------------------- --- if BRIEF is not set to false, auto-test will silently succeed ------------------------------------------------------------------------- -BRIEF = true -- if set to true, messages are less verbose - -local zio_init = require("../lzio_mk4") -local lex_init = require("../llex_mk4") - ------------------------------------------------------------------------- --- simple manual tests ------------------------------------------------------------------------- - ---[[ -local function dump(z, source) - local luaX = lex_init(z, source) - while true do - local tok, seminfo = luaX:lex() - if tok == "" then - seminfo = " "..seminfo - elseif tok == "" then - seminfo = " "..seminfo - elseif tok == "" then - seminfo = " '"..seminfo.."'" - else - seminfo = "" - end - io.stdout:write(tok..seminfo.."\n") - if tok == "" then break end - end -end - -local function try_string(chunk) - dump(zio_init(chunk), "=string") -end -local function try_file(filename) - local f = "@"..filename - dump(zio_init(f), f) -end - -z = try_string("local c = z:getc()") -z = try_file("test_lzio_mk2.lua") -z = try_file("test_llex_mk2.lua") -os.exit() ---]] - ------------------------------------------------------------------------- --- auto-testing of simple test cases to validate lexer behaviour: --- * NOTE coverage has not been checked; not comprehensive --- * only test cases with non-empty comments are processed --- * if no result, then the output is displayed for manual decision --- (output may be used to set expected success or fail text) --- * cases expected to be successful may be a partial match --- * cases expected to fail may also be a partial match ------------------------------------------------------------------------- - --- [[ -local function auto_test() - local PASS, FAIL = true, false - ------------------------------------------------------------------ - -- table of test cases - ------------------------------------------------------------------ - local test_cases = - { - ------------------------------------------------------------- - --{ "comment", -- comment about the test - -- "chunk", -- chunk to test - -- PASS, -- PASS or FAIL outcome - -- "output", -- output to compare against - --}, - ------------------------------------------------------------- - { "empty chunk string, test EOS", - "", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "line number counting", - "\n\n\r\n", - PASS, "4 ", - }, - ------------------------------------------------------------- - { "various whitespaces", - " \n\t\t\n \t \t \n\n", - PASS, "5 ", - }, - ------------------------------------------------------------- - { "short comment ending in EOS", - "-- moo moo", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "short comment ending in newline", - "-- moo moo\n", - PASS, "2 ", - }, - ------------------------------------------------------------- - { "several lines of short comments", - "--moo\n-- moo moo\n\n--\tmoo\n", - PASS, "5 ", - }, - ------------------------------------------------------------- - { "basic block comment", - "--[[bovine]]", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "unterminated block comment 1", - "--[[bovine", - FAIL, ":1: unfinished long comment", - }, - ------------------------------------------------------------- - { "unterminated block comment 2", - "--[[bovine]", - FAIL, ":1: unfinished long comment", - }, - ------------------------------------------------------------- - { "unterminated block comment 3", - "--[[bovine\nmoo moo\nwoof", - FAIL, ":3: unfinished long comment", - }, - ------------------------------------------------------------- - { "basic long string", - "\n[[bovine]]\n", - PASS, "2 = bovine\n3 ", - }, - ------------------------------------------------------------- - { "first newline consumed in long string", - "[[\nmoo]]", - PASS, "2 = moo\n2 ", - }, - ------------------------------------------------------------- - { "multiline long string", - "[[moo\nmoo moo\n]]", - PASS, "3 = moo\nmoo moo\n\n3 ", - }, - ------------------------------------------------------------- - { "unterminated long string 1", - "\n[[\nbovine", - FAIL, ":3: unfinished long string", - }, - ------------------------------------------------------------- - { "unterminated long string 2", - "[[bovine]", - FAIL, ":1: unfinished long string", - }, - ------------------------------------------------------------- - { "unterminated long string 3", - "[[[[ \n", - FAIL, ":2: unfinished long string", - }, - ------------------------------------------------------------- - { "nested long string 1", - "[[moo[[moo]]moo]]", - PASS, "moo[[moo]]moo", - }, - ------------------------------------------------------------- - { "nested long string 2", - "[[moo[[moo[[[[]]]]moo]]moo]]", - PASS, "moo[[moo[[[[]]]]moo]]moo", - }, - ------------------------------------------------------------- - { "nested long string 3", - "[[[[[[]]]][[[[]]]]]]", - PASS, "[[[[]]]][[[[]]]]", - }, - ------------------------------------------------------------- - { "brackets in long strings 1", - "[[moo[moo]]", - PASS, "moo[moo", - }, - ------------------------------------------------------------- - { "brackets in long strings 2", - "[[moo[[moo]moo]]moo]]", - PASS, "moo[[moo]moo]]moo", - }, - ------------------------------------------------------------- - { "unprocessed escapes in long strings", - [[ [[\a\b\f\n\r\t\v\123]] ]], - PASS, [[\a\b\f\n\r\t\v\123]], - }, - ------------------------------------------------------------- - { "unbalanced long string", - "[[moo]]moo]]", - PASS, "1 = moo\n1 = moo\n1 CHAR = ']'\n1 CHAR = ']'\n1 ", - }, - ------------------------------------------------------------- - { "keywords 1", - "and break do else", - PASS, "1 and\n1 break\n1 do\n1 else\n1 ", - }, - ------------------------------------------------------------- - { "keywords 2", - "elseif end false for", - PASS, "1 elseif\n1 end\n1 false\n1 for\n1 ", - }, - ------------------------------------------------------------- - { "keywords 3", - "function if in local nil", - PASS, "1 function\n1 if\n1 in\n1 local\n1 nil\n1 ", - }, - ------------------------------------------------------------- - { "keywords 4", - "not or repeat return", - PASS, "1 not\n1 or\n1 repeat\n1 return\n1 ", - }, - ------------------------------------------------------------- - { "keywords 5", - "then true until while", - PASS, "1 then\n1 true\n1 until\n1 while\n1 ", - }, - ------------------------------------------------------------- - { "concat and dots", - ".. ...", - PASS, "1 ..\n1 ...\n1 ", - }, - ------------------------------------------------------------- - { "shbang handling 1", - "#blahblah", - PASS, "1 ", - }, - ------------------------------------------------------------- - { "shbang handling 2", - "#blahblah\nmoo moo\n", - PASS, "2 = moo\n2 = moo\n3 ", - }, - ------------------------------------------------------------- - { "empty string", - [['']], - PASS, "1 = \n1 ", - }, - ------------------------------------------------------------- - { "single-quoted string", - [['bovine']], - PASS, "1 = bovine\n1 ", - }, - ------------------------------------------------------------- - { "double-quoted string", - [["bovine"]], - PASS, "1 = bovine\n1 ", - }, - ------------------------------------------------------------- - { "unterminated string 1", - [['moo ]], - FAIL, ":1: unfinished string", - }, - ------------------------------------------------------------- - { "unterminated string 2", - [["moo \n]], - FAIL, ":1: unfinished string", - }, - ------------------------------------------------------------- - { "escaped newline in string, line number counted", - "\"moo\\\nmoo\\\nmoo\"", - PASS, "3 = moo\nmoo\nmoo\n3 ", - }, - ------------------------------------------------------------- - { "escaped characters in string 1", - [["moo\amoo"]], - PASS, "1 = moo\amoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 2", - [["moo\bmoo"]], - PASS, "1 = moo\bmoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 3", - [["moo\f\n\r\t\vmoo"]], - PASS, "1 = moo\f\n\r\t\vmoo", - }, - ------------------------------------------------------------- - { "escaped characters in string 4", - [["\\ \" \' \? \[ \]"]], - PASS, "1 = \\ \" \' \? \[ \]", - }, - ------------------------------------------------------------- - { "escaped characters in string 5", - [["\z \k \: \;"]], - PASS, "1 = z k : ;", - }, - ------------------------------------------------------------- - { "escaped characters in string 6", - [["\8 \65 \160 \180K \097097"]], - PASS, "1 = \8 \65 \160 \180K \097097\n", - }, - ------------------------------------------------------------- - { "escaped characters in string 7", - [["\666"]], - FAIL, ":1: escape sequence too large", - }, - ------------------------------------------------------------- - { "simple numbers", - "123 123+", - PASS, "1 = 123\n1 = 123\n1 CHAR = '+'\n1 ", - }, - ------------------------------------------------------------- - { "longer numbers", - "1234567890 12345678901234567890", - PASS, "1 = 1234567890\n1 = 1.2345678901235e+19\n", - }, - ------------------------------------------------------------- - { "fractional numbers", - ".123 .12345678901234567890", - PASS, "1 = 0.123\n1 = 0.12345678901235\n", - }, - ------------------------------------------------------------- - { "more numbers with decimal points", - "12345.67890 1.1.", - PASS, "1 = 12345.6789\n1 = 1.1\n1 CHAR = '.'\n", - }, - ------------------------------------------------------------- - { "double decimal points", - ".1.1", - FAIL, ":1: malformed number", - }, - ------------------------------------------------------------- - { "double dots within numbers", - "1..1", - FAIL, ":1: ambiguous syntax (dots follows digits)", - }, - ------------------------------------------------------------- - { "incomplete exponential numbers", - "123e", - FAIL, ":1: malformed number", - }, - ------------------------------------------------------------- - { "exponential numbers 1", - "1234e5 1234e5.", - PASS, "1 = 123400000\n1 = 123400000\n1 CHAR = '.'", - }, - ------------------------------------------------------------- - { "exponential numbers 2", - "1234e56 1.23e123", - PASS, "1 = 1.234e+59\n1 = 1.23e+123\n", - }, - ------------------------------------------------------------- - { "exponential numbers 3", - "12.34e+", - FAIL, ":1: malformed number", - }, - ------------------------------------------------------------- - { "exponential numbers 4", - "12.34e+5 123.4e-5 1234.E+5", - PASS, "1 = 1234000\n1 = 0.001234\n1 = 123400000\n", - }, - ------------------------------------------------------------- - { "single character symbols 1", - "= > < ~", - PASS, "1 CHAR = '='\n1 CHAR = '>'\n1 CHAR = '<'\n1 CHAR = '~'\n", - }, - ------------------------------------------------------------- - { "double character symbols", - "== >= <= ~=", - PASS, "1 ==\n1 >=\n1 <=\n1 ~=\n", - }, - ------------------------------------------------------------- - { "simple identifiers", - "abc ABC", - PASS, "1 = abc\n1 = ABC\n1 ", - }, - ------------------------------------------------------------- - { "more identifiers", - "_abc _ABC", - PASS, "1 = _abc\n1 = _ABC\n1 ", - }, - ------------------------------------------------------------- - { "still more identifiers", - "_aB_ _123", - PASS, "1 = _aB_\n1 = _123\n1 ", - }, - ------------------------------------------------------------- - { "invalid control character", - "\4", - FAIL, ":1: invalid control char", - }, - ------------------------------------------------------------- - { "single character symbols 2", - "` ! @ $ %", - PASS, "1 CHAR = '`'\n1 CHAR = '!'\n1 CHAR = '@'\n1 CHAR = '$'\n1 CHAR = '%'\n", - }, - ------------------------------------------------------------- - { "single character symbols 3", - "^ & * ( )", - PASS, "1 CHAR = '^'\n1 CHAR = '&'\n1 CHAR = '*'\n1 CHAR = '('\n1 CHAR = ')'\n", - }, - ------------------------------------------------------------- - { "single character symbols 4", - "_ - + \\ |", - PASS, "1 = _\n1 CHAR = '-'\n1 CHAR = '+'\n1 CHAR = '\\'\n1 CHAR = '|'\n", - }, - ------------------------------------------------------------- - { "single character symbols 5", - "{ } [ ] :", - PASS, "1 CHAR = '{'\n1 CHAR = '}'\n1 CHAR = '['\n1 CHAR = ']'\n1 CHAR = ':'\n", - }, - ------------------------------------------------------------- - { "single character symbols 6", - "; , . / ?", - PASS, "1 CHAR = ';'\n1 CHAR = ','\n1 CHAR = '.'\n1 CHAR = '/'\n1 CHAR = '?'\n", - }, - ------------------------------------------------------------- - } - ------------------------------------------------------------------ - -- perform a test case - ------------------------------------------------------------------ - function do_test_case(count, test_case) - if comment == "" then return end -- skip empty entries - local comment, chunk, outcome, matcher = unpack(test_case) - local result = PASS - local output = "" - -- initialize lexer - local z = zio_init(chunk) - local luaX = lex_init(z, "=test") - -- lexer test loop - local status, token, seminfo - repeat - -- protected call - status, token, seminfo = pcall(luaX.lex, luaX) - output = output..luaX.ln.." " - if status then - -- successful call - if string.len(token) > 1 then - if token == "" - or token == "" - or token == "" then - token = token.." = "..seminfo - end - elseif string.byte(token) >= 32 then -- displayable chars - token = "CHAR = '"..token.."'" - else -- control characters - token = "CHAR = (".. string.byte(token)..")" - end - output = output..token.."\n" - else - -- failed call - output = output..token -- token is the error message - result = FAIL - break - end - until token == "" - -- decision making and reporting - local head = "Test "..count..": "..comment - if matcher == "" then - -- nothing to check against, display for manual check - print(head.."\nMANUAL please check manually".. - "\n--chunk---------------------------------\n"..chunk.. - "\n--actual--------------------------------\n"..output.. - "\n\n") - return - else - if outcome == PASS then - -- success expected, may be a partial match - if string.find(output, matcher, 1, 1) and result == PASS then - if not BRIEF then print(head.."\nOK expected success\n") end - return - end - else - -- failure expected, may be a partial match - if string.find(output, matcher, 1, 1) and result == FAIL then - if not BRIEF then print(head.."\nOK expected failure\n") end - return - end - end - -- failed because of unmatched string or boolean result - local function passfail(status) - if status == PASS then return "PASS" else return "FAIL" end - end - print(head.." *FAILED*".. - "\noutcome="..passfail(outcome).. - "\nactual= "..passfail(result).. - "\n--chunk---------------------------------\n"..chunk.. - "\n--expected------------------------------\n"..matcher.. - "\n--actual--------------------------------\n"..output.. - "\n\n") - end - end - ------------------------------------------------------------------ - -- perform auto testing - ------------------------------------------------------------------ - for i,test_case in ipairs(test_cases) do - do_test_case(i, test_case) - end -end - -auto_test() ---]] diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3.lua deleted file mode 100644 index 662c826..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3.lua +++ /dev/null @@ -1,218 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_lparser_mk3.lua - Test for lparser_mk3.lua - This file is part of Yueliang. - - Copyright (c) 2008 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 ------------------------------------------------------------------------- - -local lex_init = require("../llex_mk3") -local parser_init = require("../lparser_mk3") - ------------------------------------------------------------------------- --- dump contents of log table ------------------------------------------------------------------------- - -local function dump_log(fs) - local log = fs.log - for i = 1, table.getn(log) do - print(log[i]) - end -end - ------------------------------------------------------------------------- --- try 1 ------------------------------------------------------------------------- - -local luaX = lex_init("local a = 1", "=string") -local luaY = parser_init(luaX) - --- nothing is returned, so hope there is an error if problem occurs -local fs = luaY:parser() ---dump_log(fs) - ------------------------------------------------------------------------- --- try 2 ------------------------------------------------------------------------- - --- llex_mk3.lua cannot load files by itself -local INF = io.open("sample.lua", "rb") -if not INF then error("failed to load test file") end -local sample = INF:read("*a") -INF:close() - -luaX = lex_init(sample, "@sample.lua") -luaY = parser_init(luaX) - --- nothing is returned, so hope there is an error if problem occurs -local fs = luaY:parser() ---dump_log(fs) - ------------------------------------------------------------------------- --- automatic dumper of output log data ------------------------------------------------------------------------- - -local test_case = { --- 1 -[[ -]], --- 2 -[[ --- foobar -]], --- 3 -[[ -do -end -]], --- 4 -[[ -do end -do end -]], --- 5 -[[ -foo() -foo{} -foo"" -foo:bar() -foo=false -foo.bar=true -foo[true]=nil -foo,bar=1,"a" -]], --- 6 -[[ -foo=true -foo=false -foo=nil -foo=1.23e45 -foo=-1 -foo=(0) -foo=1+2 -foo=1+2*3-4/5 -]], --- 7 -[[ -if foo then foo=1 end -if foo then foo=1 else foo=0 end -if foo then foo=1 elseif not foo then foo=0 end -]], --- 8 -[[ -do return end -do return 123 end -do return "foo","bar" end -]], --- 9 -[[ -while true do foo=not foo end -while foo~=42 do foo=foo-1 end -while true do break end -]], --- 10 -[[ -repeat foo=foo.."bar" until false -repeat foo=foo/2 until foo<1 -repeat break until false -]], --- 11 -[[ -for i=1,10 do foo=i end -for i=1,10,2 do break end -for i in foo do bar=0 end -for i,j in foo,bar do baz=0 end -]], --- 12 -[[ -local foo -local foo,bar,baz -local foo,bar="foo","bar" -]], --- 13 -[[ -local function foo() return end -local function foo(a) return end -local function foo(x,y,z) return end -local function foo(x,...) return end -]], --- 14 -[[ -function foo() return end -function foo(a) return end -function foo(x,y,z) return end -function foo(x,...) return end -]], --- 15 -[[ -function foo.bar(p) return end -function foo.bar.baz(p) return end -function foo:bar(p) return end -function foo.bar.baz(p) return end -]], --- 16 -[[ -foo = function() return end -foo = function(x,y) return end -foo = function(...) return end -]], --- 17 -[[ -foo = {} -foo = { 1,2,3; "foo"; } -foo = { bar=77, baz=88, } -foo = { ["bar"]=77, ["baz"]=88, } -]], -} - --- helps to skip old stuff during development of snippets -local do_beg, do_end = 1, table.getn(test_case) - --- loop for all example snippets -for i = do_beg, do_end do - local fname = "parser_log/sample_"..string.format("%02d", i)..".lua" - local src = test_case[i] - local OUTF = io.open(fname, "wb") - if not OUTF then error("failed to write to file '"..fname.."'") end - -- write out actual source for comparison - OUTF:write( - "-- START OF SOURCE --\n".. - src.. - "-- END OF SOURCE --\n".. - "\n" - ) - -- attempt to parse - local luaX = lex_init(src, "=string") - local luaY = parser_init(luaX) - local fs = luaY:parser() - -- grab logged messages and write - local log = fs.log - local indent = 0 - for i = 1, table.getn(log) do - local ln = log[i] - -- handle indentation - local tag = string.sub(ln, 1, 2) - if tag == ">>" or tag == "<<" then - ln = string.sub(ln, 4) - end - if tag == ">>" then - indent = indent + 1 - end - OUTF:write(string.rep(" ", indent)..ln.."\n") - if tag == "<<" then - indent = indent - 1 - end - end - -- we're done - OUTF:close() -end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3_2.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3_2.lua deleted file mode 100644 index 957ee22..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3_2.lua +++ /dev/null @@ -1,158 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_lparser_mk3_2.lua - Test for lparser_mk3.lua, using the test case file - This file is part of Yueliang. - - Copyright (c) 2006-2008 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - ---[[-------------------------------------------------------------------- --- Notes: --- * unlike the equivalent in the orig-5.0.3/ directory, this version --- tests only parsing, lparser_mk3 cannot generate binary chunks --- * the test cases are in the test_lua directory (test_parser-5.0.lua) -----------------------------------------------------------------------]] - --- * true if you want an output of all failure cases in native Lua, --- for checking whether test cases fail where you intend them to -local DEBUG_FAILS = false - ------------------------------------------------------------------------- --- test the whole kaboodle ------------------------------------------------------------------------- - -local lex_init = require("../llex_mk3") -local parser_init = require("../lparser_mk3") - ------------------------------------------------------------------------- --- load test cases ------------------------------------------------------------------------- - -require("../../test_lua/test_parser-5.0") - -local test, expect, heading = {}, {}, {} -local total, total_pass, total_fail = 0, 0, 0 - -for ln in string.gfind(tests_source, "([^\n]*)\n") do - if string.find(ln, "^%s*%-%-") then - -- comment, ignore - else - local m, _, head = string.find(ln, "^%s*(TESTS:%s*.*)$") - if m then - heading[total + 1] = head -- informational heading - else - total = total + 1 - local n, _, flag = string.find(ln, "%s*%-%-%s*FAIL%s*$") - if n then -- FAIL test case - ln = string.sub(ln, 1, n - 1) -- remove comment - expect[total] = "FAIL" - total_fail = total_fail + 1 - else -- PASS test case - expect[total] = "PASS" - total_pass = total_pass + 1 - end--n - test[total] = ln - end--m - end--ln -end--for - -print("Tests loaded: "..total.." (total), " - ..total_pass.." (passes), " - ..total_fail.." (fails)") - ------------------------------------------------------------------------- --- verify test cases using native Lua ------------------------------------------------------------------------- - -local last_head = "TESTS: no heading yet" -for i = 1, total do - local test_case, expected, head = test[i], expect[i], heading[i] - -- show progress - if head then - last_head = head - if DEBUG_FAILS then print("\n"..head.."\n") end - end - ------------------------------------------------------------------ - -- perform test - local f, err = loadstring(test_case) - -- look at outcome - ------------------------------------------------------------------ - if f then-- actual PASS - if expected == "FAIL" then - print("\nVerified as PASS but expected to FAIL".. - "\n-------------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - os.exit() - end - ------------------------------------------------------------------ - else-- actual FAIL - if expected == "PASS" then - print("\nVerified as FAIL but expected to PASS".. - "\n-------------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - print("ERROR: "..err) - os.exit() - end - if DEBUG_FAILS then - print("TEST: "..test_case) - print("ERROR: "..err.."\n") - end - ------------------------------------------------------------------ - end--f -end--for - -print("Test cases verified using native Lua, no anomalies.") - ------------------------------------------------------------------------- --- test using Yueliang front end ------------------------------------------------------------------------- - -local last_head = "TESTS: no heading yet" -for i = 1, total do - local test_case, expected, head = test[i], expect[i], heading[i] - -- show progress - if head then last_head = head end - ------------------------------------------------------------------ - -- perform test - luaX = lex_init(test_case, "=test_sample") - luaY = parser_init(luaX) - - local status, func = pcall(luaY.parser, luaY) - -- look at outcome - ------------------------------------------------------------------ - if status then-- actual PASS - if expected == "FAIL" then - print("\nTested as PASS but expected to FAIL".. - "\n-----------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - os.exit() - end - ------------------------------------------------------------------ - else-- actual FAIL - if expected == "PASS" then - print("\nTested as FAIL but expected to PASS".. - "\n-----------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - os.exit() - else - io.stdout:write("-") - end - ------------------------------------------------------------------ - end--status - io.stdout:write("\rTesting ["..i.."]...") -end--for -print(" done.") - -print("Test cases run on Yueliang, no anomalies.") - --- end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b.lua deleted file mode 100644 index d8dc33d..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b.lua +++ /dev/null @@ -1,188 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_lparser_mk3b.lua - Test for lparser_mk3b.lua - This file is part of Yueliang. - - Copyright (c) 2008 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 ------------------------------------------------------------------------- - -local lex_init = require("../llex_mk3") -local parser_init = require("../lparser_mk3b") - ------------------------------------------------------------------------- --- dump contents of log table ------------------------------------------------------------------------- - -local function dump_log(fs) - local log = fs.log - for i = 1, table.getn(log) do - print(log[i]) - end -end - ------------------------------------------------------------------------- --- automatic dumper of output log data ------------------------------------------------------------------------- - -local test_case = { --- 1 -[[ - print(a) -]], --- 2 -[[ - local a - print(a) -]], --- 3 -[[ - do - local a - print(a) - end - print(a) -]], --- 4 -[[ - local a,b,c - do - local b - print(b) - end - print(b) -]], --- 5 -[[ - local function foo() end - bar = foo -]], --- 6 -[[ - do - local function foo() end - bar = foo - end - baz = foo -]], --- 7 -[[ - local foo - local function bar() - baz = nil - foo = bar() - end - foo = bar -]], --- 8 -[[ - local foo - local function bar() - local function baz() - local foo, bar - foo = bar - foo = baz - end - foo = bar - foo = baz - end - foo = bar - foo = baz -]], --- 9 -[[ - function foo:bar() - print(self) - end -]], --- 10 -[[ - function foo(...) - print(arg) - end -]], --- 11 -[[ - local c,d - function foo(a,b,c) - print(a,c,d,e) - end -]], --- 11 -[[ - function foo(a,b) - local bar = function(c,d) - print(a,b,c,d) - end - end -]], --- 12 -[[ - for i = 1,10 do - print(i) - end - for i = 1,10,-2 do - print(i) - end -]], --- 13 -[[ - for foo in bar() do - print(foo) - end - for foo,bar,baz in spring() do - print(foo,bar,baz) - end -]], -} - --- helps to skip old stuff during development of snippets -local do_beg, do_end = 1, table.getn(test_case) - --- loop for all example snippets -for i = do_beg, do_end do - local fname = "parser_log/sample_b_"..string.format("%02d", i)..".lua" - local src = test_case[i] - local OUTF = io.open(fname, "wb") - if not OUTF then error("failed to write to file '"..fname.."'") end - -- write out actual source for comparison - OUTF:write( - "-- START OF SOURCE --\n".. - src.. - "-- END OF SOURCE --\n".. - "\n" - ) - -- attempt to parse - local luaX = lex_init(src, "=string") - local luaY = parser_init(luaX) - local fs = luaY:parser() - -- grab logged messages and write - local log = fs.log - local indent = 0 - for i = 1, table.getn(log) do - local ln = log[i] - -- handle indentation - local tag = string.sub(ln, 1, 2) - if tag == ">>" or tag == "<<" then - ln = string.sub(ln, 4) - end - if tag == ">>" then - indent = indent + 1 - end - OUTF:write(string.rep(" ", indent)..ln.."\n") - if tag == "<<" then - indent = indent - 1 - end - end - -- we're done - OUTF:close() -end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b_2.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b_2.lua deleted file mode 100644 index 4d4e8c5..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lparser_mk3b_2.lua +++ /dev/null @@ -1,158 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_lparser_mk3b_2.lua - Test for lparser_mk3b.lua, using the test case file - This file is part of Yueliang. - - Copyright (c) 2006-2008 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - ---[[-------------------------------------------------------------------- --- Notes: --- * unlike the equivalent in the orig-5.0.3/ directory, this version --- tests only parsing, lparser_mk3 cannot generate binary chunks --- * the test cases are in the test_lua directory (test_parser-5.0.lua) -----------------------------------------------------------------------]] - --- * true if you want an output of all failure cases in native Lua, --- for checking whether test cases fail where you intend them to -local DEBUG_FAILS = false - ------------------------------------------------------------------------- --- test the whole kaboodle ------------------------------------------------------------------------- - -local lex_init = require("../llex_mk3") -local parser_init = require("../lparser_mk3b") - ------------------------------------------------------------------------- --- load test cases ------------------------------------------------------------------------- - -require("../../test_lua/test_parser-5.0") - -local test, expect, heading = {}, {}, {} -local total, total_pass, total_fail = 0, 0, 0 - -for ln in string.gfind(tests_source, "([^\n]*)\n") do - if string.find(ln, "^%s*%-%-") then - -- comment, ignore - else - local m, _, head = string.find(ln, "^%s*(TESTS:%s*.*)$") - if m then - heading[total + 1] = head -- informational heading - else - total = total + 1 - local n, _, flag = string.find(ln, "%s*%-%-%s*FAIL%s*$") - if n then -- FAIL test case - ln = string.sub(ln, 1, n - 1) -- remove comment - expect[total] = "FAIL" - total_fail = total_fail + 1 - else -- PASS test case - expect[total] = "PASS" - total_pass = total_pass + 1 - end--n - test[total] = ln - end--m - end--ln -end--for - -print("Tests loaded: "..total.." (total), " - ..total_pass.." (passes), " - ..total_fail.." (fails)") - ------------------------------------------------------------------------- --- verify test cases using native Lua ------------------------------------------------------------------------- - -local last_head = "TESTS: no heading yet" -for i = 1, total do - local test_case, expected, head = test[i], expect[i], heading[i] - -- show progress - if head then - last_head = head - if DEBUG_FAILS then print("\n"..head.."\n") end - end - ------------------------------------------------------------------ - -- perform test - local f, err = loadstring(test_case) - -- look at outcome - ------------------------------------------------------------------ - if f then-- actual PASS - if expected == "FAIL" then - print("\nVerified as PASS but expected to FAIL".. - "\n-------------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - os.exit() - end - ------------------------------------------------------------------ - else-- actual FAIL - if expected == "PASS" then - print("\nVerified as FAIL but expected to PASS".. - "\n-------------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - print("ERROR: "..err) - os.exit() - end - if DEBUG_FAILS then - print("TEST: "..test_case) - print("ERROR: "..err.."\n") - end - ------------------------------------------------------------------ - end--f -end--for - -print("Test cases verified using native Lua, no anomalies.") - ------------------------------------------------------------------------- --- test using Yueliang front end ------------------------------------------------------------------------- - -local last_head = "TESTS: no heading yet" -for i = 1, total do - local test_case, expected, head = test[i], expect[i], heading[i] - -- show progress - if head then last_head = head end - ------------------------------------------------------------------ - -- perform test - luaX = lex_init(test_case, "=test_sample") - luaY = parser_init(luaX) - - local status, func = pcall(luaY.parser, luaY) - -- look at outcome - ------------------------------------------------------------------ - if status then-- actual PASS - if expected == "FAIL" then - print("\nTested as PASS but expected to FAIL".. - "\n-----------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - os.exit() - end - ------------------------------------------------------------------ - else-- actual FAIL - if expected == "PASS" then - print("\nTested as FAIL but expected to PASS".. - "\n-----------------------------------") - print("Lastest heading: "..last_head) - print("TEST: "..test_case) - os.exit() - else - io.stdout:write("-") - end - ------------------------------------------------------------------ - end--status - io.stdout:write("\rTesting ["..i.."]...") -end--for -print(" done.") - -print("Test cases run on Yueliang, no anomalies.") - --- end diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua deleted file mode 100644 index 30259c8..0000000 --- a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua +++ /dev/null @@ -1,53 +0,0 @@ ---[[-------------------------------------------------------------------- - - test_lzio.lua - Test for lzio.lua - This file is part of Yueliang. - - Copyright (c) 2005-2006 Kein-Hong Man - The COPYRIGHT file describes the conditions - under which this software may be distributed. - - See the ChangeLog for more information. - -----------------------------------------------------------------------]] - --- manual test for lzio.lua lua-style chunk reader - -local zio_init = require("../lzio_mk2") - -local z -function dump(z) - while true do - local c = z:getc() - io.stdout:write("("..c..")") - if c == "EOZ" then break end - end - io.stdout:write("\n") -end - --- z = zio_init("@") for a file --- z = zio_init("") for a string - --- [[ -z = zio_init("hello, world!") -dump(z) -z = zio_init("line1\nline2\n") -dump(z) -z = zio_init("@test_lzio_mk2.lua") -dump(z) ---]] - --- test read beyond end of file --- bug reported by Adam429 ---[[ -z = zio_init("@test_lzio_mk2.lua") -while true do - local c = z:getc() - io.stdout:write("("..c..")") - if c == "EOZ" then break end -end -print(z:getc()) -print(z:getc()) -io.stdout:write("\n") ---]] -- cgit v1.1