Skip to content

Commit 41df8f9

Browse files
committed
inline Seq.Syntax
1 parent 3208e66 commit 41df8f9

File tree

128 files changed

+8205
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+8205
-103
lines changed
Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
// Primitives
2+
null ⇶ null
3+
true ⇶ true
4+
false ⇶ false
5+
6+
// Arrays
7+
[] ⇶ []
8+
[5, 6] ⇶ [5, 6]
9+
[5, undefined()] ⇶ [5]
10+
[1] ⇶ [1]
11+
[[1]] ⇶ [[1]]
12+
[1, ..[2, 3], 4, ..[undefined(), 5]] ⇶ [1, 2, 3, 4, 5]
13+
14+
// Objects
15+
{} ⇶ {}
16+
{a: 1, 'b c': 2} ⇶ {a: 1, 'b c': 2}
17+
{User} ⇶ {User: {Id: 42, Name: 'nblumhardt'}}
18+
{@l} ⇶ {'@l': @l}
19+
{a: 1, a: 2} ⇶ {a: 2}
20+
{a: 1, b: undefined()} ⇶ {a: 1}
21+
{a: 1, a: undefined()} ⇶ {}
22+
{a: 1, ..{b: 2, c: 3}} ⇶ {a: 1, b: 2, c: 3}
23+
{a: 1, ..{b: 2}, a: undefined()} ⇶ {b: 2}
24+
{a: 1, ..{b: 2}, b: undefined()} ⇶ {a: 1}
25+
{a: 1, ..{a: undefined()}} ⇶ {a: 1}
26+
{..{a: 1}, ..{b: 2, c: 3}} ⇶ {a: 1, b: 2, c: 3}
27+
{a: 1}['a'] ⇶ 1
28+
{a: 1}['A'] ⇶ undefined()
29+
ElementAt({a: 1}, 'A') ⇶ undefined()
30+
ElementAt({a: 1}, 'A') ci ⇶ 1
31+
32+
// Strings
33+
'' ⇶ ''
34+
'foo' ⇶ 'foo'
35+
'''' ⇶ ''''
36+
'a' ⇶ 'a'
37+
'''b' ⇶ '''b'
38+
'b''' ⇶ 'b'''
39+
'a''b' ⇶ 'a''b'
40+
'😂' ⇶ '😂'
41+
42+
// Numbers
43+
0 ⇶ 0
44+
0.0 ⇶ 0
45+
1 ⇶ 1
46+
1.0 ⇶ 1
47+
123 ⇶ 123
48+
1.23 ⇶ 1.23
49+
-1 ⇶ -1
50+
-1.23 ⇶ -1.23
51+
52+
// Math
53+
1 + 1 ⇶ 2
54+
1 + 2 + 3 ⇶ 6
55+
'foo' + 1 ⇶ undefined()
56+
1 - 2 ⇶ -1
57+
-1 - -1 ⇶ 0
58+
3 - 2 ⇶ 1
59+
'foo' - - 1 ⇶ undefined()
60+
1.0 + 2.0 ⇶ 3
61+
1 * 0 ⇶ 0
62+
12 * 12 ⇶ 144
63+
3 / 1 ⇶ 3
64+
3 / 0 ⇶ undefined()
65+
3 ^ 2 ⇶ 9
66+
0 ^ 1 ⇶ 0
67+
0 ^ 0 ⇶ 1
68+
0 % 0 ⇶ undefined()
69+
0 % 1 ⇶ 0
70+
1 % 0 ⇶ undefined()
71+
1 % 1 ⇶ 0
72+
5 % 2 ⇶ 1
73+
79228162514264337593543950334 + 1 ⇶ 79228162514264337593543950335
74+
round(1.4343434343, 2) ⇶ 1.43
75+
round(1.435, 2) ⇶ 1.44
76+
round(0.00000000, 5) ⇶ 0
77+
round(0.99999999, 5) ⇶ 1
78+
52 ^ -3 ⇶ 0.00000711197086936732
79+
2 ^ 3.14 ⇶ 8.81524092701289
80+
81+
// Boolean logic
82+
true or false and false ⇶ true
83+
(true or false) and false ⇶ false
84+
not false and false ⇶ false
85+
not (false and false) ⇶ true
86+
false and true ⇶ false
87+
false and false ⇶ false
88+
true and true ⇶ true
89+
true and null ⇶ false
90+
false and null ⇶ false
91+
null and null ⇶ false
92+
undefined() and undefined() ⇶ false
93+
undefined() and true ⇶ false
94+
true and undefined() ⇶ false
95+
false or false ⇶ false
96+
true or false ⇶ true
97+
true or true ⇶ true
98+
false or true ⇶ true
99+
true or null ⇶ true
100+
null or true ⇶ true
101+
true or undefined() ⇶ true
102+
undefined() or true ⇶ true
103+
undefined() or undefined() ⇶ false
104+
not true ⇶ false
105+
not false ⇶ true
106+
not undefined() ⇶ true
107+
not(true) ⇶ false
108+
not(false and false) ⇶ true
109+
not(undefined()) ⇶ true
110+
'not a bool' or true ⇶ true
111+
112+
// Coalesce
113+
coalesce(null, 1) ⇶ 1
114+
coalesce(undefined(), 1) ⇶ 1
115+
coalesce(1, null) ⇶ 1
116+
coalesce(undefined(), undefined()) ⇶ undefined()
117+
coalesce(null, null) ⇶ null
118+
coalesce(null, null, 3) ⇶ 3
119+
coalesce() ⇶ undefined()
120+
coalesce(1) ⇶ 1
121+
122+
// Identifiers
123+
A ⇶ undefined()
124+
_a ⇶ undefined()
125+
a1 ⇶ undefined()
126+
127+
// EQ
128+
1 = 1 ⇶ true
129+
1 = 0 ⇶ false
130+
null = 0 ⇶ false
131+
null = null ⇶ true
132+
null = undefined() ⇶ undefined()
133+
undefined() = undefined() ⇶ undefined()
134+
135+
// NEQ
136+
1 <> 1 ⇶ false
137+
1 <> 0 ⇶ true
138+
null <> 0 ⇶ true
139+
null <> null ⇶ false
140+
undefined() <> null ⇶ undefined()
141+
undefined() <> undefined() ⇶ undefined()
142+
143+
// LT
144+
1 < 2 ⇶ true
145+
1 < 1 ⇶ false
146+
1 < 0 ⇶ false
147+
null < 0 ⇶ undefined()
148+
null < null ⇶ undefined()
149+
undefined() < null ⇶ undefined()
150+
undefined() < undefined() ⇶ undefined()
151+
152+
// LTE
153+
1 <= 2 ⇶ true
154+
1 <= 1 ⇶ true
155+
1 <= 0 ⇶ false
156+
null <= 0 ⇶ undefined()
157+
null <= null ⇶ undefined()
158+
undefined() <= null ⇶ undefined()
159+
undefined() <= undefined() ⇶ undefined()
160+
161+
// GT
162+
3 > 1 ⇶ true
163+
1 > 1 ⇶ false
164+
1 > 0 ⇶ true
165+
null > 0 ⇶ undefined()
166+
null > null ⇶ undefined()
167+
undefined() > null ⇶ undefined()
168+
undefined() > undefined() ⇶ undefined()
169+
170+
// GTE
171+
2 >= 1 ⇶ true
172+
1 >= 1 ⇶ true
173+
1 >= 0 ⇶ true
174+
-1 >= 0 ⇶ false
175+
null >= 0 ⇶ undefined()
176+
null >= null ⇶ undefined()
177+
undefined() >= null ⇶ undefined()
178+
undefined() >= undefined() ⇶ undefined()
179+
180+
// in/not in
181+
1 in [1, 2, 3] ⇶ true
182+
5 in [1, 2, 3] ⇶ false
183+
1 not in [1, 2, 3] ⇶ false
184+
5 not in [1, 2, 3] ⇶ true
185+
undefined() in [1, 2, 3] ⇶ undefined()
186+
undefined() not in [1, 2, 3] ⇶ undefined()
187+
1 in undefined() ⇶ undefined()
188+
null in [1, null, 3] ⇶ true
189+
190+
// is null/is not null
191+
null is null ⇶ true
192+
null is not null ⇶ false
193+
undefined() is null ⇶ true
194+
10 is null ⇶ false
195+
196+
// Property names and accessors
197+
[5, 6, 7][1] ⇶ 6
198+
User.Name ⇶ 'nblumhardt'
199+
{Name: 'nblumhardt'}.Name ⇶ 'nblumhardt'
200+
201+
// Wildcards
202+
[1,2,3][?] > 2 ⇶ true
203+
[1,2,3][*] > 2 ⇶ false
204+
205+
// Text and regex
206+
ismatch('foo', 'f') ⇶ true
207+
indexofmatch('foo', 'o') ⇶ 1
208+
ismatch('foo', '^f') ⇶ true
209+
ismatch('foo', 'F') ⇶ false
210+
ismatch('foo', 'F') ci ⇶ true
211+
ismatch('foo', '^o') ⇶ false
212+
indexofmatch('foo', 'x') ⇶ -1
213+
substring('abcd', 1, 2) ⇶ 'bc'
214+
substring('abcd', 1) ⇶ 'bcd'
215+
concat('a', 'b', 'c') ⇶ 'abc'
216+
concat('a', 42, 'c') ⇶ undefined()
217+
concat('a', undefined()) ⇶ undefined()
218+
concat(undefined(), 'b') ⇶ undefined()
219+
220+
// Conditional
221+
if true then 1 else 2 ⇶ 1
222+
if 1 + 2 = 3 then 1 else 2 ⇶ 1
223+
if false then 1 else 2 ⇶ 2
224+
if undefined() then 1 else 2 ⇶ 2
225+
if 'string' then 1 else 2 ⇶ 2
226+
if true then if false then 1 else 2 else 3 ⇶ 2
227+
228+
// ToString
229+
tostring(16) ⇶ '16'
230+
tostring('test') ⇶ 'test'
231+
tostring({}) ⇶ undefined()
232+
tostring([]) ⇶ undefined()
233+
tostring(16, '000') ⇶ '016'
234+
tostring(null) ⇶ undefined()
235+
tostring(undefined()) ⇶ undefined()
236+
tostring('test', '000') ⇶ 'test'
237+
tostring('test', []) ⇶ undefined()
238+
tostring('test', 42) ⇶ undefined()
239+
tostring(16, undefined()) ⇶ '16'
240+
tostring(16, null) ⇶ '16'
241+
242+
// Tests are in fr-FR
243+
tostring(16.3) ⇶ '16,3'
244+
245+
// TypeOf
246+
typeof(undefined()) ⇶ 'undefined'
247+
typeof('test') ⇶ 'System.String'
248+
typeof(10) ⇶ 'System.Decimal'
249+
typeof(true) ⇶ 'System.Boolean'
250+
typeof(null) ⇶ 'null'
251+
typeof([]) ⇶ 'array'
252+
typeof({}) ⇶ 'object'
253+
254+
// UtcDateTime
255+
tostring(utcdatetime(now()), 'o') like '20%' ⇶ true
256+
257+
// Case comparison
258+
'test' = 'TEST' ⇶ false
259+
'tschüß' = 'TSCHÜSS' ⇶ false
260+
'ὈΔΥΣΣΕΎΣ!' = 'ὀδυσσεύς!' ⇶ false
261+
'ὈΔΥΣΣΕΎΣ!' = 'ὀδυσσεύσ!' ⇶ false
262+
'test' = 'TEST' ci ⇶ true
263+
'tschüß' = 'TSCHÜSS' ci ⇶ false
264+
'ὈΔΥΣΣΕΎΣ!' = 'ὀδυσσεύσ!' ci ⇶ true
265+
null = 0 ci ⇶ false
266+
null = null ci ⇶ true
267+
null = undefined() ci ⇶ undefined()
268+
undefined() = undefined() ci ⇶ undefined()
269+
270+
// Like
271+
'test' like 'test' ⇶ true
272+
'test' like 'Test' ⇶ false
273+
'test' like 'Test' ci ⇶ true
274+
'test' like '%st' ⇶ true
275+
'test' like '_est' ⇶ true
276+
'test' like 't%t' ⇶ true
277+
'test' like 't_st' ⇶ true
278+
'test' like 'te%' ⇶ true
279+
'test' like 'tes_' ⇶ true
280+
'test' like '%su' ⇶ false
281+
'test' like '_esu' ⇶ false
282+
'test' like 't%u' ⇶ false
283+
'test' like 't_su' ⇶ false
284+
'test' like 'ue%' ⇶ false
285+
'test' like 'ues_' ⇶ false
286+
'test' like '%s_' ⇶ true
287+
'test' like '%' ⇶ true
288+
'test' like 't%s%' ⇶ true
289+
'test' like 'es' ⇶ false
290+
'test' like '' ⇶ false
291+
'' like '' ⇶ true
292+
293+
// Case manipulation
294+
tolower('Test') ⇶ 'test'
295+
toupper('Test') ⇶ 'TEST'
296+
297+
// URI encoding
298+
uriencode(null) ⇶ undefined()
299+
uriencode(undefined()) ⇶ undefined()
300+
uriencode('') ⇶ ''
301+
uriencode(' ') ⇶ '%20'
302+
303+
tostring(@l, 'u3') ⇶ 'INF'
304+
tostring(@Elapsed) ⇶ '00:10:00'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{'world'}! ⇶ (world)!
2+
{substring('world', 0, 2)}! ⇶ (wo)!
3+
{unsafe('world')}! ⇶ world!
4+
|{somethingnothere}| ⇶ |()|
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Hello, {'world'}! ⇶ Hello, world!
2+
{@l} ⇶ Information
3+
{@l:u3} ⇶ INF
4+
{@Level:u3} ⇶ INF
5+
Items are {[1, 2]} ⇶ Items are [1,2]
6+
Members are { {a: 1, 'b c': 2} } ⇶ Members are {"a":1,"b c":2}
7+
{@p} ⇶ {"Name":"nblumhardt"}
8+
Hello, {'my } brackety { {}} friends'}! ⇶ Hello, my } brackety { {}} friends!
9+
Text only ⇶ Text only
10+
{{ Escaped {{ left {{ ⇶ { Escaped { left {
11+
}} Escaped }} right }} ⇶ } Escaped } right }
12+
Formatted {42:0000} ⇶ Formatted 0042
13+
Aligned {42,4}! ⇶ Aligned 42!
14+
Left {42,-4}! ⇶ Left 42 !
15+
Under width {42,0}! ⇶ Under width 42!
16+
{@m} ⇶ Hello, nblumhardt!
17+
{@Message} ⇶ Hello, nblumhardt!
18+
Hello, {#if true}world{#end}! ⇶ Hello, world!
19+
Hello, {#if true}w{42}d{#end}! ⇶ Hello, w42d!
20+
Hello, {#if 1 = 1}world{#else}there{#end}! ⇶ Hello, world!
21+
Hello, {#if 1 = 2}world{#else}there{#end}! ⇶ Hello, there!
22+
Hello, {#if undefined()}world{#else}there{#end}! ⇶ Hello, there!
23+
A{#if false}B{#else if false}C{#else if true}D{#else}E{#end} ⇶ AD
24+
A{#if false}B{#else if true}C{#end} ⇶ AC
25+
{#if true}A{#if false}B{#else}C{#end}D{#end} ⇶ ACD
26+
{#each a in [1,2,3]}<{a}>{#delimit},{#end} ⇶ <1>,<2>,<3>
27+
{#each a, i in [1,2,3]}<{a}>({i}){#delimit},{#end} ⇶ <1>(0),<2>(1),<3>(2)
28+
{#each a in {x: 1, y: 2}}{a}{#end} ⇶ xy
29+
{#each a, b in {x: 1, y: 2}}{a}.{b}{#end} ⇶ x.1y.2
30+
{#each a, b in {x: {y: 'z'}}}{#each c, d in b}A: {a}, C: {c}, D: {d}{#end}{#end} ⇶ A: x, C: y, D: z
31+
{#if true}A{#each a in [1]}B{a}{#end}C{#end}D ⇶ AB1CD
32+
{#each a in []}{a}!{#else}none{#end} ⇶ none
33+
Culture-specific {42.34} ⇶ Culture-specific 42,34
34+
{rest()} ⇶ {"Name":"nblumhardt"}
35+
{Name} {rest()} ⇶ nblumhardt {}
36+
{rest(true)} ⇶ {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Like
2+
A like 'a' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, '^a$'), -1)
3+
A like 'a%' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, '^a'), -1)
4+
A like '%a%' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, 'a'), -1)
5+
A like '%a' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, 'a$'), -1)
6+
A like '%a_b%' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, 'a.b'), -1)
7+
A like 'a%b%' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, '^a(?:.|\r|\n)*b'), -1)
8+
A like '%' ⇶ _Internal_NotEqual(_Internal_IndexOfMatch(A, '.*'), -1)
9+
10+
// Root properties
11+
@p['Test'] ⇶ Test
12+
@p[Test] ⇶ @p[Test]
13+
14+
// Variadics
15+
coalesce(A, B, C, D) ⇶ coalesce(A, coalesce(B, coalesce(C, D)))
16+
17+
// Wildcards!
18+
A[?] ⇶ _Internal_Any(A, |$$p0| {$$p0})
19+
A or B[*] ⇶ _Internal_Or(A, _Internal_All(B, |$$p0| {$$p0}))
20+
not (A is not null) or not (A[?] = 'a') ⇶ _Internal_Or(_Internal_Not(_Internal_IsNotNull(A)), _Internal_Not(_Internal_Any(A, |$$p0| {_Internal_Equal($$p0, 'a')})))
21+
A[?].B[*].C = D ⇶ _Internal_Any(A, |$$p1| {_Internal_All($$p1.B, |$$p0| {_Internal_Equal($$p0.C, D)})})

0 commit comments

Comments
 (0)