buninu 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/apps/jsgotty/README.en.md +4 -0
- package/apps/jsgotty/README.md +4 -0
- package/apps/jsgotty/package-lock.json +2 -2
- package/apps/jsgotty/package.json +1 -1
- package/apps/jsgotty/static/css/index.css +7 -0
- package/apps/jsgotty/static/js/gotty.js +12 -4
- package/apps/jsgotty/static/js/kitty.js +115 -7
- package/apps/jsgotty/tests/manual/zoom-collector.cjs +55 -0
- package/apps/jsgotty/tests/manual/zoom-debug.js +39 -0
- package/apps/jsgotty/tests/touch-drag-browser.test.js +106 -0
- package/apps/jsgotty/tests/wheel-browser.test.js +60 -0
- package/apps/jsmdcui/CHANGELOG.md +44 -0
- package/apps/jsmdcui/package.json +1 -1
- package/apps/jsmdcui/src/highlight/go-regexp.js +83 -0
- package/apps/jsmdcui/src/highlight/highlighter.js +49 -62
- package/apps/jsmdcui/src/highlight/parser.js +8 -5
- package/apps/jsmdcui/tests/go-regexp.test.js +98 -0
- package/apps/jsmdcui/tests/heading-ids.test.js +21 -16
- package/apps/jsmdcui/tests/highlight-regions.test.js +73 -0
- package/apps/jsmdcui/tests/id-collision.test.js +32 -9
- package/apps/jsmdcui/tests/markdown-behavior.mjs +9 -0
- package/apps/jsmdcui/tests/syntax-parity/NORMAL-HTML.md +46 -0
- package/apps/jsmdcui/tests/syntax-parity/README.md +85 -0
- package/apps/jsmdcui/tests/syntax-parity/REPORT.md +328 -0
- package/apps/jsmdcui/tests/syntax-parity/compare.mjs +75 -0
- package/apps/jsmdcui/tests/syntax-parity/go.mod +5 -0
- package/apps/jsmdcui/tests/syntax-parity/normal-html-report.json +619 -0
- package/apps/jsmdcui/tests/syntax-parity/normal-html.html +9 -0
- package/apps/jsmdcui/tests/syntax-parity/oracle.go +49 -0
- package/apps/jsmdcui/tests/syntax-parity/report.json +2174 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/PowerShell.txt +39 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/ada.txt +25 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/apacheconf.txt +49 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/arduino.txt +38 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/asciidoc.txt +33 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/asm.txt +77 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/ats.txt +48 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/awk.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/b.txt +27 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/bat.txt +39 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/c.txt +34 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/caddyfile.txt +14 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/cake.txt +7 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/clojure.txt +18 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/cmake.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/coffeescript.txt +32 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/colortest.txt +19 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/conky.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/cpp.txt +46 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/crontab.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/crystal.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/csharp.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/css.txt +19 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/csx.txt +7 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/cuda.txt +37 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/cython.txt +22 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/d.txt +52 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/dart.txt +27 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/default.txt +8 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/dockerfile.txt +10 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/dot.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/elixir.txt +23 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/elm.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/erb.txt +32 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/erlang.txt +23 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/fish.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/forth.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/fortran.txt +40 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/freebsd-kernel.txt +10 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/fsharp.txt +27 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gdscript.txt +26 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gemini.txt +11 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gentoo-ebuild.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gentoo-etc-portage.txt +14 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/git-commit.txt +19 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/git-config.txt +11 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/git-rebase-todo.txt +10 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gleam.txt +44 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/glsl.txt +18 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gnuplot.txt +11 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/go.txt +33 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/godoc.txt +9 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/golo.txt +50 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/gomod.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/graphql.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/groff.txt +18 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/groovy.txt +42 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/haml.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/hare.txt +31 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/haskell.txt +26 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/hc.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/html.txt +26 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/html4.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/html5.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/ini.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/inputrc.txt +14 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/java.txt +18 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/javascript.txt +41 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/jinja2.txt +13 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/json.txt +21 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/jsonnet.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/julia.txt +24 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/justfile.txt +26 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/keymap.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/kickstart.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/kotlin.txt +30 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/kvlang.txt +37 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/ledger.txt +13 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/lfe.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/lilypond.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/lisp.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/log.txt +45 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/lua.txt +48 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/mail.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/makefile.txt +25 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/man.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/markdown.txt +21 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/mc.txt +11 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/meson.txt +29 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/micro.txt +25 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/mpdconf.txt +13 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/msbuild.txt +7 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/nanorc.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/nftables.txt +22 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/nginx.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/nim.txt +23 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/nix.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/nu.txt +92 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/objc.txt +36 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/ocaml.txt +25 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/octave.txt +35 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/odin.txt +35 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/pascal.txt +22 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/patch.txt +13 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/peg.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/perl.txt +27 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/php.txt +44 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/pkg-config.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/po.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/pony.txt +29 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/pov.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/privoxy-action.txt +14 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/privoxy-config.txt +10 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/privoxy-filter.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/proto.txt +22 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/prql.txt +42 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/puppet.txt +22 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/python2.txt +24 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/python3.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/r.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/raku.txt +19 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/reST.txt +18 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/renpy.txt +11 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/rpmspec.txt +31 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/ruby.txt +34 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/rust.txt +27 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/sage.txt +24 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/scad.txt +23 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/scala.txt +16 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/sed.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/sh.txt +20 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/sls.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/smalltalk.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/solidity.txt +26 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/sql.txt +35 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/stata.txt +32 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/svelte.txt +10 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/swift.txt +53 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/systemd.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/tcl.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/terraform.txt +28 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/tex.txt +15 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/toml.txt +31 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/twig.txt +29 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/typescript.txt +32 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/v.txt +47 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/vala.txt +22 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/verilog.txt +37 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/vhdl.txt +37 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/vi.txt +17 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/vue.txt +29 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/xml.txt +14 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/xresources.txt +14 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/yaml.txt +19 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/yum.txt +12 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/zig.txt +24 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/zscript.txt +31 -0
- package/apps/jsmdcui/tests/syntax-parity/samples/zsh.txt +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "simple",
|
|
4
|
+
"syntax": "html.yaml",
|
|
5
|
+
"diffs": 6,
|
|
6
|
+
"extraStringChars": 0,
|
|
7
|
+
"first": [
|
|
8
|
+
{
|
|
9
|
+
"line": 1,
|
|
10
|
+
"column": 6,
|
|
11
|
+
"micro": "symbol.tag",
|
|
12
|
+
"jmi": "identifier",
|
|
13
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"line": 1,
|
|
17
|
+
"column": 7,
|
|
18
|
+
"micro": "symbol.tag",
|
|
19
|
+
"jmi": "identifier",
|
|
20
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"line": 1,
|
|
24
|
+
"column": 8,
|
|
25
|
+
"micro": "symbol.tag",
|
|
26
|
+
"jmi": "identifier",
|
|
27
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"line": 1,
|
|
31
|
+
"column": 9,
|
|
32
|
+
"micro": "symbol.tag",
|
|
33
|
+
"jmi": "identifier",
|
|
34
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"line": 1,
|
|
38
|
+
"column": 10,
|
|
39
|
+
"micro": "symbol.tag",
|
|
40
|
+
"jmi": "identifier",
|
|
41
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"line": 1,
|
|
45
|
+
"column": 11,
|
|
46
|
+
"micro": "symbol.tag",
|
|
47
|
+
"jmi": "symbol",
|
|
48
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "simple",
|
|
54
|
+
"syntax": "html5.yaml",
|
|
55
|
+
"diffs": 9,
|
|
56
|
+
"extraStringChars": 0,
|
|
57
|
+
"first": [
|
|
58
|
+
{
|
|
59
|
+
"line": 1,
|
|
60
|
+
"column": 2,
|
|
61
|
+
"micro": "default",
|
|
62
|
+
"jmi": "symbol.tag.extended",
|
|
63
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"line": 1,
|
|
67
|
+
"column": 3,
|
|
68
|
+
"micro": "default",
|
|
69
|
+
"jmi": "symbol.tag.extended",
|
|
70
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"line": 1,
|
|
74
|
+
"column": 4,
|
|
75
|
+
"micro": "default",
|
|
76
|
+
"jmi": "symbol.tag.extended",
|
|
77
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"line": 1,
|
|
81
|
+
"column": 5,
|
|
82
|
+
"micro": "default",
|
|
83
|
+
"jmi": "symbol.tag.extended",
|
|
84
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"line": 1,
|
|
88
|
+
"column": 6,
|
|
89
|
+
"micro": "default",
|
|
90
|
+
"jmi": "symbol.tag.extended",
|
|
91
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"line": 1,
|
|
95
|
+
"column": 7,
|
|
96
|
+
"micro": "default",
|
|
97
|
+
"jmi": "symbol.tag.extended",
|
|
98
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"line": 1,
|
|
102
|
+
"column": 8,
|
|
103
|
+
"micro": "default",
|
|
104
|
+
"jmi": "symbol.tag.extended",
|
|
105
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"line": 1,
|
|
109
|
+
"column": 9,
|
|
110
|
+
"micro": "default",
|
|
111
|
+
"jmi": "symbol.tag.extended",
|
|
112
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"line": 1,
|
|
116
|
+
"column": 10,
|
|
117
|
+
"micro": "default",
|
|
118
|
+
"jmi": "symbol.tag.extended",
|
|
119
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "simple",
|
|
125
|
+
"syntax": "html4.yaml",
|
|
126
|
+
"diffs": 9,
|
|
127
|
+
"extraStringChars": 0,
|
|
128
|
+
"first": [
|
|
129
|
+
{
|
|
130
|
+
"line": 1,
|
|
131
|
+
"column": 2,
|
|
132
|
+
"micro": "default",
|
|
133
|
+
"jmi": "symbol.tag.extended",
|
|
134
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"line": 1,
|
|
138
|
+
"column": 3,
|
|
139
|
+
"micro": "default",
|
|
140
|
+
"jmi": "symbol.tag.extended",
|
|
141
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"line": 1,
|
|
145
|
+
"column": 4,
|
|
146
|
+
"micro": "default",
|
|
147
|
+
"jmi": "symbol.tag.extended",
|
|
148
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"line": 1,
|
|
152
|
+
"column": 5,
|
|
153
|
+
"micro": "default",
|
|
154
|
+
"jmi": "symbol.tag.extended",
|
|
155
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"line": 1,
|
|
159
|
+
"column": 6,
|
|
160
|
+
"micro": "default",
|
|
161
|
+
"jmi": "symbol.tag.extended",
|
|
162
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"line": 1,
|
|
166
|
+
"column": 7,
|
|
167
|
+
"micro": "default",
|
|
168
|
+
"jmi": "symbol.tag.extended",
|
|
169
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"line": 1,
|
|
173
|
+
"column": 8,
|
|
174
|
+
"micro": "default",
|
|
175
|
+
"jmi": "symbol.tag.extended",
|
|
176
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"line": 1,
|
|
180
|
+
"column": 9,
|
|
181
|
+
"micro": "default",
|
|
182
|
+
"jmi": "symbol.tag.extended",
|
|
183
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"line": 1,
|
|
187
|
+
"column": 10,
|
|
188
|
+
"micro": "default",
|
|
189
|
+
"jmi": "symbol.tag.extended",
|
|
190
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "twoAttributes",
|
|
196
|
+
"syntax": "html.yaml",
|
|
197
|
+
"diffs": 11,
|
|
198
|
+
"extraStringChars": 0,
|
|
199
|
+
"first": [
|
|
200
|
+
{
|
|
201
|
+
"line": 1,
|
|
202
|
+
"column": 4,
|
|
203
|
+
"micro": "symbol.tag",
|
|
204
|
+
"jmi": "identifier",
|
|
205
|
+
"context": "<a href=\"https://example.com\" class=\"l"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"line": 1,
|
|
209
|
+
"column": 5,
|
|
210
|
+
"micro": "symbol.tag",
|
|
211
|
+
"jmi": "identifier",
|
|
212
|
+
"context": "<a href=\"https://example.com\" class=\"li"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"line": 1,
|
|
216
|
+
"column": 6,
|
|
217
|
+
"micro": "symbol.tag",
|
|
218
|
+
"jmi": "identifier",
|
|
219
|
+
"context": "<a href=\"https://example.com\" class=\"lin"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"line": 1,
|
|
223
|
+
"column": 7,
|
|
224
|
+
"micro": "symbol.tag",
|
|
225
|
+
"jmi": "identifier",
|
|
226
|
+
"context": "<a href=\"https://example.com\" class=\"link"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"line": 1,
|
|
230
|
+
"column": 8,
|
|
231
|
+
"micro": "symbol.tag",
|
|
232
|
+
"jmi": "symbol",
|
|
233
|
+
"context": "<a href=\"https://example.com\" class=\"link\""
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"line": 1,
|
|
237
|
+
"column": 31,
|
|
238
|
+
"micro": "symbol.tag",
|
|
239
|
+
"jmi": "identifier",
|
|
240
|
+
"context": "ttps://example.com\" class=\"link\">Example</a>"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"line": 1,
|
|
244
|
+
"column": 32,
|
|
245
|
+
"micro": "symbol.tag",
|
|
246
|
+
"jmi": "identifier",
|
|
247
|
+
"context": "tps://example.com\" class=\"link\">Example</a>"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"line": 1,
|
|
251
|
+
"column": 33,
|
|
252
|
+
"micro": "symbol.tag",
|
|
253
|
+
"jmi": "identifier",
|
|
254
|
+
"context": "ps://example.com\" class=\"link\">Example</a>"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"line": 1,
|
|
258
|
+
"column": 34,
|
|
259
|
+
"micro": "symbol.tag",
|
|
260
|
+
"jmi": "identifier",
|
|
261
|
+
"context": "s://example.com\" class=\"link\">Example</a>"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"line": 1,
|
|
265
|
+
"column": 35,
|
|
266
|
+
"micro": "symbol.tag",
|
|
267
|
+
"jmi": "identifier",
|
|
268
|
+
"context": "://example.com\" class=\"link\">Example</a>"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"line": 1,
|
|
272
|
+
"column": 36,
|
|
273
|
+
"micro": "symbol.tag",
|
|
274
|
+
"jmi": "symbol",
|
|
275
|
+
"context": "//example.com\" class=\"link\">Example</a>"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "twoAttributes",
|
|
281
|
+
"syntax": "html5.yaml",
|
|
282
|
+
"diffs": 8,
|
|
283
|
+
"extraStringChars": 0,
|
|
284
|
+
"first": [
|
|
285
|
+
{
|
|
286
|
+
"line": 1,
|
|
287
|
+
"column": 2,
|
|
288
|
+
"micro": "default",
|
|
289
|
+
"jmi": "symbol.tag",
|
|
290
|
+
"context": "<a href=\"https://example.com\" class="
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"line": 1,
|
|
294
|
+
"column": 3,
|
|
295
|
+
"micro": "default",
|
|
296
|
+
"jmi": "symbol.tag",
|
|
297
|
+
"context": "<a href=\"https://example.com\" class=\""
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"line": 1,
|
|
301
|
+
"column": 30,
|
|
302
|
+
"micro": "default",
|
|
303
|
+
"jmi": "symbol.tag",
|
|
304
|
+
"context": "https://example.com\" class=\"link\">Example</a>"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"line": 1,
|
|
308
|
+
"column": 31,
|
|
309
|
+
"micro": "default",
|
|
310
|
+
"jmi": "symbol.tag",
|
|
311
|
+
"context": "ttps://example.com\" class=\"link\">Example</a>"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"line": 1,
|
|
315
|
+
"column": 32,
|
|
316
|
+
"micro": "default",
|
|
317
|
+
"jmi": "symbol.tag",
|
|
318
|
+
"context": "tps://example.com\" class=\"link\">Example</a>"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"line": 1,
|
|
322
|
+
"column": 33,
|
|
323
|
+
"micro": "default",
|
|
324
|
+
"jmi": "symbol.tag",
|
|
325
|
+
"context": "ps://example.com\" class=\"link\">Example</a>"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"line": 1,
|
|
329
|
+
"column": 34,
|
|
330
|
+
"micro": "default",
|
|
331
|
+
"jmi": "symbol.tag",
|
|
332
|
+
"context": "s://example.com\" class=\"link\">Example</a>"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"line": 1,
|
|
336
|
+
"column": 35,
|
|
337
|
+
"micro": "default",
|
|
338
|
+
"jmi": "symbol.tag",
|
|
339
|
+
"context": "://example.com\" class=\"link\">Example</a>"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"name": "twoAttributes",
|
|
345
|
+
"syntax": "html4.yaml",
|
|
346
|
+
"diffs": 8,
|
|
347
|
+
"extraStringChars": 0,
|
|
348
|
+
"first": [
|
|
349
|
+
{
|
|
350
|
+
"line": 1,
|
|
351
|
+
"column": 2,
|
|
352
|
+
"micro": "default",
|
|
353
|
+
"jmi": "symbol.tag",
|
|
354
|
+
"context": "<a href=\"https://example.com\" class="
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"line": 1,
|
|
358
|
+
"column": 3,
|
|
359
|
+
"micro": "default",
|
|
360
|
+
"jmi": "symbol.tag",
|
|
361
|
+
"context": "<a href=\"https://example.com\" class=\""
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"line": 1,
|
|
365
|
+
"column": 30,
|
|
366
|
+
"micro": "default",
|
|
367
|
+
"jmi": "symbol.tag",
|
|
368
|
+
"context": "https://example.com\" class=\"link\">Example</a>"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"line": 1,
|
|
372
|
+
"column": 31,
|
|
373
|
+
"micro": "default",
|
|
374
|
+
"jmi": "symbol.tag",
|
|
375
|
+
"context": "ttps://example.com\" class=\"link\">Example</a>"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"line": 1,
|
|
379
|
+
"column": 32,
|
|
380
|
+
"micro": "default",
|
|
381
|
+
"jmi": "symbol.tag",
|
|
382
|
+
"context": "tps://example.com\" class=\"link\">Example</a>"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"line": 1,
|
|
386
|
+
"column": 33,
|
|
387
|
+
"micro": "default",
|
|
388
|
+
"jmi": "symbol.tag",
|
|
389
|
+
"context": "ps://example.com\" class=\"link\">Example</a>"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"line": 1,
|
|
393
|
+
"column": 34,
|
|
394
|
+
"micro": "default",
|
|
395
|
+
"jmi": "symbol.tag",
|
|
396
|
+
"context": "s://example.com\" class=\"link\">Example</a>"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"line": 1,
|
|
400
|
+
"column": 35,
|
|
401
|
+
"micro": "default",
|
|
402
|
+
"jmi": "symbol.tag",
|
|
403
|
+
"context": "://example.com\" class=\"link\">Example</a>"
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"name": "document",
|
|
409
|
+
"syntax": "html.yaml",
|
|
410
|
+
"diffs": 14,
|
|
411
|
+
"extraStringChars": 0,
|
|
412
|
+
"first": [
|
|
413
|
+
{
|
|
414
|
+
"line": 3,
|
|
415
|
+
"column": 13,
|
|
416
|
+
"micro": "symbol.tag",
|
|
417
|
+
"jmi": "identifier",
|
|
418
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title>"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"line": 3,
|
|
422
|
+
"column": 14,
|
|
423
|
+
"micro": "symbol.tag",
|
|
424
|
+
"jmi": "identifier",
|
|
425
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title><"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"line": 3,
|
|
429
|
+
"column": 15,
|
|
430
|
+
"micro": "symbol.tag",
|
|
431
|
+
"jmi": "identifier",
|
|
432
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title></"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"line": 3,
|
|
436
|
+
"column": 16,
|
|
437
|
+
"micro": "symbol.tag",
|
|
438
|
+
"jmi": "identifier",
|
|
439
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title></h"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"line": 3,
|
|
443
|
+
"column": 17,
|
|
444
|
+
"micro": "symbol.tag",
|
|
445
|
+
"jmi": "identifier",
|
|
446
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title></he"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"line": 3,
|
|
450
|
+
"column": 18,
|
|
451
|
+
"micro": "symbol.tag",
|
|
452
|
+
"jmi": "identifier",
|
|
453
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title></hea"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"line": 3,
|
|
457
|
+
"column": 19,
|
|
458
|
+
"micro": "symbol.tag",
|
|
459
|
+
"jmi": "identifier",
|
|
460
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title></head"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"line": 3,
|
|
464
|
+
"column": 20,
|
|
465
|
+
"micro": "symbol.tag",
|
|
466
|
+
"jmi": "symbol",
|
|
467
|
+
"context": "<head><meta charset=\"utf-8\"><title>Test</title></head>"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"line": 5,
|
|
471
|
+
"column": 6,
|
|
472
|
+
"micro": "symbol.tag",
|
|
473
|
+
"jmi": "identifier",
|
|
474
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"line": 5,
|
|
478
|
+
"column": 7,
|
|
479
|
+
"micro": "symbol.tag",
|
|
480
|
+
"jmi": "identifier",
|
|
481
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"line": 5,
|
|
485
|
+
"column": 8,
|
|
486
|
+
"micro": "symbol.tag",
|
|
487
|
+
"jmi": "identifier",
|
|
488
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"line": 5,
|
|
492
|
+
"column": 9,
|
|
493
|
+
"micro": "symbol.tag",
|
|
494
|
+
"jmi": "identifier",
|
|
495
|
+
"context": "<div class=\"hello\">Hello</div>"
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "document",
|
|
501
|
+
"syntax": "html5.yaml",
|
|
502
|
+
"diffs": 0,
|
|
503
|
+
"extraStringChars": 0,
|
|
504
|
+
"first": []
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"name": "document",
|
|
508
|
+
"syntax": "html4.yaml",
|
|
509
|
+
"diffs": 0,
|
|
510
|
+
"extraStringChars": 0,
|
|
511
|
+
"first": []
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"name": "comparison",
|
|
515
|
+
"syntax": "html.yaml",
|
|
516
|
+
"diffs": 91819,
|
|
517
|
+
"extraStringChars": 4240,
|
|
518
|
+
"first": [
|
|
519
|
+
{
|
|
520
|
+
"line": 1,
|
|
521
|
+
"column": 22,
|
|
522
|
+
"micro": "symbol.tag",
|
|
523
|
+
"jmi": "identifier",
|
|
524
|
+
"context": "!doctype html><meta charset=\"utf-8\"><title>micro / jmi "
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"line": 1,
|
|
528
|
+
"column": 23,
|
|
529
|
+
"micro": "symbol.tag",
|
|
530
|
+
"jmi": "identifier",
|
|
531
|
+
"context": "doctype html><meta charset=\"utf-8\"><title>micro / jmi s"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"line": 1,
|
|
535
|
+
"column": 24,
|
|
536
|
+
"micro": "symbol.tag",
|
|
537
|
+
"jmi": "identifier",
|
|
538
|
+
"context": "octype html><meta charset=\"utf-8\"><title>micro / jmi sy"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"line": 1,
|
|
542
|
+
"column": 25,
|
|
543
|
+
"micro": "symbol.tag",
|
|
544
|
+
"jmi": "identifier",
|
|
545
|
+
"context": "ctype html><meta charset=\"utf-8\"><title>micro / jmi syn"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"line": 1,
|
|
549
|
+
"column": 26,
|
|
550
|
+
"micro": "symbol.tag",
|
|
551
|
+
"jmi": "identifier",
|
|
552
|
+
"context": "type html><meta charset=\"utf-8\"><title>micro / jmi synt"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"line": 1,
|
|
556
|
+
"column": 27,
|
|
557
|
+
"micro": "symbol.tag",
|
|
558
|
+
"jmi": "identifier",
|
|
559
|
+
"context": "ype html><meta charset=\"utf-8\"><title>micro / jmi synta"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"line": 1,
|
|
563
|
+
"column": 28,
|
|
564
|
+
"micro": "symbol.tag",
|
|
565
|
+
"jmi": "identifier",
|
|
566
|
+
"context": "pe html><meta charset=\"utf-8\"><title>micro / jmi syntax"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"line": 1,
|
|
570
|
+
"column": 29,
|
|
571
|
+
"micro": "symbol.tag",
|
|
572
|
+
"jmi": "symbol",
|
|
573
|
+
"context": "e html><meta charset=\"utf-8\"><title>micro / jmi syntax "
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"line": 1,
|
|
577
|
+
"column": 89,
|
|
578
|
+
"micro": "default",
|
|
579
|
+
"jmi": "statement",
|
|
580
|
+
"context": "rison</title><style>body{background:#181818;color:#eee;"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"line": 1,
|
|
584
|
+
"column": 90,
|
|
585
|
+
"micro": "default",
|
|
586
|
+
"jmi": "statement",
|
|
587
|
+
"context": "ison</title><style>body{background:#181818;color:#eee;f"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"line": 1,
|
|
591
|
+
"column": 91,
|
|
592
|
+
"micro": "default",
|
|
593
|
+
"jmi": "statement",
|
|
594
|
+
"context": "son</title><style>body{background:#181818;color:#eee;fo"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"line": 1,
|
|
598
|
+
"column": 92,
|
|
599
|
+
"micro": "default",
|
|
600
|
+
"jmi": "statement",
|
|
601
|
+
"context": "on</title><style>body{background:#181818;color:#eee;fon"
|
|
602
|
+
}
|
|
603
|
+
]
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"name": "comparison",
|
|
607
|
+
"syntax": "html5.yaml",
|
|
608
|
+
"diffs": 0,
|
|
609
|
+
"extraStringChars": 0,
|
|
610
|
+
"first": []
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"name": "comparison",
|
|
614
|
+
"syntax": "html4.yaml",
|
|
615
|
+
"diffs": 0,
|
|
616
|
+
"extraStringChars": 0,
|
|
617
|
+
"first": []
|
|
618
|
+
}
|
|
619
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Run against an external, unmodified micro checkout; no upstream code is copied.
|
|
2
|
+
package main
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"fmt"
|
|
6
|
+
"os"
|
|
7
|
+
"path/filepath"
|
|
8
|
+
"regexp/syntax"
|
|
9
|
+
"sort"
|
|
10
|
+
"strings"
|
|
11
|
+
h "github.com/micro-editor/micro/v2/pkg/highlight"
|
|
12
|
+
"gopkg.in/yaml.v2"
|
|
13
|
+
)
|
|
14
|
+
func witness(r *syntax.Regexp) string {
|
|
15
|
+
switch r.Op {
|
|
16
|
+
case syntax.OpLiteral: return string(r.Rune)
|
|
17
|
+
case syntax.OpCharClass:
|
|
18
|
+
for _,c:=range "aA0_ /x" {for i:=0;i<len(r.Rune);i+=2{if c>=r.Rune[i]&&c<=r.Rune[i+1]{return string(c)}}};if len(r.Rune)>0{return string(r.Rune[0])}
|
|
19
|
+
case syntax.OpAnyChar,syntax.OpAnyCharNotNL:return "x"
|
|
20
|
+
case syntax.OpCapture:return witness(r.Sub[0])
|
|
21
|
+
case syntax.OpConcat:var b strings.Builder;for _,s:=range r.Sub{b.WriteString(witness(s))};return b.String()
|
|
22
|
+
case syntax.OpAlternate:return witness(r.Sub[0])
|
|
23
|
+
case syntax.OpStar,syntax.OpPlus,syntax.OpQuest:return witness(r.Sub[0])
|
|
24
|
+
case syntax.OpRepeat:n:=r.Min;if n==0&&r.Max!=0{n=1};if n>30{n=30};return strings.Repeat(witness(r.Sub[0]),n)
|
|
25
|
+
};return ""
|
|
26
|
+
}
|
|
27
|
+
func example(s string)string{r,e:=syntax.Parse(s,syntax.Perl);if e!=nil{return ""};return witness(r)}
|
|
28
|
+
func snippets(rules []interface{})[]string{
|
|
29
|
+
var out []string
|
|
30
|
+
for _,item:=range rules{m,ok:=item.(map[interface{}]interface{});if !ok{continue};for k,v:=range m{if k=="include"{continue};switch v:=v.(type){case string:out=append(out,example(v));case map[interface{}]interface{}:
|
|
31
|
+
start,_:=v["start"].(string);end,_:=v["end"].(string);a,b:=example(start),example(end)
|
|
32
|
+
out=append(out,a+"sample 42"+b)
|
|
33
|
+
if nested,ok:=v["rules"].([]interface{});ok{for _,s:=range snippets(nested){out=append(out,a+s+b)}}
|
|
34
|
+
}}}
|
|
35
|
+
return out
|
|
36
|
+
}
|
|
37
|
+
func main(){
|
|
38
|
+
root:=os.Args[1]; var req struct{Files []string `json:"files"`; Samples map[string]string `json:"samples"`};json.NewDecoder(os.Stdin).Decode(&req)
|
|
39
|
+
paths,_:=filepath.Glob(filepath.Join(root,"*.yaml"));sort.Strings(paths)
|
|
40
|
+
var files []*h.File; data:=map[string][]byte{}
|
|
41
|
+
for _,p:=range paths{b,e:=os.ReadFile(p);if e!=nil{panic(e)};f,e:=h.ParseFile(b);if e!=nil{panic(e)};files=append(files,f);data[filepath.Base(p)]=b}
|
|
42
|
+
results:=map[string]interface{}{}
|
|
43
|
+
for _,name:=range req.Files{b:=data[name];f,e:=h.ParseFile(b);if e!=nil{panic(e)};header,e:=h.MakeHeaderYaml(b);if e!=nil{panic(e)};d,e:=h.ParseDef(f,header);if e!=nil{panic(fmt.Errorf("%s: %w",name,e))};h.ResolveIncludes(d,files)
|
|
44
|
+
text,ok:=req.Samples[name];if !ok{var src map[string]interface{};yaml.Unmarshal(b,&src);rules,_:=src["rules"].([]interface{});ss:=snippets(rules);ss=append(ss,"sample = 42", "\"hello\" # comment", "// TODO: sample", "/* sample */", "true false null", "https://example.com/path");seen:=map[string]bool{};var clean []string;for _,s:=range ss{if s!=""&&!seen[s]{clean=append(clean,s);seen[s]=true}};text=strings.Join(clean,"\n")+"\n"}
|
|
45
|
+
marks:=h.NewHighlighter(d).HighlightString(text);lines:=strings.Split(text,"\n");expanded:=[][]string{}
|
|
46
|
+
for i,line:=range lines{var colors []string;active:="default";for col:=range []rune(line){if g,ok:=marks[i][col];ok{active=g.String();if active==""{active="default"}};colors=append(colors,active)};expanded=append(expanded,colors)}
|
|
47
|
+
results[name]=map[string]interface{}{"text":text,"groups":expanded,"filetype":header.FileType}
|
|
48
|
+
};json.NewEncoder(os.Stdout).Encode(results)
|
|
49
|
+
}
|