5
if (typeof exports == "object" && typeof module == "object")
6
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
7
else if (typeof define == "function" && define.amd)
8
define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
11
})(function(CodeMirror) {
17
"br(_if|_table|_on_(cast|data|func|i31|null))?",
18
"call(_indirect|_ref)?",
30
"global(\\.(get|set))?",
33
"local(\\.(get|set|tee))?",
42
"return(_call(_indirect|_ref)?)?",
45
"table(\\.(size|get|set|size|grow|fill|init|copy))?",
54
"i(32|64)\\.(store(8|16)|(load(8|16)_[su]))",
55
"i64\\.(load32_[su]|store32)",
56
"[fi](32|64)\\.(const|load|store)",
57
"f(32|64)\\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)",
58
"i(32|64)\\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)",
59
"i64\\.extend_[su]_i32",
61
"i(32|64)\\.trunc_f(32|64)_[su]",
62
"f(32|64)\\.convert_i(32|64)_[su]",
65
"f32\\.reinterpret_i32",
66
"i32\\.reinterpret_f32",
67
"f64\\.reinterpret_i64",
68
"i64\\.reinterpret_f64",
70
"memory(\\.((atomic\\.(notify|wait(32|64)))|grow|size))?",
71
"i64\.atomic\\.(load32_u|store32|rmw32\\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)",
72
"i(32|64)\\.atomic\\.(load((8|16)_u)?|store(8|16)?|rmw(\\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))",
74
"v128\\.load(8x8|16x4|32x2)_[su]",
75
"v128\\.load(8|16|32|64)_splat",
76
"v128\\.(load|store)(8|16|32|64)_lane",
77
"v128\\.load(32|64)_zero",
78
"v128\.(load|store|const|not|andnot|and|or|xor|bitselect|any_true)",
79
"i(8x16|16x8)\\.(extract_lane_[su]|(add|sub)_sat_[su]|avgr_u)",
80
"i(8x16|16x8|32x4|64x2)\\.(neg|add|sub|abs|shl|shr_[su]|all_true|bitmask|eq|ne|[lg][te]_s)",
81
"(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane)",
82
"i(8x16|16x8|32x4)\\.(([lg][te]_u)|((min|max)_[su]))",
83
"f(32x4|64x2)\\.(neg|add|sub|abs|nearest|eq|ne|[lg][te]|sqrt|mul|div|min|max|ceil|floor|trunc)",
84
"[fi](32x4|64x2)\\.extract_lane",
85
"i8x16\\.(shuffle|swizzle|popcnt|narrow_i16x8_[su])",
86
"i16x8\\.(narrow_i32x4_[su]|mul|extadd_pairwise_i8x16_[su]|q15mulr_sat_s)",
87
"i16x8\\.(extend|extmul)_(low|high)_i8x16_[su]",
88
"i32x4\\.(mul|dot_i16x8_s|trunc_sat_f64x2_[su]_zero)",
89
"i32x4\\.((extend|extmul)_(low|high)_i16x8_|trunc_sat_f32x4_|extadd_pairwise_i16x8_)[su]",
90
"i64x2\\.(mul|(extend|extmul)_(low|high)_i32x4_[su])",
91
"f32x4\\.(convert_i32x4_[su]|demote_f64x2_zero)",
92
"f64x2\\.(promote_low_f32x4|convert_low_i32x4_[su])",
96
"(array|struct)(\\.(new_(default_)?with_rtt|get(_[su])?|set))?",
99
"i31\\.(new|get_[su])",
101
"ref(\\.(([ai]s_(data|func|i31))|cast|eq|func|(is_|as_non_)?null|test))?",
102
"rtt(\\.(canon|sub))?",
105
CodeMirror.defineSimpleMode('wast', {
107
{regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"},
108
{regex: new RegExp(kKeywords.join('|')), token: "keyword"},
109
{regex: /\b((any|data|eq|extern|i31|func)ref|[fi](32|64)|i(8|16))\b/, token: "atom"},
110
{regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"},
111
{regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"},
112
{regex: /\(;.*?/, token: "comment", next: "comment"},
113
{regex: /;;.*$/, token: "comment"},
114
{regex: /\(/, indent: true},
115
{regex: /\)/, dedent: true},
119
{regex: /.*?;\)/, token: "comment", next: "start"},
120
{regex: /.*/, token: "comment"},
124
dontIndentStates: ['comment'],
130
CodeMirror.defineMIME("text/webassembly", "wast");