Skip to content

Commit d359eea

Browse files
authoredOct 5, 2021
GML: Fixed operator token and added tests (#3114)
1 parent 532212b commit d359eea

File tree

7 files changed

+309
-2
lines changed

7 files changed

+309
-2
lines changed
 

‎components/prism-gml.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components/prism-gml.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
buff = buffer_create(16384, buffer_grow, 2);
2+
ini_open("Save.ini");
3+
var str = ini_read_string("Save", "Slot1", "");
4+
buffer_base64_decode_ext(buff, str, 0);
5+
ini_close();
6+
7+
----------------------------------------------------
8+
9+
[
10+
"buff ",
11+
["operator", "="],
12+
["function", "buffer_create"],
13+
["punctuation", "("],
14+
["number", "16384"],
15+
["punctuation", ","],
16+
["constant", "buffer_grow"],
17+
["punctuation", ","],
18+
["number", "2"],
19+
["punctuation", ")"],
20+
["punctuation", ";"],
21+
22+
["function", "ini_open"],
23+
["punctuation", "("],
24+
["string", "\"Save.ini\""],
25+
["punctuation", ")"],
26+
["punctuation", ";"],
27+
28+
["keyword", "var"],
29+
" str ",
30+
["operator", "="],
31+
["function", "ini_read_string"],
32+
["punctuation", "("],
33+
["string", "\"Save\""],
34+
["punctuation", ","],
35+
["string", "\"Slot1\""],
36+
["punctuation", ","],
37+
["string", "\"\""],
38+
["punctuation", ")"],
39+
["punctuation", ";"],
40+
41+
["function", "buffer_base64_decode_ext"],
42+
["punctuation", "("],
43+
"buff",
44+
["punctuation", ","],
45+
" str",
46+
["punctuation", ","],
47+
["number", "0"],
48+
["punctuation", ")"],
49+
["punctuation", ";"],
50+
51+
["function", "ini_close"],
52+
["punctuation", "("],
53+
["punctuation", ")"],
54+
["punctuation", ";"]
55+
]
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
if
2+
else
3+
switch
4+
case
5+
default
6+
break
7+
for
8+
repeat
9+
while
10+
do
11+
until
12+
continue
13+
exit
14+
return
15+
globalvar
16+
var
17+
enum
18+
19+
----------------------------------------------------
20+
21+
[
22+
["keyword", "if"],
23+
["keyword", "else"],
24+
["keyword", "switch"],
25+
["keyword", "case"],
26+
["keyword", "default"],
27+
["keyword", "break"],
28+
["keyword", "for"],
29+
["keyword", "repeat"],
30+
["keyword", "while"],
31+
["keyword", "do"],
32+
["keyword", "until"],
33+
["keyword", "continue"],
34+
["keyword", "exit"],
35+
["keyword", "return"],
36+
["keyword", "globalvar"],
37+
["keyword", "var"],
38+
["keyword", "enum"]
39+
]
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
0
2+
123
3+
123.456
4+
123.
5+
.456
6+
1e5
7+
1.2e-5f
8+
9+
0xFF
10+
0xFFul
11+
12+
----------------------------------------------------
13+
14+
[
15+
["number", "0"],
16+
["number", "123"],
17+
["number", "123.456"],
18+
["number", "123."],
19+
["number", ".456"],
20+
["number", "1e5"],
21+
["number", "1.2e-5f"],
22+
23+
["number", "0xFF"],
24+
["number", "0xFFul"]
25+
]
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
+ - % * ** /
2+
+= -= %= *= **= /=
3+
>> << ++ --
4+
5+
=
6+
== != <>
7+
< <= => >
8+
9+
& | ^ ~
10+
&& || ^^
11+
12+
or
13+
and
14+
not
15+
with
16+
at
17+
xor
18+
19+
----------------------------------------------------
20+
21+
[
22+
["operator", "+"],
23+
["operator", "-"],
24+
["operator", "%"],
25+
["operator", "*"],
26+
["operator", "**"],
27+
["operator", "/"],
28+
29+
["operator", "+="],
30+
["operator", "-="],
31+
["operator", "%="],
32+
["operator", "*="],
33+
["operator", "**="],
34+
["operator", "/="],
35+
36+
["operator", ">>"],
37+
["operator", "<<"],
38+
["operator", "++"],
39+
["operator", "--"],
40+
41+
["operator", "="],
42+
43+
["operator", "=="],
44+
["operator", "!="],
45+
["operator", "<>"],
46+
47+
["operator", "<"],
48+
["operator", "<="],
49+
["operator", "="],
50+
["operator", ">"],
51+
["operator", ">"],
52+
53+
["operator", "&"], ["operator", "|"], ["operator", "^"], ["operator", "~"],
54+
["operator", "&&"], ["operator", "||"], ["operator", "^^"],
55+
56+
["operator", "or"],
57+
["operator", "and"],
58+
["operator", "not"],
59+
["operator", "with"],
60+
["operator", "at"],
61+
["operator", "xor"]
62+
]
+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
if browser_height > window_get_height() || browser_width > window_get_width()
2+
{
3+
var xx, yy;
4+
if browser_width > window_get_width()
5+
{
6+
xx = (browser_width - window_get_width()) / 2;
7+
}
8+
else
9+
{
10+
xx = 0;
11+
}
12+
if browser_height > window_get_height()
13+
{
14+
yy = (browser_height - window_get_height()) / 2;
15+
}
16+
else
17+
{
18+
yy = 0;
19+
}
20+
window_set_position(xx, yy);
21+
}
22+
23+
----------------------------------------------------
24+
25+
[
26+
["keyword", "if"],
27+
["variable", "browser_height"],
28+
["operator", ">"],
29+
["function", "window_get_height"],
30+
["punctuation", "("],
31+
["punctuation", ")"],
32+
["operator", "||"],
33+
["variable", "browser_width"],
34+
["operator", ">"],
35+
["function", "window_get_width"],
36+
["punctuation", "("],
37+
["punctuation", ")"],
38+
39+
["punctuation", "{"],
40+
41+
["keyword", "var"],
42+
" xx",
43+
["punctuation", ","],
44+
" yy",
45+
["punctuation", ";"],
46+
47+
["keyword", "if"],
48+
["variable", "browser_width"],
49+
["operator", ">"],
50+
["function", "window_get_width"],
51+
["punctuation", "("],
52+
["punctuation", ")"],
53+
54+
["punctuation", "{"],
55+
56+
"\r\n\t\txx ",
57+
["operator", "="],
58+
["punctuation", "("],
59+
["variable", "browser_width"],
60+
["operator", "-"],
61+
["function", "window_get_width"],
62+
["punctuation", "("],
63+
["punctuation", ")"],
64+
["punctuation", ")"],
65+
["operator", "/"],
66+
["number", "2"],
67+
["punctuation", ";"],
68+
69+
["punctuation", "}"],
70+
71+
["keyword", "else"],
72+
73+
["punctuation", "{"],
74+
75+
"\r\n\t\txx ",
76+
["operator", "="],
77+
["number", "0"],
78+
["punctuation", ";"],
79+
80+
["punctuation", "}"],
81+
82+
["keyword", "if"],
83+
["variable", "browser_height"],
84+
["operator", ">"],
85+
["function", "window_get_height"],
86+
["punctuation", "("],
87+
["punctuation", ")"],
88+
89+
["punctuation", "{"],
90+
91+
"\r\n\t\tyy ",
92+
["operator", "="],
93+
["punctuation", "("],
94+
["variable", "browser_height"],
95+
["operator", "-"],
96+
["function", "window_get_height"],
97+
["punctuation", "("],
98+
["punctuation", ")"],
99+
["punctuation", ")"],
100+
["operator", "/"],
101+
["number", "2"],
102+
["punctuation", ";"],
103+
104+
["punctuation", "}"],
105+
106+
["keyword", "else"],
107+
108+
["punctuation", "{"],
109+
110+
"\r\n\t\tyy ",
111+
["operator", "="],
112+
["number", "0"],
113+
["punctuation", ";"],
114+
115+
["punctuation", "}"],
116+
117+
["function", "window_set_position"],
118+
["punctuation", "("],
119+
"xx",
120+
["punctuation", ","],
121+
" yy",
122+
["punctuation", ")"],
123+
["punctuation", ";"],
124+
125+
["punctuation", "}"]
126+
]

0 commit comments

Comments
 (0)
Please sign in to comment.