Changeset View
Changeset View
Standalone View
Standalone View
autotests/html/highlight.pony.html
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> | ||
---|---|---|---|---|---|
2 | <html><head> | 2 | <html><head> | ||
3 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | 3 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
4 | <title>highlight.pony</title> | 4 | <title>highlight.pony</title> | ||
5 | <meta name="generator" content="KF5::SyntaxHighlighting (Pony)"/> | 5 | <meta name="generator" content="KF5::SyntaxHighlighting (Pony)"/> | ||
6 | </head><body style="color:#1f1c1b"><pre> | 6 | </head><body style="color:#1f1c1b"><pre> | ||
7 | <span style="color:#898887;">// Test file for Pony syntax highlighting, released under MIT License</span> | 7 | <span style="color:#898887;">// Test file for Pony syntax highlighting, released under MIT License</span> | ||
8 | 8 | | |||
9 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Red</span> <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">apply</span>(): U32 => <span style="color:#b08000;">0xFFFF0000</span> | 9 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Red</span> <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">apply</span>(): <span style="color:#0057ae;">U32</span> => <span style="color:#b08000;">0xFFFF0000</span> | ||
10 | 10 | | |||
11 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Colours</span> | 11 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Colours</span> | ||
12 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">black</span>(): U32 => <span style="color:#b08000;">0xFF000000</span> | 12 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">black</span>(): <span style="color:#0057ae;">U32</span> => <span style="color:#b08000;">0xFF000000</span> | ||
13 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">red</span>(): U32 => <span style="color:#b08000;">0xFFFF0000</span> | 13 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">red</span>(): <span style="color:#0057ae;">U32</span> => <span style="color:#b08000;">0xFFFF0000</span> | ||
14 | 14 | | |||
15 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Black</span> | 15 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Black</span> | ||
16 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Blue</span> | 16 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">Blue</span> | ||
17 | 17 | | |||
18 | <span style="font-weight:bold;">type</span> <span style="color:#0057ae;">Colour</span> <span style="font-weight:bold;">is</span> (<span style="color:#0057ae;">Black</span> | <span style="color:#0057ae;">Blue</span> ) | 18 | <span style="font-weight:bold;">type</span> <span style="color:#0057ae;">Colour</span> <span style="font-weight:bold;">is</span> (<span style="color:#0057ae;">Black</span> | <span style="color:#0057ae;">Blue</span> ) | ||
19 | 19 | | |||
20 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">ColourList</span> | 20 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">ColourList</span> | ||
21 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">apply</span>(): <span style="color:#0057ae;">Array</span>[<span style="color:#0057ae;">Colour</span>] => | 21 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">apply</span>(): <span style="color:#0057ae;">Array</span>[<span style="color:#0057ae;">Colour</span>] => | ||
22 | [<span style="color:#0057ae;">Black</span>; <span style="color:#0057ae;">Blue</span>] | 22 | [<span style="color:#0057ae;">Black</span>; <span style="color:#0057ae;">Blue</span>] | ||
23 | 23 | | |||
24 | <span style="font-weight:bold;">for</span> colour <span style="font-weight:bold;">in</span> <span style="color:#0057ae;">ColourList</span>().values() <span style="font-weight:bold;">do</span> | 24 | <span style="font-weight:bold;">for</span> colour <span style="font-weight:bold;">in</span> <span style="color:#0057ae;">ColourList</span>().values() <span style="font-weight:bold;">do</span> | ||
25 | <span style="font-weight:bold;">end</span> | 25 | <span style="font-weight:bold;">end</span> | ||
26 | 26 | | |||
27 | <span style="font-weight:bold;">type</span> <span style="color:#0057ae;">EGLEvent</span> <span style="font-weight:bold;">is</span> (U8, F32, F32) | 27 | <span style="font-weight:bold;">type</span> <span style="color:#0057ae;">EGLEvent</span> <span style="font-weight:bold;">is</span> (<span style="color:#0057ae;">U8</span>, <span style="color:#0057ae;">F32</span>, <span style="color:#0057ae;">F32</span>) | ||
28 | (<span style="font-weight:bold;">var</span> code, <span style="font-weight:bold;">var</span> x, <span style="font-weight:bold;">var</span> y) = <span style="color:#644a9b;">@getEvent</span>[<span style="color:#0057ae;">EGLEvent</span>]() | 28 | (<span style="font-weight:bold;">var</span> code, <span style="font-weight:bold;">var</span> x, <span style="font-weight:bold;">var</span> y) = <span style="color:#644a9b;">@getEvent</span>[<span style="color:#0057ae;">EGLEvent</span>]() | ||
29 | 29 | | |||
30 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">_XDisplayHandle</span> | 30 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">_XDisplayHandle</span> | ||
31 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">_EGLDisplayHandle</span> | 31 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">_EGLDisplayHandle</span> | ||
32 | 32 | | |||
33 | <span style="font-weight:bold;">let</span> x_dpy = <span style="color:#644a9b;">@XOpenDisplay</span>[<span style="color:#0057ae;">Pointer</span>[_XDisplayHandle]](U32(<span style="color:#b08000;">0</span>)) | 33 | <span style="font-weight:bold;">let</span> x_dpy = <span style="color:#644a9b;">@XOpenDisplay</span>[<span style="color:#0057ae;">Pointer</span>[<span style="color:#0057ae;">_XDisplayHandle</span>]](<span style="color:#0057ae;">U32</span>(<span style="color:#b08000;">0</span>)) | ||
34 | <span style="font-weight:bold;">if</span> x_dpy.is_null() <span style="font-weight:bold;">then</span> | 34 | <span style="font-weight:bold;">if</span> x_dpy.is_null() <span style="font-weight:bold;">then</span> | ||
35 | env.out.print(<span style="color:#bf0303;">"XOpenDisplay failed"</span>) | 35 | env.out.print(<span style="color:#bf0303;">"XOpenDisplay failed"</span>) | ||
36 | <span style="font-weight:bold;">end</span> | 36 | <span style="font-weight:bold;">end</span> | ||
37 | 37 | | |||
38 | <span style="font-weight:bold;">let</span> e_dpy = <span style="color:#644a9b;">@eglGetDisplay</span>[<span style="color:#0057ae;">Pointer</span>[_EGLDisplayHandle]](x_dpy) | 38 | <span style="font-weight:bold;">let</span> e_dpy = <span style="color:#644a9b;">@eglGetDisplay</span>[<span style="color:#0057ae;">Pointer</span>[<span style="color:#0057ae;">_EGLDisplayHandle</span>]](x_dpy) | ||
39 | <span style="font-weight:bold;">if</span> e_dpy.is_null() <span style="font-weight:bold;">then</span> | 39 | <span style="font-weight:bold;">if</span> e_dpy.is_null() <span style="font-weight:bold;">then</span> | ||
40 | env.out.print(<span style="color:#bf0303;">"eglGetDisplay failed"</span>) | 40 | env.out.print(<span style="color:#bf0303;">"eglGetDisplay failed"</span>) | ||
41 | <span style="font-weight:bold;">end</span> | 41 | <span style="font-weight:bold;">end</span> | ||
42 | 42 | | |||
43 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">_EGLConfigHandle</span> | 43 | <span style="font-weight:bold;">primitive</span> <span style="color:#0057ae;">_EGLConfigHandle</span> | ||
44 | <span style="font-weight:bold;">let</span> a = <span style="color:#0057ae;">Array</span>[U16](<span style="color:#b08000;">8</span>) | 44 | <span style="font-weight:bold;">let</span> a = <span style="color:#0057ae;">Array</span>[<span style="color:#0057ae;">U16</span>](<span style="color:#b08000;">8</span>) | ||
45 | a.push(<span style="color:#b08000;">0x3040</span>) | 45 | a.push(<span style="color:#b08000;">0x3040</span>) | ||
46 | a.push(<span style="color:#b08000;">0b01011</span>) | 46 | a.push(<span style="color:#b08000;">0b01011</span>) | ||
47 | <span style="font-weight:bold;">let</span> config = <span style="color:#0057ae;">Pointer</span>[_EGLConfigHandle] | 47 | <span style="font-weight:bold;">let</span> config = <span style="color:#0057ae;">Pointer</span>[<span style="color:#0057ae;">_EGLConfigHandle</span>] | ||
48 | <span style="font-weight:bold;">if</span> <span style="color:#644a9b;">@eglChooseConfig</span>[U32](e_dpy, a, config, U32(<span style="color:#b08000;">1</span>), <span style="color:#0057ae;">Pointer</span>[U32]) == <span style="color:#b08000;">0</span> <span style="font-weight:bold;">then</span> | 48 | <span style="font-weight:bold;">if</span> <span style="color:#644a9b;">@eglChooseConfig</span>[<span style="color:#0057ae;">U32</span>](e_dpy, a, config, <span style="color:#0057ae;">U32</span>(<span style="color:#b08000;">1</span>), <span style="color:#0057ae;">Pointer</span>[<span style="color:#0057ae;">U32</span>]) == <span style="color:#b08000;">0</span> <span style="font-weight:bold;">then</span> | ||
49 | env.out.print(<span style="color:#bf0303;">"eglChooseConfig failed"</span>) | 49 | env.out.print(<span style="color:#bf0303;">"eglChooseConfig failed"</span>) | ||
50 | <span style="font-weight:bold;">end</span> | 50 | <span style="font-weight:bold;">end</span> | ||
51 | 51 | | |||
52 | 52 | | |||
53 | <span style="font-weight:bold;">actor</span> <span style="color:#0057ae;">Main</span> | 53 | <span style="font-weight:bold;">actor</span> <span style="color:#0057ae;">Main</span> | ||
54 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">create</span>(env: <span style="color:#0057ae;">Env</span>) => | 54 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">create</span>(env: <span style="color:#0057ae;">Env</span>) => | ||
55 | <span style="color:#898887;">// The no of arguments</span> | 55 | <span style="color:#898887;">// The no of arguments</span> | ||
56 | env.out.print(env.args.size().string()) | 56 | env.out.print(env.args.size().string()) | ||
Show All 24 Lines | |||||
81 | <span style="color:#bf0303;"> """</span> | 81 | <span style="color:#bf0303;"> """</span> | ||
82 | ) | 82 | ) | ||
83 | <span style="font-weight:bold;">end</span> | 83 | <span style="font-weight:bold;">end</span> | ||
84 | <span style="font-weight:bold;">end</span> | 84 | <span style="font-weight:bold;">end</span> | ||
85 | 85 | | |||
86 | <span style="font-weight:bold;">use</span> <span style="color:#bf0303;">"ponytest"</span> | 86 | <span style="font-weight:bold;">use</span> <span style="color:#bf0303;">"ponytest"</span> | ||
87 | 87 | | |||
88 | <span style="font-weight:bold;">actor</span> <span style="color:#0057ae;">Main</span> <span style="font-weight:bold;">is</span> <span style="color:#0057ae;">TestList</span> | 88 | <span style="font-weight:bold;">actor</span> <span style="color:#0057ae;">Main</span> <span style="font-weight:bold;">is</span> <span style="color:#0057ae;">TestList</span> | ||
89 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">create</span>(env: <span style="color:#0057ae;">Env</span>) => <span style="color:#0057ae;">PonyTest</span>(env, <span style="color:#0057ae;">this</span>) | 89 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">create</span>(env: <span style="color:#0057ae;">Env</span>) => <span style="color:#0057ae;">PonyTest</span>(env, <span style="font-weight:bold;">this</span>) | ||
90 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">make</span>() => <span style="color:#0057ae;">None</span> | 90 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">make</span>() => <span style="color:#0057ae;">None</span> | ||
91 | 91 | | |||
92 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">tests</span>(test: <span style="color:#0057ae;">PonyTest</span>) => | 92 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">tests</span>(test: <span style="color:#0057ae;">PonyTest</span>) => | ||
93 | test(_TestAddition) | 93 | test(<span style="color:#0057ae;">_TestAddition</span>) | ||
94 | 94 | | |||
95 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#0057ae;">_TestAddition</span> <span style="font-weight:bold;">is</span> <span style="color:#0057ae;">UnitTest</span> | 95 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#0057ae;">_TestAddition</span> <span style="font-weight:bold;">is</span> <span style="color:#0057ae;">UnitTest</span> | ||
96 | <span style="color:#bf0303;">"""</span> | 96 | <span style="color:#bf0303;">"""</span> | ||
97 | <span style="color:#bf0303;"> Adding 2 numbers</span> | 97 | <span style="color:#bf0303;"> Adding 2 numbers</span> | ||
98 | <span style="color:#bf0303;"> """</span> | 98 | <span style="color:#bf0303;"> """</span> | ||
99 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">name</span>(): <span style="color:#0057ae;">String</span> => <span style="color:#bf0303;">"u32/add"</span> | 99 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">name</span>(): <span style="color:#0057ae;">String</span> => <span style="color:#bf0303;">"u32/add"</span> | ||
100 | 100 | | |||
101 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">apply</span>(h: <span style="color:#0057ae;">TestHelper</span>): <span style="color:#0057ae;">TestResult</span> => | 101 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">apply</span>(h: <span style="color:#0057ae;">TestHelper</span>): <span style="color:#0057ae;">TestResult</span> => | ||
102 | h.expect_eq[U32](<span style="color:#b08000;">2</span> + <span style="color:#b08000;">2</span>, <span style="color:#b08000;">4</span>) | 102 | h.expect_eq[<span style="color:#0057ae;">U32</span>](<span style="color:#b08000;">2</span> + <span style="color:#b08000;">2</span>, <span style="color:#b08000;">4</span>) | ||
103 | 103 | | |||
104 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">log</span>(msg: <span style="color:#0057ae;">String</span>, verbose: <span style="color:#0057ae;">Bool</span> = false) | 104 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">log</span>(msg: <span style="color:#0057ae;">String</span>, verbose: <span style="color:#0057ae;">Bool</span> = <span style="font-weight:bold;">false</span>) | ||
105 | <span style="font-weight:bold;">be</span> <span style="color:#644a9b;">fail</span>() => | 105 | <span style="font-weight:bold;">be</span> <span style="color:#644a9b;">fail</span>() => | ||
106 | <span style="font-weight:bold;">be</span> <span style="color:#644a9b;">assert_failed</span>(msg: <span style="color:#0057ae;">String</span>) => | 106 | <span style="font-weight:bold;">be</span> <span style="color:#644a9b;">assert_failed</span>(msg: <span style="color:#0057ae;">String</span>) => | ||
107 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">assert_true</span>(actual: <span style="color:#0057ae;">Bool</span>, msg: <span style="color:#0057ae;">String</span> = <span style="color:#bf0303;">""</span>) ? | 107 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">assert_true</span>(actual: <span style="color:#0057ae;">Bool</span>, msg: <span style="color:#0057ae;">String</span> = <span style="color:#bf0303;">""</span>) ? | ||
108 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">expect_true</span>(actual: <span style="color:#0057ae;">Bool</span>, msg: <span style="color:#0057ae;">String</span> = <span style="color:#bf0303;">""</span>): <span style="color:#0057ae;">Bool</span> | 108 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">expect_true</span>(actual: <span style="color:#0057ae;">Bool</span>, msg: <span style="color:#0057ae;">String</span> = <span style="color:#bf0303;">""</span>): <span style="color:#0057ae;">Bool</span> | ||
109 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">expect_eq</span>[<span style="color:#0057ae;">A</span>: (<span style="color:#0057ae;">Equatable</span>[<span style="color:#0057ae;">A</span>] <span style="color:#0057ae;">#read</span> & <span style="color:#0057ae;">Stringable</span>)] | 109 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">tag</span> <span style="color:#644a9b;">expect_eq</span>[<span style="color:#0057ae;">A</span>: (<span style="color:#0057ae;">Equatable</span>[<span style="color:#0057ae;">A</span>] <span style="color:#0057ae;">#read</span> & <span style="color:#0057ae;">Stringable</span>)] | ||
110 | (expect: <span style="color:#0057ae;">A</span>, actual: <span style="color:#0057ae;">A</span>, msg: <span style="color:#0057ae;">String</span> = <span style="color:#bf0303;">""</span>): <span style="color:#0057ae;">Bool</span> | 110 | (expect: <span style="color:#0057ae;">A</span>, actual: <span style="color:#0057ae;">A</span>, msg: <span style="color:#0057ae;">String</span> = <span style="color:#bf0303;">""</span>): <span style="color:#0057ae;">Bool</span> | ||
111 | 111 | | |||
112 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">add</span>(other: <span style="color:#0057ae;">A</span>): <span style="color:#0057ae;">A</span> | 112 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">add</span>(other: <span style="color:#0057ae;">A</span>): <span style="color:#0057ae;">A</span> | ||
Show All 13 Lines | |||||
126 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">op_or</span>(other: <span style="color:#0057ae;">A</span>): <span style="color:#0057ae;">A</span> | 126 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">op_or</span>(other: <span style="color:#0057ae;">A</span>): <span style="color:#0057ae;">A</span> | ||
127 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">op_xor</span>(othr: <span style="color:#0057ae;">A</span>): <span style="color:#0057ae;">A</span> | 127 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">op_xor</span>(othr: <span style="color:#0057ae;">A</span>): <span style="color:#0057ae;">A</span> | ||
128 | 128 | | |||
129 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;">Test</span> | 129 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;">Test</span> | ||
130 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">alpha</span>() => | 130 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">alpha</span>() => | ||
131 | <span style="color:#bf0303;">"""</span> | 131 | <span style="color:#bf0303;">"""</span> | ||
132 | <span style="color:#bf0303;"> """</span> | 132 | <span style="color:#bf0303;"> """</span> | ||
133 | 133 | | |||
134 | <span style="font-weight:bold;">let</span> dice: <span style="color:#0057ae;">Array</span>[U32] = [<span style="color:#b08000;">1</span>; <span style="color:#b08000;">2</span>; <span style="color:#b08000;">3</span> | 134 | <span style="font-weight:bold;">let</span> dice: <span style="color:#0057ae;">Array</span>[<span style="color:#0057ae;">U32</span>] = [<span style="color:#b08000;">1</span>; <span style="color:#b08000;">2</span>; <span style="color:#b08000;">3</span> | ||
135 | <span style="color:#b08000;">4</span> | 135 | <span style="color:#b08000;">4</span> | ||
136 | <span style="color:#b08000;">5</span> | 136 | <span style="color:#b08000;">5</span> | ||
137 | <span style="color:#b08000;">6</span> | 137 | <span style="color:#b08000;">6</span> | ||
138 | ] | 138 | ] | ||
139 | 139 | | |||
140 | <span style="font-weight:bold;">actor</span> <span style="color:#0057ae;">Main</span> | 140 | <span style="font-weight:bold;">actor</span> <span style="color:#0057ae;">Main</span> | ||
141 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">foo</span>(n:U32): {<span style="color:#0057ae;font-style:italic;">ref</span>(U32): U32} => | 141 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">foo</span>(n:<span style="color:#0057ae;">U32</span>): {<span style="color:#0057ae;font-style:italic;">ref</span>(<span style="color:#0057ae;">U32</span>): <span style="color:#0057ae;">U32</span>} => | ||
142 | <span style="font-weight:bold;">var</span> s: <span style="color:#0057ae;">Array</span>[U32] = <span style="color:#0057ae;">Array</span>[U32].init(n, <span style="color:#b08000;">1</span>) | 142 | <span style="font-weight:bold;">var</span> s: <span style="color:#0057ae;">Array</span>[<span style="color:#0057ae;">U32</span>] = <span style="color:#0057ae;">Array</span>[<span style="color:#0057ae;">U32</span>].init(n, <span style="color:#b08000;">1</span>) | ||
143 | {<span style="color:#0057ae;font-style:italic;">ref</span>(i:U32)(s): U32 => | 143 | {<span style="color:#0057ae;font-style:italic;">ref</span>(i:<span style="color:#0057ae;">U32</span>)(s): <span style="color:#0057ae;">U32</span> => | ||
144 | <span style="font-weight:bold;">try</span> | 144 | <span style="font-weight:bold;">try</span> | ||
145 | s(<span style="color:#b08000;">0</span>) = s(<span style="color:#b08000;">0</span>) + i | 145 | s(<span style="color:#b08000;">0</span>) = s(<span style="color:#b08000;">0</span>) + i | ||
146 | s(<span style="color:#b08000;">0</span>) | 146 | s(<span style="color:#b08000;">0</span>) | ||
147 | <span style="font-weight:bold;">else</span> | 147 | <span style="font-weight:bold;">else</span> | ||
148 | <span style="color:#b08000;">0</span> | 148 | <span style="color:#b08000;">0</span> | ||
149 | <span style="font-weight:bold;">end</span> | 149 | <span style="font-weight:bold;">end</span> | ||
150 | } | 150 | } | ||
151 | 151 | | |||
152 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">create</span>(env:<span style="color:#0057ae;">Env</span>) => | 152 | <span style="font-weight:bold;">new</span> <span style="color:#644a9b;">create</span>(env:<span style="color:#0057ae;">Env</span>) => | ||
153 | <span style="font-weight:bold;">var</span> f = foo(<span style="color:#b08000;">5</span>) | 153 | <span style="font-weight:bold;">var</span> f = foo(<span style="color:#b08000;">5</span>) | ||
154 | env.out.print(f(<span style="color:#b08000;">10</span>).string()) | 154 | env.out.print(f(<span style="color:#b08000;">10</span>).string()) | ||
155 | env.out.print(f(<span style="color:#b08000;">20</span>).string()) | 155 | env.out.print(f(<span style="color:#b08000;">20</span>).string()) | ||
156 | 156 | | |||
157 | <span style="color:#898887;">/* nested /* commentary */ */</span> | 157 | <span style="color:#898887;">/* nested /* commentary */ */</span> | ||
158 | <span style="color:#898887;">// simgle comment</span> | 158 | <span style="color:#898887;">// single comment</span> | ||
159 | 159 | | |||
160 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;">A</span> | ||||
161 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;">_A</span> | ||||
162 | x' | ||||
163 | x'' | ||||
164 | x'.string() | ||||
160 | <span style="color:#3daee9;">'\uaaaa'</span> | 165 | <span style="color:#3daee9;">'\uaaaa'</span> | ||
161 | <span style="color:#3daee9;">'\Ubbbbbb'</span> | 166 | <span style="color:#3daee9;">'\Ubbbbbb'</span> | ||
162 | <span style="color:#3daee9;">'\xcc'</span> | 167 | <span style="color:#3daee9;">'\xcc'</span> | ||
163 | <span style="color:#bf0303;">"</span><span style="color:#3daee9;">\uaaaa</span><span style="color:#bf0303;">a"</span> | 168 | <span style="color:#bf0303;">"</span><span style="color:#3daee9;">\uaaaa</span><span style="color:#bf0303;">a"</span> | ||
164 | <span style="color:#bf0303;">"</span><span style="color:#3daee9;">\Ubbbbbb</span><span style="color:#bf0303;">b"</span> | 169 | <span style="color:#bf0303;">"</span><span style="color:#3daee9;">\Ubbbbbb</span><span style="color:#bf0303;">b"</span> | ||
165 | <span style="color:#bf0303;">"</span><span style="color:#3daee9;">\xcc</span><span style="color:#bf0303;">c"</span> | 170 | <span style="color:#bf0303;">"</span><span style="color:#3daee9;">\xcc</span><span style="color:#bf0303;">c"</span> | ||
166 | <span style="color:#b08000;">34.4</span> | 171 | <span style="color:#b08000;">34.4</span> | ||
167 | <span style="color:#b08000;">34.4e43</span> | 172 | <span style="color:#b08000;">34.4e43</span> | ||
168 | <span style="color:#b08000;">43e4</span> | 173 | <span style="color:#b08000;">43e4</span> | ||
169 | <span style="color:#b08000;">0x3040</span> | 174 | <span style="color:#b08000;">0x3040</span> | ||
170 | <span style="color:#b08000;">0xaF</span> | 175 | <span style="color:#b08000;">0xaF</span> | ||
171 | <span style="color:#b08000;">0b01</span> | 176 | <span style="color:#b08000;">0b01</span> | ||
172 | <span style="color:#b08000;">3_43_4</span> | 177 | <span style="color:#b08000;">3_43_4</span> | ||
173 | <span style="color:#b08000;">0x0_4</span> | 178 | <span style="color:#b08000;">0x0_4</span> | ||
174 | 179 | | |||
175 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">create</span>(): U32 => <span style="color:#b08000;">0</span> | 180 | <span style="font-weight:bold;">fun</span> <span style="color:#644a9b;">create</span>(): <span style="color:#0057ae;">U32</span> => <span style="color:#b08000;">0</span> | ||
176 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#644a9b;">create</span>(): U32 => <span style="color:#b08000;">0</span> | 181 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#644a9b;">create</span>(): <span style="color:#0057ae;">U32</span> => <span style="color:#b08000;">0</span> | ||
177 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;">\\ abc \\</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#644a9b;">create</span>(): U32 => <span style="color:#b08000;">0</span> | 182 | <span style="font-weight:bold;">fun</span> <span style="color:#0057ae;">\\ abc \\</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#644a9b;">create</span>(): <span style="color:#0057ae;">U32</span> => <span style="color:#b08000;">0</span> | ||
178 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;">\\ packet, blah \\</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#0057ae;">Xyz</span> | 183 | <span style="font-weight:bold;">class</span> <span style="color:#0057ae;">\\ packet, blah \\</span> <span style="color:#0057ae;font-style:italic;">iso</span> <span style="color:#0057ae;">Xyz</span> | ||
179 | <span style="font-weight:bold;">if</span> <span style="color:#0057ae;">\\ likely \\</span> a <span style="font-weight:bold;">then</span> | 184 | <span style="font-weight:bold;">if</span> <span style="color:#0057ae;">\\ likely \\</span> a <span style="font-weight:bold;">then</span> | ||
180 | <span style="font-weight:bold;">end</span> | 185 | <span style="font-weight:bold;">end</span> | ||
181 | 186 | | |||
182 | a.endnormal | 187 | a.endnormal | ||
183 | 188 | | |||
189 | print();print() | ||||
190 | | ||||
184 | <span style="color:#898887;">/* syntactically false: */</span> | 191 | <span style="color:#898887;">/* syntactically false: */</span> | ||
185 | 192 | | |||
193 | <span style="font-weight:bold;">class</span> <span style="color:#bf0303;text-decoration:underline;">_aA</span> | ||||
194 | <span style="font-weight:bold;">class</span> <span style="color:#bf0303;text-decoration:underline;">_a</span> | ||||
195 | <span style="font-weight:bold;">class</span> <span style="color:#bf0303;text-decoration:underline;">a</span> | ||||
186 | <span style="color:#bf0303;text-decoration:underline;">0b2332</span> | 196 | <span style="color:#bf0303;text-decoration:underline;">0b2332</span> | ||
187 | <span style="color:#bf0303;text-decoration:underline;">0b</span> | 197 | <span style="color:#bf0303;text-decoration:underline;">0b</span> | ||
188 | <span style="color:#bf0303;text-decoration:underline;">0x</span> | 198 | <span style="color:#bf0303;text-decoration:underline;">0x</span> | ||
189 | <span style="color:#bf0303;text-decoration:underline;">0xgf</span> | 199 | <span style="color:#bf0303;text-decoration:underline;">0xgf</span> | ||
190 | <span style="color:#bf0303;text-decoration:underline;">0f00</span> | 200 | <span style="color:#bf0303;text-decoration:underline;">0f00</span> | ||
191 | <span style="color:#b08000;">3</span>. | 201 | <span style="color:#bf0303;text-decoration:underline;">3.</span> | ||
192 | <span style="color:#bf0303;text-decoration:underline;">.3</span> | 202 | <span style="color:#bf0303;text-decoration:underline;">.3</span> | ||
193 | <span style="color:#b08000;">3</span>.e3 | 203 | <span style="color:#bf0303;text-decoration:underline;">3.</span>e3 | ||
194 | <span style="color:#bf0303;text-decoration:underline;">3_</span> | 204 | <span style="color:#bf0303;text-decoration:underline;">3_</span> | ||
195 | <span style="color:#bf0303;text-decoration:underline;">3__43_4</span> | 205 | <span style="color:#bf0303;text-decoration:underline;">3__43_4</span> | ||
196 | <span style="color:#bf0303;text-decoration:underline;">''</span> | 206 | <span style="color:#bf0303;text-decoration:underline;">''</span> | ||
197 | <span style="color:#bf0303;text-decoration:underline;">'\u'</span> | 207 | <span style="color:#bf0303;text-decoration:underline;">'</span>\u' | ||
198 | <span style="color:#bf0303;text-decoration:underline;">'\ua'</span> | 208 | <span style="color:#bf0303;text-decoration:underline;">'</span>\ua' | ||
199 | <span style="color:#bf0303;text-decoration:underline;">'\uaaa'</span> | 209 | <span style="color:#bf0303;text-decoration:underline;">'</span>\uaaa' | ||
200 | <span style="color:#bf0303;text-decoration:underline;">'\uaaaaa'</span> | 210 | <span style="color:#bf0303;text-decoration:underline;">'</span>\uaaaaa' | ||
201 | <span style="color:#bf0303;text-decoration:underline;">'\uyyyy'</span> | 211 | <span style="color:#bf0303;text-decoration:underline;">'</span>\uyyyy' | ||
202 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">"</span> | 212 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">"</span> | ||
203 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">a"</span> | 213 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">a"</span> | ||
204 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">aaa"</span> | 214 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">aaa"</span> | ||
205 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">yyyy"</span> | 215 | <span style="color:#bf0303;">"</span><span style="color:#bf0303;text-decoration:underline;">\u</span><span style="color:#bf0303;">yyyy"</span> | ||
216 | a<span style="color:#bf0303;text-decoration:underline;">'</span>a | ||||
206 | 217 | | |||
207 | <span style="font-weight:bold;">class</span> <span style="color:#bf0303;text-decoration:underline;">badType</span> | 218 | <span style="font-weight:bold;">class</span> <span style="color:#bf0303;text-decoration:underline;">badType</span> | ||
219 | print()<span style="color:#bf0303;text-decoration:underline;">;</span> | ||||
208 | </pre></body></html> | 220 | </pre></body></html> |