Debian Codegraph @

codemirror-lang-wast/src/wast.grammar

raw
1 @skip { whitespace | LineComment | BlockComment }
2
3 @top Module { expression* }
4
5 expression[@isGroup=Expression] {
6 App { "(" expression* ")" } |
7 Identifier |
8 Type |
9 Keyword |
10 Number |
11 String
12 }
13
14 Type {
15 @specialize<Keyword,
16 "anyref" | "dataref" | "eqref" | "externref" | "i31ref" | "funcref" |
17 "i8" | "i16" | "i32" | "i64" | "f32" | "f64"
18 >
19 }
20
21 @tokens {
22 idChar { $[0-9A-Za-z!#$%&'*+\-./:<=>?@\^_`|~] }
23
24 Keyword { $[a-z] idChar* }
25
26 Identifier { "$" idChar+ }
27
28 digit { $[0-9] }
29 digits { digit ("_"? digit)* }
30 hexDigit { $[0-9a-fA-F] }
31 hexDigits { hexDigit ("_"? hexDigit)* }
32
33 Number {
34 $[+-]? (
35 digits ("." digits?)? ($[eE] $[+-]? digits)? |
36 "0x" hexDigits ("." hexDigits?)? ($[pP] $[+-]? hexDigits)?
37 )
38 }
39
40 String[isolate] { '"' (!["\\] | "\\" _)* '"' }
41
42 LineComment[isolate] { ";;" ![\n]* }
43
44 blockCommentRest { ![;] blockCommentRest | ";" blockCommentSemi }
45 blockCommentSemi { ![);] blockCommentRest | ";" blockCommentSemi | ")" }
46 BlockComment[isolate] { "(;" blockCommentRest }
47
48 whitespace { $[ \n\r\t] }
49
50 "(" ")"
51 }
52
53 @detectDelim