-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiddlywiki.grammar
44 lines (38 loc) · 1.23 KB
/
tiddlywiki.grammar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@top Document { expression* }
@skip { space }
expression {
Identifier |
Heading |
Strikethrough |
Bold |
Underscore |
Italic |
List |
Blockquote |
LineComment |
Definition |
Keyword |
Macro |
Image
}
@tokens {
Identifier { "@@" ![\n]* "@@" }
Heading { ($[!]+) @whitespace ![\n]* }
Strikethrough { "~~" ![\n]* "~~"}
Bold { "''" ![\n]* "''"}
Underscore { "__" ![\n]* "__"}
Italic { "//" ![\n]* "//"}
List { $[#]+ ![\n]* }
Blockquote { ">" @whitespace }
LineComment { "<!--" ![\n]* "-->" }
Definition { $[;] ![\n]* }
Keyword { "<$list " | "</$list>" | '<$set ' | "</$set>" | "<$vars " | "</$vars>" | "<$link>" | "<$text " | "filter=" | "<% " ![\n]* "%>" | "<% " ("else" | "elseif" | "endif") @whitespace "%>" | "<$list-template>" | "<$list-empty>" | "</$list-template>" | "</$list-empty>" }
Macro { ("<<" ![\n]* ">>") }
Image { ("[img " |"[img[" | "[[" | "{{" | "{{{" ) ![\n]* ("]]" | "}}" | "}}}") }
space { $[ \t\n\r]+ }
}
// https://lezer.codemirror.net/docs/guide/#writing-a-grammar
// https://github.com/lezer-parser/javascript/blob/main/src/javascript.grammar
// @external propSource jsHighlight from "./highlight"
@detectDelim
@external propSource tiddlywikiHighlighting from "./highlight"