1+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3+
4+ ( function ( mod ) {
5+ if ( typeof exports == "object" && typeof module == "object" ) // CommonJS
6+ mod ( require ( "../../lib/codemirror" ) , require ( "../../addon/mode/simple" ) ) ;
7+ else if ( typeof define == "function" && define . amd ) // AMD
8+ define ( [ "../../lib/codemirror" , "../../addon/mode/simple" ] , mod ) ;
9+ else // Plain browser env
10+ mod ( CodeMirror ) ;
11+ } ) ( function ( CodeMirror ) {
12+ "use strict" ;
13+
14+ CodeMirror . defineSimpleMode ( 'wast' , {
15+ start : [
16+ { regex : / [ + \- ] ? (?: n a n (?: : 0 x [ 0 - 9 a - f A - F ] + ) ? | i n f i n i t y | i n f | 0 x [ 0 - 9 a - f A - F ] + \. ? [ 0 - 9 a - f A - F ] * p [ + \/ - ] ? \d + | \d + (?: \. \d * ) ? [ e E ] [ + \- ] ? \d * | \d + \. \d * | 0 x [ 0 - 9 a - f A - F ] + | \d + ) / , token : "number" } ,
17+ { regex : / a n y f u n c | m u t | n o p | b l o c k | i f | t h e n | e l s e | l o o p | b r | b r _ i f | b r _ t a b l e | c a l l | c a l l _ i n d i r e c t | d r o p | e n d | r e t u r n | l o c a l \. g e t | l o c a l \. s e t | t e e _ l o c a l | g l o b a l \. g e t | g l o b a l \. s e t | i 3 2 \. l o a d | i 6 4 \. l o a d | f 3 2 \. l o a d | f 6 4 \. l o a d | i 3 2 \. s t o r e | i 6 4 \. s t o r e | f 3 2 \. s t o r e | f 6 4 \. s t o r e | i 3 2 \. l o a d 8 _ s | i 6 4 \. l o a d 8 _ s | i 3 2 \. l o a d 8 _ u | i 6 4 \. l o a d 8 _ u | i 3 2 \. l o a d 1 6 _ s | i 6 4 \. l o a d 1 6 _ s | i 3 2 \. l o a d 1 6 _ u | i 6 4 \. l o a d 1 6 _ u | i 6 4 \. l o a d 3 2 _ s | i 6 4 \. l o a d 3 2 _ u | i 3 2 \. s t o r e 8 | i 6 4 \. s t o r e 8 | i 3 2 \. s t o r e 1 6 | i 6 4 \. s t o r e 1 6 | i 3 2 \. c o n s t | i 6 4 \. c o n s t | f 3 2 \. c o n s t | f 6 4 \. c o n s t | i 3 2 \. e q z | i 6 4 \. e q z | i 3 2 \. c l z | i 6 4 \. c l z | i 3 2 \. c t z | i 6 4 \. c t z | i 3 2 \. p o p c n t | i 6 4 \. p o p c n t | f 3 2 \. n e g | f 6 4 \. n e g | f 3 2 \. a b s | f 6 4 \. a b s | f 3 2 \. s q r t | f 6 4 \. s q r t | f 3 2 \. c e i l | f 6 4 \. c e i l | f 3 2 \. f l o o r | f 6 4 \. f l o o r | f 3 2 \. t r u n c | f 6 4 \. t r u n c | f 3 2 \. n e a r e s t | f 6 4 \. n e a r e s t | i 3 2 \. a d d | i 6 4 \. a d d | i 3 2 \. s u b | i 6 4 \. s u b | i 3 2 \. m u l | i 6 4 \. m u l | i 3 2 \. d i v _ s | i 6 4 \. d i v _ s | i 3 2 \. d i v _ u | i 6 4 \. d i v _ u | i 3 2 \. r e m _ s | i 6 4 \. r e m _ s | i 3 2 \. r e m _ u | i 6 4 \. r e m _ u | i 3 2 \. a n d | i 6 4 \. a n d | i 3 2 \. o r | i 6 4 \. o r | i 3 2 \. x o r | i 6 4 \. x o r | i 3 2 \. s h l | i 6 4 \. s h l | i 3 2 \. s h r _ s | i 6 4 \. s h r _ s | i 3 2 \. s h r _ u | i 6 4 \. s h r _ u | i 3 2 \. r o t l | i 6 4 \. r o t l | i 3 2 \. r o t r | i 6 4 \. r o t r | f 3 2 \. a d d | f 6 4 \. a d d | f 3 2 \. s u b | f 6 4 \. s u b | f 3 2 \. m u l | f 6 4 \. m u l | f 3 2 \. d i v | f 6 4 \. d i v | f 3 2 \. m i n | f 6 4 \. m i n | f 3 2 \. m a x | f 6 4 \. m a x | f 3 2 \. c o p y s i g n | f 6 4 \. c o p y s i g n | i 3 2 \. e q | i 6 4 \. e q | i 3 2 \. n e | i 6 4 \. n e | i 3 2 \. l t _ s | i 6 4 \. l t _ s | i 3 2 \. l t _ u | i 6 4 \. l t _ u | i 3 2 \. l e _ s | i 6 4 \. l e _ s | i 3 2 \. l e _ u | i 6 4 \. l e _ u | i 3 2 \. g t _ s | i 6 4 \. g t _ s | i 3 2 \. g t _ u | i 6 4 \. g t _ u | i 3 2 \. g e _ s | i 6 4 \. g e _ s | i 3 2 \. g e _ u | i 6 4 \. g e _ u | f 3 2 \. e q | f 6 4 \. e q | f 3 2 \. n e | f 6 4 \. n e | f 3 2 \. l t | f 6 4 \. l t | f 3 2 \. l e | f 6 4 \. l e | f 3 2 \. g t | f 6 4 \. g t | f 3 2 \. g e | f 6 4 \. g e | i 6 4 \. e x t e n d _ s \/ i 3 2 | i 6 4 \. e x t e n d _ u \/ i 3 2 | i 3 2 \. w r a p \/ i 6 4 | i 3 2 \. t r u n c _ s \/ f 3 2 | i 6 4 \. t r u n c _ s \/ f 3 2 | i 3 2 \. t r u n c _ s \/ f 6 4 | i 6 4 \. t r u n c _ s \/ f 6 4 | i 3 2 \. t r u n c _ u \/ f 3 2 | i 6 4 \. t r u n c _ u \/ f 3 2 | i 3 2 \. t r u n c _ u \/ f 6 4 | i 6 4 \. t r u n c _ u \/ f 6 4 | f 3 2 \. c o n v e r t _ s \/ i 3 2 | f 6 4 \. c o n v e r t _ s \/ i 3 2 | f 3 2 \. c o n v e r t _ s \/ i 6 4 | f 6 4 \. c o n v e r t _ s \/ i 6 4 | f 3 2 \. c o n v e r t _ u \/ i 3 2 | f 6 4 \. c o n v e r t _ u \/ i 3 2 | f 3 2 \. c o n v e r t _ u \/ i 6 4 | f 6 4 \. c o n v e r t _ u \/ i 6 4 | f 6 4 \. p r o m o t e \/ f 3 2 | f 3 2 \. d e m o t e \/ f 6 4 | f 3 2 \. r e i n t e r p r e t \/ i 3 2 | i 3 2 \. r e i n t e r p r e t \/ f 3 2 | f 6 4 \. r e i n t e r p r e t \/ i 6 4 | i 6 4 \. r e i n t e r p r e t \/ f 6 4 | s e l e c t | u n r e a c h a b l e | c u r r e n t _ m e m o r y | m e m o r y .s i z e | g r o w _ m e m o r y | m e m o r y .g r o w | t y p e | f u n c | p a r a m | r e s u l t | l o c a l | g l o b a l | m o d u l e | t a b l e | m e m o r y | s t a r t | e l e m | d a t a | o f f s e t | i m p o r t | e x p o r t / , token : "keyword" } ,
18+ { regex : / \b ( i 3 2 | i 6 4 | f 3 2 | f 6 4 ) \b / , token : "atom" } ,
19+ { regex : / \$ ( [ a - z A - Z 0 - 9 _ ` \+ \- \* \/ \\ \^ ~ = < > ! \? @ # $ % & | : \. ] + ) / , token : "variable-2" } ,
20+ { regex : / " (?: [ ^ " \\ \x00 - \x1f \x7f ] | \\ [ n t \\ ' " ] | \\ [ 0 - 9 a - f A - F ] [ 0 - 9 a - f A - F ] ) * " / , token : "string" } ,
21+ { regex : / \( ; .* ?/ , token : "comment" , next : "comment" } ,
22+ { regex : / ; ; .* $ / , token : "comment" } ,
23+ { regex : / \( / , indent : true } ,
24+ { regex : / \) / , dedent : true } ,
25+ ] ,
26+
27+ comment : [
28+ { regex : / .* ?; \) / , token : "comment" , next : "start" } ,
29+ { regex : / .* / , token : "comment" } ,
30+ ] ,
31+
32+ meta : {
33+ dontIndentStates : [ 'comment' ] ,
34+ } ,
35+ } ) ;
36+
37+ // https://github.com/WebAssembly/design/issues/981 mentions text/webassembly,
38+ // which seems like a reasonable choice, although it's not standard right now.
39+ CodeMirror . defineMIME ( "text/webassembly" , "wast" ) ;
40+
41+ } ) ;
0 commit comments