all repos — NoPaste @ ad688e0acc0360cf52f5ee4d90c4767d1804e7a3

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/wast/test.js (view raw)

  1// CodeMirror, copyright (c) by Marijn Haverbeke and others
  2// Distributed under an MIT license: https://codemirror.net/LICENSE
  3
  4(function() {
  5  var mode = CodeMirror.getMode({indentUnit: 4}, "wast");
  6  function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}
  7
  8  MT('number-test',
  9     '[number 0]',
 10     '[number 123]',
 11     '[number nan]',
 12     '[number inf]',
 13     '[number infinity]',
 14     '[number 0.1]',
 15     '[number 123.0]',
 16     '[number 12E+99]');
 17
 18  MT('string-literals-test',
 19     '[string "foo"]',
 20     '[string "\\"foo\\""]',
 21     '[string "foo #\\"# bar"]');
 22
 23  MT('atom-test',
 24     '[atom anyfunc]',
 25     '[atom i32]',
 26     '[atom i64]',
 27     '[atom f32]',
 28     '[atom f64]');
 29
 30  MT('keyword-test',
 31     '[keyword br]',
 32     '[keyword if]',
 33     '[keyword loop]',
 34     '[keyword i32.add]',
 35     '[keyword local.get]');
 36
 37  MT('control-instructions',
 38     '[keyword unreachable]',
 39     '[keyword nop]',
 40     '[keyword br] [variable-2 $label0]',
 41     '[keyword br_if] [variable-2 $label0]',
 42     '[keyword br_table] [variable-2 $label0] [variable-2 $label1] [variable-2 $label3]',
 43     '[keyword return]',
 44     '[keyword call] [variable-2 $func0]',
 45     '[keyword call_indirect] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])',
 46     '[keyword return_call] [variable-2 $func0]',
 47     '[keyword return_call_indirect] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])');
 48
 49  MT('memory-instructions',
 50     '[keyword i32.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
 51     '[keyword i32.load8_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
 52     '[keyword i32.load8_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
 53     '[keyword i32.load16_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
 54     '[keyword i32.load16_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
 55     '[keyword i32.store] [keyword offset]=[number 4] [keyword align]=[number 4]',
 56     '[keyword i32.store8] [keyword offset]=[number 4] [keyword align]=[number 4]',
 57     '[keyword i32.store16] [keyword offset]=[number 4] [keyword align]=[number 4]',
 58     '[keyword i64.store] [keyword offset]=[number 4] [keyword align]=[number 4]',
 59     '[keyword i64.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
 60     '[keyword i64.load8_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
 61     '[keyword i64.load8_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
 62     '[keyword i64.load16_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
 63     '[keyword i64.load16_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
 64     '[keyword i64.load32_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
 65     '[keyword i64.load32_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
 66     '[keyword i64.store8] [keyword offset]=[number 4] [keyword align]=[number 4]',
 67     '[keyword i64.store16] [keyword offset]=[number 4] [keyword align]=[number 4]',
 68     '[keyword i64.store32] [keyword offset]=[number 4] [keyword align]=[number 4]',
 69     '[keyword f32.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
 70     '[keyword f32.store] [keyword offset]=[number 4] [keyword align]=[number 4]',
 71     '[keyword f64.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
 72     '[keyword f64.store] [keyword offset]=[number 4] [keyword align]=[number 4]');
 73
 74  MT('atomic-memory-instructions',
 75     '[keyword memory.atomic.notify] [keyword offset]=[number 32] [keyword align]=[number 4]',
 76     '[keyword memory.atomic.wait32] [keyword offset]=[number 32] [keyword align]=[number 4]',
 77     '[keyword memory.atomic.wait64] [keyword offset]=[number 32] [keyword align]=[number 4]',
 78     '[keyword i32.atomic.load] [keyword offset]=[number 32] [keyword align]=[number 4]',
 79     '[keyword i32.atomic.load8_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 80     '[keyword i32.atomic.load16_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 81     '[keyword i32.atomic.store] [keyword offset]=[number 32] [keyword align]=[number 4]',
 82     '[keyword i32.atomic.store8] [keyword offset]=[number 32] [keyword align]=[number 4]',
 83     '[keyword i32.atomic.store16] [keyword offset]=[number 32] [keyword align]=[number 4]',
 84     '[keyword i64.atomic.load] [keyword offset]=[number 32] [keyword align]=[number 4]',
 85     '[keyword i64.atomic.load8_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 86     '[keyword i64.atomic.load16_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 87     '[keyword i64.atomic.load32_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 88     '[keyword i64.atomic.store] [keyword offset]=[number 32] [keyword align]=[number 4]',
 89     '[keyword i64.atomic.store8] [keyword offset]=[number 32] [keyword align]=[number 4]',
 90     '[keyword i64.atomic.store16] [keyword offset]=[number 32] [keyword align]=[number 4]',
 91     '[keyword i64.atomic.store32] [keyword offset]=[number 32] [keyword align]=[number 4]',
 92     '[keyword i32.atomic.rmw.add] [keyword offset]=[number 32] [keyword align]=[number 4]',
 93     '[keyword i32.atomic.rmw8.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 94     '[keyword i32.atomic.rmw16.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 95     '[keyword i64.atomic.rmw.add] [keyword offset]=[number 32] [keyword align]=[number 4]',
 96     '[keyword i64.atomic.rmw8.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 97     '[keyword i64.atomic.rmw16.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 98     '[keyword i64.atomic.rmw32.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
 99     '[keyword i32.atomic.rmw.sub] [keyword offset]=[number 32] [keyword align]=[number 4]',
100     '[keyword i32.atomic.rmw8.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
101     '[keyword i32.atomic.rmw16.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
102     '[keyword i64.atomic.rmw.sub] [keyword offset]=[number 32] [keyword align]=[number 4]',
103     '[keyword i64.atomic.rmw8.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
104     '[keyword i64.atomic.rmw16.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
105     '[keyword i64.atomic.rmw32.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
106     '[keyword i32.atomic.rmw.and] [keyword offset]=[number 32] [keyword align]=[number 4]',
107     '[keyword i32.atomic.rmw8.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
108     '[keyword i32.atomic.rmw16.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
109     '[keyword i64.atomic.rmw.and] [keyword offset]=[number 32] [keyword align]=[number 4]',
110     '[keyword i64.atomic.rmw8.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
111     '[keyword i64.atomic.rmw16.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
112     '[keyword i64.atomic.rmw32.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
113     '[keyword i32.atomic.rmw.or] [keyword offset]=[number 32] [keyword align]=[number 4]',
114     '[keyword i32.atomic.rmw8.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
115     '[keyword i32.atomic.rmw16.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
116     '[keyword i64.atomic.rmw.or] [keyword offset]=[number 32] [keyword align]=[number 4]',
117     '[keyword i64.atomic.rmw8.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
118     '[keyword i64.atomic.rmw16.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
119     '[keyword i64.atomic.rmw32.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
120     '[keyword i32.atomic.rmw.xor] [keyword offset]=[number 32] [keyword align]=[number 4]',
121     '[keyword i32.atomic.rmw8.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
122     '[keyword i32.atomic.rmw16.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
123     '[keyword i64.atomic.rmw.xor] [keyword offset]=[number 32] [keyword align]=[number 4]',
124     '[keyword i64.atomic.rmw8.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
125     '[keyword i64.atomic.rmw16.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
126     '[keyword i64.atomic.rmw32.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
127     '[keyword i32.atomic.rmw.xchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
128     '[keyword i32.atomic.rmw8.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
129     '[keyword i32.atomic.rmw16.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
130     '[keyword i64.atomic.rmw.xchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
131     '[keyword i64.atomic.rmw8.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
132     '[keyword i64.atomic.rmw16.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
133     '[keyword i64.atomic.rmw32.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
134     '[keyword i32.atomic.rmw.cmpxchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
135     '[keyword i32.atomic.rmw8.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
136     '[keyword i32.atomic.rmw16.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
137     '[keyword i64.atomic.rmw.cmpxchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
138     '[keyword i64.atomic.rmw8.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
139     '[keyword i64.atomic.rmw16.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
140     '[keyword i64.atomic.rmw32.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]');
141
142  MT('simd-instructions',
143     '[keyword v128.load] [keyword offset]=[number 32] [keyword align]=[number 4]',
144     '[keyword i16x8.load8x8_s] [keyword offset]=[number 64] [keyword align]=[number 0]',
145     '[keyword i16x8.load8x8_u] [keyword offset]=[number 64] [keyword align]=[number 0]',
146     '[keyword i32x4.load16x4_s] [keyword offset]=[number 64] [keyword align]=[number 0]',
147     '[keyword i32x4.load16x4_u] [keyword offset]=[number 64] [keyword align]=[number 0]',
148     '[keyword i64x2.load32x2_s] [keyword offset]=[number 64] [keyword align]=[number 0]',
149     '[keyword i64x2.load32x2_u] [keyword offset]=[number 64] [keyword align]=[number 0]',
150     '[keyword v8x16.load_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
151     '[keyword v16x8.load_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
152     '[keyword v32x4.load_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
153     '[keyword v64x2.load_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
154     '[keyword v128.store] [keyword offset]=[number 32] [keyword align]=[number 4]',
155     '[keyword v128.const] [number 0] [number 1] [number 2] [number 3] [number 4] [number 5] [number 6] [number 7] [number 8] [number 9] [number 10] [number 11] [number 12] [number 13] [number 14] [number 15]',
156     '[keyword v8x16.shuffle] [number 0] [number 1] [number 2] [number 3] [number 4] [number 5] [number 6] [number 7] [number 8] [number 9] [number 10] [number 11] [number 12] [number 13] [number 14] [number 15]',
157     '[keyword v8x16.swizzle]',
158     '[keyword i8x16.splat]',
159     '[keyword i16x8.splat]',
160     '[keyword i32x4.splat]',
161     '[keyword i64x2.splat]',
162     '[keyword f32x4.splat]',
163     '[keyword f64x2.splat]',
164     '[keyword i8x16.extract_lane_s] [number 1]',
165     '[keyword i8x16.extract_lane_u] [number 1]',
166     '[keyword i8x16.replace_lane] [number 1]',
167     '[keyword i16x8.extract_lane_s] [number 1]',
168     '[keyword i16x8.extract_lane_u] [number 1]',
169     '[keyword i16x8.replace_lane] [number 1]',
170     '[keyword i32x4.extract_lane] [number 1]',
171     '[keyword i32x4.replace_lane] [number 1]',
172     '[keyword i64x2.extract_lane] [number 1]',
173     '[keyword i64x2.replace_lane] [number 1]',
174     '[keyword f32x4.extract_lane] [number 1]',
175     '[keyword f32x4.replace_lane] [number 1]',
176     '[keyword f64x2.extract_lane] [number 1]',
177     '[keyword f64x2.replace_lane] [number 1]',
178     '[keyword i8x16.eq]',
179     '[keyword i8x16.ne]',
180     '[keyword i8x16.lt_s]',
181     '[keyword i8x16.lt_u]',
182     '[keyword i8x16.gt_s]',
183     '[keyword i8x16.gt_u]',
184     '[keyword i8x16.le_s]',
185     '[keyword i8x16.le_u]',
186     '[keyword i8x16.ge_s]',
187     '[keyword i8x16.ge_u]',
188     '[keyword i16x8.eq]',
189     '[keyword i16x8.ne]',
190     '[keyword i16x8.lt_s]',
191     '[keyword i16x8.lt_u]',
192     '[keyword i16x8.gt_s]',
193     '[keyword i16x8.gt_u]',
194     '[keyword i16x8.le_s]',
195     '[keyword i16x8.le_u]',
196     '[keyword i16x8.ge_s]',
197     '[keyword i16x8.ge_u]',
198     '[keyword i32x4.eq]',
199     '[keyword i32x4.ne]',
200     '[keyword i32x4.lt_s]',
201     '[keyword i32x4.lt_u]',
202     '[keyword i32x4.gt_s]',
203     '[keyword i32x4.gt_u]',
204     '[keyword i32x4.le_s]',
205     '[keyword i32x4.le_u]',
206     '[keyword i32x4.ge_s]',
207     '[keyword i32x4.ge_u]',
208     '[keyword f32x4.eq]',
209     '[keyword f32x4.ne]',
210     '[keyword f32x4.lt]',
211     '[keyword f32x4.gt]',
212     '[keyword f32x4.le]',
213     '[keyword f32x4.ge]',
214     '[keyword f64x2.eq]',
215     '[keyword f64x2.ne]',
216     '[keyword f64x2.lt]',
217     '[keyword f64x2.gt]',
218     '[keyword f64x2.le]',
219     '[keyword f64x2.ge]',
220     '[keyword v128.not]',
221     '[keyword v128.and]',
222     '[keyword v128.andnot]',
223     '[keyword v128.or]',
224     '[keyword v128.xor]',
225     '[keyword v128.bitselect]',
226     '[keyword i8x16.abs]',
227     '[keyword i8x16.neg]',
228     '[keyword i8x16.any_true]',
229     '[keyword i8x16.all_true]',
230     '[keyword i8x16.bitmask]',
231     '[keyword i8x16.narrow_i16x8_s]',
232     '[keyword i8x16.narrow_i16x8_u]',
233     '[keyword i8x16.shl]',
234     '[keyword i8x16.shr_s]',
235     '[keyword i8x16.shr_u]',
236     '[keyword i8x16.add]',
237     '[keyword i8x16.add_saturate_s]',
238     '[keyword i8x16.add_saturate_u]',
239     '[keyword i8x16.sub]',
240     '[keyword i8x16.sub_saturate_s]',
241     '[keyword i8x16.sub_saturate_u]',
242     '[keyword i8x16.min_s]',
243     '[keyword i8x16.min_u]',
244     '[keyword i8x16.max_s]',
245     '[keyword i8x16.max_u]',
246     '[keyword i8x16.avgr_u]',
247     '[keyword i16x8.abs]',
248     '[keyword i16x8.neg]',
249     '[keyword i16x8.any_true]',
250     '[keyword i16x8.all_true]',
251     '[keyword i16x8.bitmask]',
252     '[keyword i16x8.narrow_i32x4_s]',
253     '[keyword i16x8.narrow_i32x4_u]',
254     '[keyword i16x8.widen_low_i8x16_s]',
255     '[keyword i16x8.widen_high_i8x16_s]',
256     '[keyword i16x8.widen_low_i8x16_u]',
257     '[keyword i16x8.widen_high_i8x16_u]',
258     '[keyword i16x8.shl]',
259     '[keyword i16x8.shr_s]',
260     '[keyword i16x8.shr_u]',
261     '[keyword i16x8.add]',
262     '[keyword i16x8.add_saturate_s]',
263     '[keyword i16x8.add_saturate_u]',
264     '[keyword i16x8.sub]',
265     '[keyword i16x8.sub_saturate_s]',
266     '[keyword i16x8.sub_saturate_u]',
267     '[keyword i16x8.mul]',
268     '[keyword i16x8.min_s]',
269     '[keyword i16x8.min_u]',
270     '[keyword i16x8.max_s]',
271     '[keyword i16x8.max_u]',
272     '[keyword i16x8.avgr_u]',
273     '[keyword i32x4.abs]',
274     '[keyword i32x4.neg]',
275     '[keyword i32x4.any_true]',
276     '[keyword i32x4.all_true]',
277     '[keyword i32x4.bitmask]',
278     '[keyword i32x4.widen_low_i16x8_s]',
279     '[keyword i32x4.widen_high_i16x8_s]',
280     '[keyword i32x4.widen_low_i16x8_u]',
281     '[keyword i32x4.widen_high_i16x8_u]',
282     '[keyword i32x4.shl]',
283     '[keyword i32x4.shr_s]',
284     '[keyword i32x4.shr_u]',
285     '[keyword i32x4.add]',
286     '[keyword i32x4.sub]',
287     '[keyword i32x4.mul]',
288     '[keyword i32x4.min_s]',
289     '[keyword i32x4.min_u]',
290     '[keyword i32x4.max_s]',
291     '[keyword i32x4.max_u]',
292     '[keyword i64x2.neg]',
293     '[keyword i64x2.shl]',
294     '[keyword i64x2.shr_s]',
295     '[keyword i64x2.shr_u]',
296     '[keyword i64x2.add]',
297     '[keyword i64x2.sub]',
298     '[keyword i64x2.mul]',
299     '[keyword f32x4.abs]',
300     '[keyword f32x4.neg]',
301     '[keyword f32x4.sqrt]',
302     '[keyword f32x4.add]',
303     '[keyword f32x4.sub]',
304     '[keyword f32x4.mul]',
305     '[keyword f32x4.div]',
306     '[keyword f32x4.min]',
307     '[keyword f32x4.max]',
308     '[keyword f64x2.abs]',
309     '[keyword f64x2.neg]',
310     '[keyword f64x2.sqrt]',
311     '[keyword f64x2.add]',
312     '[keyword f64x2.sub]',
313     '[keyword f64x2.mul]',
314     '[keyword f64x2.div]',
315     '[keyword f64x2.min]',
316     '[keyword f64x2.max]',
317     '[keyword i32x4.trunc_sat_f32x4_s]',
318     '[keyword i32x4.trunc_sat_f32x4_u]',
319     '[keyword f32x4.convert_i32x4_s]',
320     '[keyword f32x4.convert_i32x4_u]');
321})();