aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/testLua/yueliang-0.4.1/test_lua/test_parser-5.1.lua
diff options
context:
space:
mode:
Diffstat (limited to 'LuaSL/testLua/yueliang-0.4.1/test_lua/test_parser-5.1.lua')
-rw-r--r--LuaSL/testLua/yueliang-0.4.1/test_lua/test_parser-5.1.lua783
1 files changed, 0 insertions, 783 deletions
diff --git a/LuaSL/testLua/yueliang-0.4.1/test_lua/test_parser-5.1.lua b/LuaSL/testLua/yueliang-0.4.1/test_lua/test_parser-5.1.lua
deleted file mode 100644
index 0809652..0000000
--- a/LuaSL/testLua/yueliang-0.4.1/test_lua/test_parser-5.1.lua
+++ /dev/null
@@ -1,783 +0,0 @@
1--[[--------------------------------------------------------------------
2
3 test_parser-5.1.lua
4 Lua 5.1.x parser test cases
5 This file is part of Yueliang.
6
7 Copyright (c) 2006 Kein-Hong Man <khman@users.sf.net>
8 The COPYRIGHT file describes the conditions
9 under which this software may be distributed.
10
11 See the ChangeLog for more information.
12
13----------------------------------------------------------------------]]
14
15--[[--------------------------------------------------------------------
16-- Notes:
17-- * there is no intention of properly specifying a grammar; the notes
18-- are meant to reflect the structure of lparser so that it is easy
19-- to locate and modify lparser if so desired
20-- * some test may have invalid expressions but will compile, this
21-- is because the chunk hasn't been executed yet
22--
23-- Changed in 5.1.x:
24-- * added ..., %, # cases
25----------------------------------------------------------------------]]
26
27--[[--------------------------------------------------------------------
28-- lparser parsing structure, the Lua 5.1.x version...
29----------------------------------------------------------------------]]
30 --------------------------------------------------------------------
31 -- chunk -> { stat [';'] }
32 --------------------------------------------------------------------
33 -- stat -> DO block END
34 -- block -> chunk
35 --------------------------------------------------------------------
36 -- stat -> breakstat
37 -- breakstat -> BREAK
38 -- * must have a loop to break
39 -- * must be last statement in a block
40 --------------------------------------------------------------------
41 -- stat -> retstat
42 -- retstat -> RETURN explist
43 -- * must be last statement in a block
44 --------------------------------------------------------------------
45 -- stat -> exprstat
46 -- exprstat -> primaryexp
47 -- (-> func | assignment)
48 -- * if LHS is VCALL then func, otherwise assignment
49 -- * for func, LHS is VCALL if funcargs in expression
50 --------------------------------------------------------------------
51 -- stat -> funcstat
52 -- funcstat -> FUNCTION funcname body
53 -- funcname -> NAME {'.' NAME} [':' NAME]
54 --------------------------------------------------------------------
55 -- body -> '(' parlist ')' chunk END
56 -- parlist -> [ param { ',' param } ]
57 -- param -> NAME
58 -- * DOTS must be the last parameter in a parlist
59 --------------------------------------------------------------------
60 -- stat -> LOCAL localstat
61 -- LOCAL localstat -> LOCAL NAME {',' NAME} ['=' explist1]
62 -- explist1 -> expr { ',' expr }
63 --------------------------------------------------------------------
64 -- stat -> LOCAL FUNCTION localfunc
65 -- LOCAL FUNCTION localfunc -> LOCAL FUNCTION NAME body
66 --------------------------------------------------------------------
67 -- stat -> ifstat
68 -- ifstat -> IF cond THEN block
69 -- {ELSEIF cond THEN block}
70 -- [ELSE block] END
71 -- block -> chunk
72 -- cond -> expr
73 --------------------------------------------------------------------
74 -- stat -> forstat
75 -- forstat -> fornum | forlist
76 -- forlist -> NAME {,NAME} IN explist1 forbody END
77 -- fornum -> NAME = exp1,exp1[,exp1] forbody END
78 -- forbody -> DO block
79 -- block -> chunk
80 --------------------------------------------------------------------
81 -- stat -> whilestat
82 -- whilestat -> WHILE cond DO block END
83 -- block -> chunk
84 -- cond -> expr
85 --------------------------------------------------------------------
86 -- stat -> repeatstat
87 -- repeatstat -> REPEAT chunk UNTIL cond
88 -- cond -> expr
89 --------------------------------------------------------------------
90 -- assignment -> ',' primaryexp assignment
91 -- | '=' explist1
92 -- explist1 -> expr { ',' expr }
93 -- * for assignment, LHS must be LOCAL, UPVAL, GLOBAL or INDEXED
94 --------------------------------------------------------------------
95 -- primaryexp -> prefixexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs }
96 -- prefixexp -> NAME | '(' expr ')'
97 -- funcargs -> '(' [ explist1 ] ')' | constructor | STRING
98 -- * funcargs turn an expr into a function call
99 --------------------------------------------------------------------
100 -- expr -> subexpr
101 -- subexpr -> (UNOPR subexpr | simpleexp) { BINOPR subexpr }
102 -- simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ...
103 -- | constructor | FUNCTION body | primaryexp
104 --------------------------------------------------------------------
105 -- constructor -> '{' [ field { fieldsep field } [ fieldsep ] ] '}'
106 -- fieldsep -> ',' | ';'
107 -- field -> recfield | listfield
108 -- recfield -> ( NAME | '[' exp1 ']' ) = exp1
109 -- listfield -> expr
110 --------------------------------------------------------------------
111
112--[[--------------------------------------------------------------------
113-- parser test cases, Lua 5.1.x
114-- * uncomment string delimiter to enable syntax highlighting...
115-- * anything that matches "^%s*%-%-" is a comment
116-- * headings to display are "^%s*TESTS:%s*(.*)$"
117-- * FAIL test cases should match "%s*%-%-%s*FAIL%s*$"
118----------------------------------------------------------------------]]
119tests_source = [=[
120 --------------------------------------------------------------------
121 TESTS: empty chunks
122 --------------------------------------------------------------------
123 -- chunk -> { stat [';'] }
124 --------------------------------------------------------------------
125
126; -- FAIL
127 --------------------------------------------------------------------
128 TESTS: optional semicolon, simple local statements
129 --------------------------------------------------------------------
130 -- stat -> LOCAL localstat
131 -- LOCAL localstat -> LOCAL NAME {',' NAME} ['=' explist1]
132 -- explist1 -> expr { ',' expr }
133 --------------------------------------------------------------------
134local -- FAIL
135local; -- FAIL
136local = -- FAIL
137local end -- FAIL
138local a
139local a;
140local a, b, c
141local a; local b local c;
142local a = 1
143local a local b = a
144local a, b = 1, 2
145local a, b, c = 1, 2, 3
146local a, b, c = 1
147local a = 1, 2, 3
148local a, local -- FAIL
149local 1 -- FAIL
150local "foo" -- FAIL
151local a = local -- FAIL
152local a, b, = -- FAIL
153local a, b = 1, local -- FAIL
154local a, b = , local -- FAIL
155 --------------------------------------------------------------------
156 TESTS: simple DO blocks
157 --------------------------------------------------------------------
158 -- stat -> DO block END
159 -- block -> chunk
160 --------------------------------------------------------------------
161do -- FAIL
162end -- FAIL
163do end
164do ; end -- FAIL
165do 1 end -- FAIL
166do "foo" end -- FAIL
167do local a, b end
168do local a local b end
169do local a; local b; end
170do local a = 1 end
171do do end end
172do do end; end
173do do do end end end
174do do do end; end; end
175do do do return end end end
176do end do -- FAIL
177do end end -- FAIL
178do return end
179do return return end -- FAIL
180do break end -- FAIL
181 --------------------------------------------------------------------
182 TESTS: simple WHILE loops
183 --------------------------------------------------------------------
184 -- stat -> whilestat
185 -- whilestat -> WHILE cond DO block END
186 -- block -> chunk
187 -- cond -> expr
188 --------------------------------------------------------------------
189while -- FAIL
190while do -- FAIL
191while = -- FAIL
192while 1 do -- FAIL
193while 1 do end
194while 1 do local a end
195while 1 do local a local b end
196while 1 do local a; local b; end
197while 1 do 2 end -- FAIL
198while 1 do "foo" end -- FAIL
199while true do end
200while 1 do ; end -- FAIL
201while 1 do while -- FAIL
202while 1 end -- FAIL
203while 1 2 do -- FAIL
204while 1 = 2 do -- FAIL
205while 1 do return end
206while 1 do return return end -- FAIL
207while 1 do do end end
208while 1 do do return end end
209while 1 do break end
210while 1 do break break end -- FAIL
211while 1 do do break end end
212 --------------------------------------------------------------------
213 TESTS: simple REPEAT loops
214 --------------------------------------------------------------------
215 -- stat -> repeatstat
216 -- repeatstat -> REPEAT chunk UNTIL cond
217 -- cond -> expr
218 --------------------------------------------------------------------
219repeat -- FAIL
220repeat until -- FAIL
221repeat until 0
222repeat until false
223repeat until local -- FAIL
224repeat end -- FAIL
225repeat 1 -- FAIL
226repeat = -- FAIL
227repeat local a until 1
228repeat local a local b until 0
229repeat local a; local b; until 0
230repeat ; until 1 -- FAIL
231repeat 2 until 1 -- FAIL
232repeat "foo" until 1 -- FAIL
233repeat return until 0
234repeat return return until 0 -- FAIL
235repeat break until 0
236repeat break break until 0 -- FAIL
237repeat do end until 0
238repeat do return end until 0
239repeat do break end until 0
240 --------------------------------------------------------------------
241 TESTS: simple FOR loops
242 --------------------------------------------------------------------
243 -- stat -> forstat
244 -- forstat -> fornum | forlist
245 -- forlist -> NAME {,NAME} IN explist1 forbody END
246 -- fornum -> NAME = exp1,exp1[,exp1] forbody END
247 -- forbody -> DO block
248 -- block -> chunk
249 --------------------------------------------------------------------
250for -- FAIL
251for do -- FAIL
252for end -- FAIL
253for 1 -- FAIL
254for a -- FAIL
255for true -- FAIL
256for a, in -- FAIL
257for a in -- FAIL
258for a do -- FAIL
259for a in do -- FAIL
260for a in b do -- FAIL
261for a in b end -- FAIL
262for a in b, do -- FAIL
263for a in b do end
264for a in b do local a local b end
265for a in b do local a; local b; end
266for a in b do 1 end -- FAIL
267for a in b do "foo" end -- FAIL
268for a b in -- FAIL
269for a, b, c in p do end
270for a, b, c in p, q, r do end
271for a in 1 do end
272for a in true do end
273for a in "foo" do end
274for a in b do break end
275for a in b do break break end -- FAIL
276for a in b do return end
277for a in b do return return end -- FAIL
278for a in b do do end end
279for a in b do do break end end
280for a in b do do return end end
281for = -- FAIL
282for a = -- FAIL
283for a, b = -- FAIL
284for a = do -- FAIL
285for a = 1, do -- FAIL
286for a = p, q, do -- FAIL
287for a = p q do -- FAIL
288for a = b do end -- FAIL
289for a = 1, 2, 3, 4 do end -- FAIL
290for a = p, q do end
291for a = 1, 2 do end
292for a = 1, 2 do local a local b end
293for a = 1, 2 do local a; local b; end
294for a = 1, 2 do 3 end -- FAIL
295for a = 1, 2 do "foo" end -- FAIL
296for a = p, q, r do end
297for a = 1, 2, 3 do end
298for a = p, q do break end
299for a = p, q do break break end -- FAIL
300for a = 1, 2 do return end
301for a = 1, 2 do return return end -- FAIL
302for a = p, q do do end end
303for a = p, q do do break end end
304for a = p, q do do return end end
305 --------------------------------------------------------------------
306 TESTS: break statement
307 --------------------------------------------------------------------
308 -- stat -> breakstat
309 -- breakstat -> BREAK
310 -- * must have a loop to break
311 -- * must be last statement in a block
312 --------------------------------------------------------------------
313break -- FAIL
314 --------------------------------------------------------------------
315 TESTS: return statement
316 --------------------------------------------------------------------
317 -- stat -> retstat
318 -- retstat -> RETURN explist
319 -- * must be last statement in a block
320 --------------------------------------------------------------------
321return
322return;
323return return -- FAIL
324return 1
325return local -- FAIL
326return "foo"
327return 1, -- FAIL
328return 1,2,3
329return a,b,c,d
330return 1,2;
331return ...
332return 1,a,...
333 --------------------------------------------------------------------
334 TESTS: conditional statements
335 --------------------------------------------------------------------
336 -- stat -> ifstat
337 -- ifstat -> IF cond THEN block
338 -- {ELSEIF cond THEN block}
339 -- [ELSE block] END
340 -- block -> chunk
341 -- cond -> expr
342 --------------------------------------------------------------------
343if -- FAIL
344elseif -- FAIL
345else -- FAIL
346then -- FAIL
347if then -- FAIL
348if 1 -- FAIL
349if 1 then -- FAIL
350if 1 else -- FAIL
351if 1 then else -- FAIL
352if 1 then elseif -- FAIL
353if 1 then end
354if 1 then local a end
355if 1 then local a local b end
356if 1 then local a; local b; end
357if 1 then else end
358if 1 then local a else local b end
359if 1 then local a; else local b; end
360if 1 then elseif 2 -- FAIL
361if 1 then elseif 2 then -- FAIL
362if 1 then elseif 2 then end
363if 1 then local a elseif 2 then local b end
364if 1 then local a; elseif 2 then local b; end
365if 1 then elseif 2 then else end
366if 1 then else if 2 then end end
367if 1 then else if 2 then end -- FAIL
368if 1 then break end -- FAIL
369if 1 then return end
370if 1 then return return end -- FAIL
371if 1 then end; if 1 then end;
372 --------------------------------------------------------------------
373 TESTS: function statements
374 --------------------------------------------------------------------
375 -- stat -> funcstat
376 -- funcstat -> FUNCTION funcname body
377 -- funcname -> NAME {'.' NAME} [':' NAME]
378 --------------------------------------------------------------------
379 -- body -> '(' parlist ')' chunk END
380 -- parlist -> [ param { ',' param } ]
381 -- param -> NAME
382 -- * DOTS must be the last parameter in a parlist
383 --------------------------------------------------------------------
384function -- FAIL
385function 1 -- FAIL
386function end -- FAIL
387function a -- FAIL
388function a end -- FAIL
389function a( end -- FAIL
390function a() end
391function a(1 -- FAIL
392function a("foo" -- FAIL
393function a(p -- FAIL
394function a(p,) -- FAIL
395function a(p q -- FAIL
396function a(p) end
397function a(p,q,) end -- FAIL
398function a(p,q,r) end
399function a(p,q,1 -- FAIL
400function a(p) do -- FAIL
401function a(p) 1 end -- FAIL
402function a(p) return end
403function a(p) break end -- FAIL
404function a(p) return return end -- FAIL
405function a(p) do end end
406function a.( -- FAIL
407function a.1 -- FAIL
408function a.b() end
409function a.b, -- FAIL
410function a.b.( -- FAIL
411function a.b.c.d() end
412function a: -- FAIL
413function a:1 -- FAIL
414function a:b() end
415function a:b: -- FAIL
416function a:b. -- FAIL
417function a.b.c:d() end
418function a(...) end
419function a(..., -- FAIL
420function a(p,...) end
421function a(p,q,r,...) end
422function a() local a local b end
423function a() local a; local b; end
424function a() end; function a() end;
425 --------------------------------------------------------------------
426 TESTS: local function statements
427 --------------------------------------------------------------------
428 -- stat -> LOCAL FUNCTION localfunc
429 -- LOCAL FUNCTION localfunc -> LOCAL FUNCTION NAME body
430 --------------------------------------------------------------------
431local function -- FAIL
432local function 1 -- FAIL
433local function end -- FAIL
434local function a -- FAIL
435local function a end -- FAIL
436local function a( end -- FAIL
437local function a() end
438local function a(1 -- FAIL
439local function a("foo" -- FAIL
440local function a(p -- FAIL
441local function a(p,) -- FAIL
442local function a(p q -- FAIL
443local function a(p) end
444local function a(p,q,) end -- FAIL
445local function a(p,q,r) end
446local function a(p,q,1 -- FAIL
447local function a(p) do -- FAIL
448local function a(p) 1 end -- FAIL
449local function a(p) return end
450local function a(p) break end -- FAIL
451local function a(p) return return end -- FAIL
452local function a(p) do end end
453local function a. -- FAIL
454local function a: -- FAIL
455local function a(...) end
456local function a(..., -- FAIL
457local function a(p,...) end
458local function a(p,q,r,...) end
459local function a() local a local b end
460local function a() local a; local b; end
461local function a() end; local function a() end;
462 --------------------------------------------------------------------
463 -- stat -> exprstat
464 -- exprstat -> primaryexp
465 -- (-> func | assignment)
466 -- * if LHS is VCALL then func, otherwise assignment
467 -- * for func, LHS is VCALL if funcargs in expression
468 --------------------------------------------------------------------
469 TESTS: assignments
470 --------------------------------------------------------------------
471 -- assignment -> ',' primaryexp assignment
472 -- | '=' explist1
473 -- explist1 -> expr { ',' expr }
474 -- * for assignment, LHS must be LOCAL, UPVAL, GLOBAL or INDEXED
475 --------------------------------------------------------------------
476a -- FAIL
477a, -- FAIL
478a,b,c -- FAIL
479a,b = -- FAIL
480a = 1
481a = 1,2,3
482a,b,c = 1
483a,b,c = 1,2,3
484a.b = 1
485a.b.c = 1
486a[b] = 1
487a[b][c] = 1
488a.b[c] = 1
489a[b].c = 1
4900 = -- FAIL
491"foo" = -- FAIL
492true = -- FAIL
493(a) = -- FAIL
494{} = -- FAIL
495a:b() = -- FAIL
496a() = -- FAIL
497a.b:c() = -- FAIL
498a[b]() = -- FAIL
499a = a b -- FAIL
500a = 1 2 -- FAIL
501a = a = 1 -- FAIL
502 --------------------------------------------------------------------
503 TESTS: function calls
504 --------------------------------------------------------------------
505 -- primaryexp -> prefixexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs }
506 -- prefixexp -> NAME | '(' expr ')'
507 -- funcargs -> '(' [ explist1 ] ')' | constructor | STRING
508 -- * funcargs turn an expr into a function call
509 --------------------------------------------------------------------
510a( -- FAIL
511a()
512a(1)
513a(1,) -- FAIL
514a(1,2,3)
5151() -- FAIL
516a()()
517a.b()
518a[b]()
519a.1 -- FAIL
520a.b -- FAIL
521a[b] -- FAIL
522a.b.( -- FAIL
523a.b.c()
524a[b][c]()
525a[b].c()
526a.b[c]()
527a:b()
528a:b -- FAIL
529a:1 -- FAIL
530a.b:c()
531a[b]:c()
532a:b: -- FAIL
533a:b():c()
534a:b().c[d]:e()
535a:b()[c].d:e()
536(a)()
537()() -- FAIL
538(1)()
539("foo")()
540(true)()
541(a)()()
542(a.b)()
543(a[b])()
544(a).b()
545(a)[b]()
546(a):b()
547(a).b[c]:d()
548(a)[b].c:d()
549(a):b():c()
550(a):b().c[d]:e()
551(a):b()[c].d:e()
552 --------------------------------------------------------------------
553 TESTS: more function calls
554 --------------------------------------------------------------------
555a"foo"
556a[[foo]]
557a.b"foo"
558a[b]"foo"
559a:b"foo"
560a{}
561a.b{}
562a[b]{}
563a:b{}
564a()"foo"
565a"foo"()
566a"foo".b()
567a"foo"[b]()
568a"foo":c()
569a"foo""bar"
570a"foo"{}
571(a):b"foo".c[d]:e"bar"
572(a):b"foo"[c].d:e"bar"
573a(){}
574a{}()
575a{}.b()
576a{}[b]()
577a{}:c()
578a{}"foo"
579a{}{}
580(a):b{}.c[d]:e{}
581(a):b{}[c].d:e{}
582 --------------------------------------------------------------------
583 TESTS: simple expressions
584 --------------------------------------------------------------------
585 -- simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ...
586 -- | constructor | FUNCTION body | primaryexp
587 --------------------------------------------------------------------
588a = -- FAIL
589a = a
590a = nil
591a = false
592a = 1
593a = "foo"
594a = [[foo]]
595a = {}
596a = (a)
597a = (nil)
598a = (true)
599a = (1)
600a = ("foo")
601a = ([[foo]])
602a = ({})
603a = a.b
604a = a.b. -- FAIL
605a = a.b.c
606a = a:b -- FAIL
607a = a[b]
608a = a[1]
609a = a["foo"]
610a = a[b][c]
611a = a.b[c]
612a = a[b].c
613a = (a)[b]
614a = (a).c
615a = () -- FAIL
616a = a()
617a = a.b()
618a = a[b]()
619a = a:b()
620a = (a)()
621a = (a).b()
622a = (a)[b]()
623a = (a):b()
624a = a"foo"
625a = a{}
626a = function -- FAIL
627a = function 1 -- FAIL
628a = function a -- FAIL
629a = function end -- FAIL
630a = function( -- FAIL
631a = function() end
632a = function(1 -- FAIL
633a = function(p) end
634a = function(p,) -- FAIL
635a = function(p q -- FAIL
636a = function(p,q,r) end
637a = function(p,q,1 -- FAIL
638a = function(...) end
639a = function(..., -- FAIL
640a = function(p,...) end
641a = function(p,q,r,...) end
642a = ...
643a = a, b, ...
644a = (...)
645a = ..., 1, 2
646a = function() return ... end -- FAIL
647 --------------------------------------------------------------------
648 TESTS: operators
649 --------------------------------------------------------------------
650 -- expr -> subexpr
651 -- subexpr -> (UNOPR subexpr | simpleexp) { BINOPR subexpr }
652 -- simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ...
653 -- | constructor | FUNCTION body | primaryexp
654 --------------------------------------------------------------------
655a = -10
656a = -"foo"
657a = -a
658a = -nil
659a = -true
660a = -{}
661a = -function() end
662a = -a()
663a = -(a)
664a = - -- FAIL
665a = not 10
666a = not "foo"
667a = not a
668a = not nil
669a = not true
670a = not {}
671a = not function() end
672a = not a()
673a = not (a)
674a = not -- FAIL
675a = #10
676a = #"foo"
677a = #a
678a = #nil
679a = #true
680a = #{}
681a = #function() end
682a = #a()
683a = #(a)
684a = # -- FAIL
685a = 1 + 2; a = 1 - 2
686a = 1 * 2; a = 1 / 2
687a = 1 ^ 2; a = 1 % 2
688a = 1 .. 2
689a = 1 + -- FAIL
690a = 1 .. -- FAIL
691a = 1 * / -- FAIL
692a = 1 + -2; a = 1 - -2
693a = 1 * - -- FAIL
694a = 1 * not 2; a = 1 / not 2
695a = 1 / not -- FAIL
696a = 1 * #"foo"; a = 1 / #"foo"
697a = 1 / # -- FAIL
698a = 1 + 2 - 3 * 4 / 5 % 6 ^ 7
699a = ((1 + 2) - 3) * (4 / (5 % 6 ^ 7))
700a = (1 + (2 - (3 * (4 / (5 % 6 ^ ((7)))))))
701a = ((1 -- FAIL
702a = ((1 + 2) -- FAIL
703a = 1) -- FAIL
704a = a + b - c
705a = "foo" + "bar"
706a = "foo".."bar".."baz"
707a = true + false - nil
708a = {} * {}
709a = function() end / function() end
710a = a() ^ b()
711a = ... % ...
712 --------------------------------------------------------------------
713 TESTS: more operators
714 --------------------------------------------------------------------
715a = 1 == 2; a = 1 ~= 2
716a = 1 < 2; a = 1 <= 2
717a = 1 > 2; a = 1 >= 2
718a = 1 < 2 < 3
719a = 1 >= 2 >= 3
720a = 1 == -- FAIL
721a = ~= 2 -- FAIL
722a = "foo" == "bar"
723a = "foo" > "bar"
724a = a ~= b
725a = true == false
726a = 1 and 2; a = 1 or 2
727a = 1 and -- FAIL
728a = or 1 -- FAIL
729a = 1 and 2 and 3
730a = 1 or 2 or 3
731a = 1 and 2 or 3
732a = a and b or c
733a = a() and (b)() or c.d
734a = "foo" and "bar"
735a = true or false
736a = {} and {} or {}
737a = (1) and ("foo") or (nil)
738a = function() end == function() end
739a = function() end or function() end
740 --------------------------------------------------------------------
741 TESTS: constructors
742 --------------------------------------------------------------------
743 -- constructor -> '{' [ field { fieldsep field } [ fieldsep ] ] '}'
744 -- fieldsep -> ',' | ';'
745 -- field -> recfield | listfield
746 -- recfield -> ( NAME | '[' exp1 ']' ) = exp1
747 -- listfield -> expr
748 --------------------------------------------------------------------
749a = { -- FAIL
750a = {}
751a = {,} -- FAIL
752a = {;} -- FAIL
753a = {,,} -- FAIL
754a = {;;} -- FAIL
755a = {{ -- FAIL
756a = {{{}}}
757a = {{},{},{{}},}
758a = { 1 }
759a = { 1, }
760a = { 1; }
761a = { 1, 2 }
762a = { a, b, c, }
763a = { true; false, nil; }
764a = { a.b, a[b]; a:c(), }
765a = { 1 + 2, a > b, "a" or "b" }
766a = { a=1, }
767a = { a=1, b="foo", c=nil }
768a = { a -- FAIL
769a = { a= -- FAIL
770a = { a=, -- FAIL
771a = { a=; -- FAIL
772a = { 1, a="foo" -- FAIL
773a = { 1, a="foo"; b={}, d=true; }
774a = { [ -- FAIL
775a = { [1 -- FAIL
776a = { [1] -- FAIL
777a = { [a]= -- FAIL
778a = { ["foo"]="bar" }
779a = { [1]=a, [2]=b, }
780a = { true, a=1; ["foo"]="bar", }
781]=]
782
783-- end of script