-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.lts
129 lines (97 loc) · 2.64 KB
/
test.lts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
*
* This is a test file for the parser.
* It is meant to test each feature, even tho it doesn't
* make any sense most of the times.
* This should never throw once committed.
*
*/
import someType from origin.utils;
import foo from bar;
using std.collections;
public namespace my_space;
internal struct test {
private internal someStuff: int;
otherStuff: str = "58" + hi;
}
// NOTE: Function that have parameters with the `type [a, b]` syntax will not be printed
// exactly as they appear in the file.
// I think this is fine for now, since the fix would be non-trivial and it wouldn't change much
func someFunc1(char a, string [b, c], int d): int {
print(a.toString() + b + c);
}
func someFunc2(int [seed, min = 0, max]) {
return new Random(seed).next(min, max);
}
func someFunc() {
print("called!");
return;
}
func main() {
arr = [ 36, 1.1d.toString(), 215, "he", true, [ .546e+20, 486513UL], aur, /* wtf */ new String() ];
arr.add([], arr);
print $"hello {"benjamin"} ! Today will be {GetWeather(pressure * 10.644^(temperature-2048))}";
print "Fun fact: In lotus, you can easily mix expression and strings! "
+ $"For example, you can write: $\'It's currently {{time.now}}\' and it will replace time.now with {time.now}";
print(arr[1][0] == '1');
print(io.read(test.lts).count('\u0041'));
n = 5
* ("hello " + "world")
^^ (1 / 3 != 3 / 1)
&& (6 * 9 == 9 * 6)
|| !(-6 * -1 == 6)
* (89 < 8 * 9)
+ (45 >= 44)
% (-48946f == 4984e2 - 464.13 ? 2d^7 : 2^6)
&& !true
;
var a = 0;
var b = arr != [] ? arr : [ 0 ];
foreach (item in collection) { }
foreach (otherItem in otherCollection) {
if (collection.contains(otherItem))
break;
otherItem.markAsBad();
}
for (var i = 0, i < 10, i++) {
print(i);
}
for (var j = i, i > 10,) { }
if (condition)
print("it's true");
else
;
if (a || b && c != d + e)
print("tf");
else if (this.otherCondition()) {
print("maybe ?");
} else { } // fuck it
while (str.length < 20) {
if (str[-1] == "z") continue;
str.concat(alphabet[rnd.next(26)], rnd.next(26));
}
do
print("still looping");
while (_global++ < 13)
}
internal enum TokenKind {
EOF = 0,
delimiter,
identifier,
number,
bool,
string,
operator,
keyword,
semicolon,
trivia
}
enum TokenKind.trivia::TriviaKind {
EOF = 0,
comment,
whitespace,
newline,
character
}
/* some /* nested */ comments */
// some ending one-line comment