From 7066392d1c974065181d95d93274136dcd625d43 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 17 Feb 2021 11:22:07 +0800 Subject: stop reusing variables, rename project. --- spec/inputs/syntax.mp | 418 -------------------------------------------------- 1 file changed, 418 deletions(-) delete mode 100644 spec/inputs/syntax.mp (limited to 'spec/inputs/syntax.mp') diff --git a/spec/inputs/syntax.mp b/spec/inputs/syntax.mp deleted file mode 100644 index 4df5785..0000000 --- a/spec/inputs/syntax.mp +++ /dev/null @@ -1,418 +0,0 @@ -#!/this/is/ignored - -a = 1 + 2* 3 / 6 - -a, bunch, go, here = another, world - -func arg1, arg2, another, arg3 - -here, we = () ->, yeah -the, different = () -> approach; yeah - -dad() -dad(lord) -hello(one,two)() -(5 + 5)(world) - -fun(a)(b) - -fun(a) b - -fun(a) b, bad hello - -hello world what are you doing here - - -what(the)[3243] world, yeck heck - -hairy[hands][are](gross) okay okay[world] - -_ = (get[something] + 5)[years] - -i,x = 200, 300 - -yeah = (1 + 5) * 3 -yeah = ((1+5)*3)/2 -yeah = ((1+5)*3)/2 + i % 100 - -whoa = (1+2) * (3+4) * (4+5) - -_ = -> - if something - return 1,2,4 - - print "hello" - -_ = -> - if hello - "heloo", "world" - else - no, way - - -_ = -> 1,2,34 - -return 5 + () -> 4 + 2 - -return 5 + (() -> 4) + 2 - -print 5 + () -> - _ = 34 - good nads - - -something 'else', "ya" - -something'else' -something"else" - -_ = something[[hey]] * 2 -_ = something[======[hey]======] * 2 -_ = something[ [======[hey]======] ] * 2 - - -_ = something'else', 2 -_ = something"else", 2 -_ = something[[else]], 2 -_ = something[ [[else]] ], 2 - -something 'else', 2 -something "else", 2 -something [[else]], 2 - -_ = here(we)"go"[12123] - -split"abc xyz 123"\map"#"\printAll! - -_ = f""[a] -_ = f""\b! -_ = f"".c! - -f ""[a] -f ""\b! -f "".c! - -list{"abc", "xyz", "123"}\map"#"\printAll! - -_ = f{}[a] -_ = f{}\b! -_ = f{}.c! - --- this runs -something = - test: 12323 - what: -> print "hello world" - -print something.test - -frick = hello: "world" - -argon = - num: 100 - world: (self) -> - print self.num - return { - something: -> print "hi from something" - } - somethin: (self, str) -> - print "string is", str - return world: (a,b) -> print "sum", a + b - -something.what() -argon\world().something() - -argon\somethin"200".world(1,2) - -x = -434 - -x = -hello world one two - -hi = -"herfef" - -x = -[x for x in x] - -print "hello" if cool -print "hello" unless cool -print "hello" unless 1212 and 3434 -- hello -print "hello" for i=1,10 - -print "nutjob" - -if hello then _ = 343 - -print "what" if cool - -((...)-> arg = {...})! - -x = (...) -> - dump {...} - - -x = not true - -y = not(5+5) - - -y = #"hello" - -x = #{#{},#{1},#{1,2}} - -_ = hello, world - -something\hello(what) a,b -something\hello what -something.hello\world a,b -something.hello\world(1,2,3) a,b -something - .hello - \world(1,2,3) a,b - - -x = 1232 -x += 10 + 3 -j -= "hello" -y *= 2 -y /= 100 -m %= 2 -hello ..= "world" - -@@something += 10 -@something += 10 - -a["hello"] += 10 -a["hello#{tostring ff}"] += 10 -a[four].x += 10 - -x = 0 -_ = (if ntype(v) == "fndef" then x += 1) for v in *values - - -hello = - something: world - if: "hello" - else: 3434 - function: "okay" - good: 230203 - - -div class: "cool" - -_ = 5 + what wack -what whack + 5 - -_ = 5 - what wack -what whack - 5 - -x = hello - world - something - -((something = with what - \cool 100) -> - print something)! - -if something - _ = 03589 - --- okay what about this - -else - _ = 3434 - - -if something - _ = yeah - - -elseif "ymmm" - - print "cool" - -else - - _ = okay - - --- test names containing keywords -x = notsomething -y = ifsomething -z = x and b -z = x andb - - --- undelimited tables - -while 10 > something - something: "world" - print "yeah" - -x = - okay: sure - -yeah - okay: man - sure: sir - -hello "no comma" - yeah: dada - another: world - -hello "comma", - something: hello_world - frick: you - --- creates one table -another hello, one, - two, three, four, yeah: man - okay: yeah - fine: alright - -another hello, one, - two, three, four, - yeah: man, okay: yeah - * fine: alright, - okay: 1 - * fine: alright, - okay: 2 - -another hello, one, two, three, four, - yeah: man - okay: yeah - -another hello, one, two, three, four, yeah: man - okay: yeah - -ajax url, - (data) -> - process data, - (error) -> - print error - --- -a += 3 - 5 -a *= 3 + 5 -a *= 3 -a >>= 3 -a <<= 3 -a /= func "cool" - ---- - -x.then = "hello" -x.while.true = "hello" -x - .while - .true = "hello" - --- - -x or= "hello" -x and= "hello" - --- - -z = a-b -z = a -b -z = a - b -z = a- b - - --- cooool - -str = --[[ -This is a multi line comment. -It's OK. -]] strA \ -- comment 1 - .. strB \ -- comment 2 - .. strC - -func --[[port]] 3000, --[[ip]] "192.168.1.1" - -f = -> - a,b, \ - c,d, \ - e,f - -f = -> - a,b \ - ,c,d \ - ,e,f - -with obj - invoke( - --[[arg1]] \func!, - --[[arg2]] 123, - --[[arg3]] "abc" - ) - -invokeA( - invokeB( - invokeC 123 - ) -) - -123 - |> invokeC - |> invokeB - |> invokeA - -v = { - a -1 - a( --1) - a \ -- 1 - a-1 - a - 1 - a - -1 - a- -1 - a - --[[123]]1 - - a ~1 - a( -~1) - a \ -~ 1 - a~1 - a ~ 1 - a ~ -1 - a~ -1 - a ~ --[[123]]1 -} - -do - a = 1 \ - + 2 \ - * 3 / - 4 - - _1 = f1 -1 \ - + 2 \ - + 3 - - _2 = f1 - 1 \ - + 2 \ - + 3 - - f2 = (x)-> print x \ - +1 - - a = f2! - -1 |> f2 - - a = f2! \ - - 1 |> f2 - - _1 \ - ,_2 \ - ,_3 \ - ,_4 = 1 \ - ,f 2 \ - ,3 \ - ,f 4, \ - 4 - -nil - -- cgit v1.2.3-55-g6feb