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,46 @@
|
|
|
1
|
+
# Normal HTML follow-up
|
|
2
|
+
|
|
3
|
+
Tested with the same unmodified micro highlighter oracle and upstream YAML as
|
|
4
|
+
REPORT.md. See normal-html-report.json for counts and first differing positions.
|
|
5
|
+
The full comparison.html was also passed to both engines as input, unchanged.
|
|
6
|
+
|
|
7
|
+
The minimal reproduction is ordinary valid HTML:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<div class="hello">Hello</div>
|
|
11
|
+
<p>Next line</p>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
With html.yaml (the definition selected by the .html filename), jmi ends the
|
|
15
|
+
first line with a constant.string state and colors the entire second line as a
|
|
16
|
+
string. This is a real nested-region state bug, not just a malformed generated
|
|
17
|
+
sample. normal-html.html contains a complete document for manual reproduction.
|
|
18
|
+
|
|
19
|
+
For the generated comparison.html, html.yaml produced 731354 differing character
|
|
20
|
+
groups, including 438494 characters marked as strings only by jmi. This large
|
|
21
|
+
one-line file amplifies the state issue; it is not a typical per-file error rate.
|
|
22
|
+
The same full file matched with explicitly selected html4.yaml and html5.yaml,
|
|
23
|
+
which have different rules and are not the default .html filename match.
|
|
24
|
+
|
|
25
|
+
This check did not modify the highlighter or the syntax files.
|
|
26
|
+
|
|
27
|
+
## After the nested-region fix
|
|
28
|
+
|
|
29
|
+
The historical reproduction above is now covered by highlight-regions.test.js.
|
|
30
|
+
The child scanner already resumes its parent and processes the rest of the line;
|
|
31
|
+
returning that result directly avoids rescanning closing quotes as new openings.
|
|
32
|
+
Both HTML and XML now return to the correct outer state, including when an
|
|
33
|
+
attribute legitimately spans multiple lines. Original syntax YAML is unchanged.
|
|
34
|
+
|
|
35
|
+
The current normal-html-report.json records the follow-up: simple HTML,
|
|
36
|
+
two-attribute HTML and a complete normal document have no extra string-colored
|
|
37
|
+
characters. Their remaining differences are local token groups, such as micro
|
|
38
|
+
using symbol.tag where jmi recognizes an attribute as identifier. The current
|
|
39
|
+
comparison.html still has local group differences and is not fully identical.
|
|
40
|
+
It is regenerated from the latest results, so its total size differs from the
|
|
41
|
+
historical input above; raw differing-character totals are not a fixed-corpus
|
|
42
|
+
before/after benchmark.
|
|
43
|
+
|
|
44
|
+
The 158-syntax corpus now has 130 identical samples and 28 with differences.
|
|
45
|
+
XML and MSBuild samples match completely. Mixed POSIX character classes are
|
|
46
|
+
also translated; default/email, mail and privoxy-action samples now match.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# micro syntax parity fixtures
|
|
2
|
+
|
|
3
|
+
This directory contains one lexical sample for each of **158 syntax definitions**.
|
|
4
|
+
The current report uses upstream micro YAML for both engines, including
|
|
5
|
+
JavaScript, Python and Markdown. For the first run those three local files were
|
|
6
|
+
backed up, temporarily replaced and restored byte-for-byte after comparison.
|
|
7
|
+
`--upstream-syntax` reproduces that comparison without modifying any syntax files.
|
|
8
|
+
Without this flag, the comparator tests only byte-identical local definitions
|
|
9
|
+
and excludes JavaScript, Python and Markdown; included definitions then come
|
|
10
|
+
from each engine's own tree.
|
|
11
|
+
|
|
12
|
+
- [REPORT.md](REPORT.md): counts and first differences, with sample links.
|
|
13
|
+
- `comparison.html` (generated locally, not included): side-by-side colors using
|
|
14
|
+
the same Monokai palette; hover over a span for its exact group. No external
|
|
15
|
+
assets required.
|
|
16
|
+
- [report.json](report.json): machine-readable per-language results.
|
|
17
|
+
- `samples/*.txt`: generated rule witnesses, with hand-written Dockerfile and
|
|
18
|
+
MSBuild examples. They are lexical test fragments, **not generally valid
|
|
19
|
+
programs**. Region boundaries, escaping, and overlapping patterns are included.
|
|
20
|
+
|
|
21
|
+
The oracle invokes the actual, unmodified upstream `pkg/highlight` Go package,
|
|
22
|
+
including its YAML parser and include resolution. No Go regex approximation is
|
|
23
|
+
used for the reference results. This is a highlighter comparison, not a terminal
|
|
24
|
+
screenshot comparison or a test of automatic filetype detection. The sample
|
|
25
|
+
filenames deliberately do not guess extensions: select the filetype shown in
|
|
26
|
+
the report when opening them in an editor (`set filetype dockerfile`, for example).
|
|
27
|
+
|
|
28
|
+
All samples have non-default groups in both engines. Equal results mean equal
|
|
29
|
+
per-character syntax groups **for these samples only**, not full language parity.
|
|
30
|
+
The HTML is a viewing aid, not a substitute for the group-level comparison.
|
|
31
|
+
|
|
32
|
+
## Generate the comparison HTML and reports
|
|
33
|
+
|
|
34
|
+
Install Go 1.24 or newer and Bun with scoped RegExp modifier support. Start in
|
|
35
|
+
this directory. Point `MICRO_SOURCE` at an existing upstream micro checkout:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
export MICRO_SOURCE=/absolute/path/to/go-micro
|
|
39
|
+
export PARITY_BUILD_DIR="$(mktemp -d)"
|
|
40
|
+
cp go.mod "$PARITY_BUILD_DIR/oracle.mod"
|
|
41
|
+
go mod edit -modfile="$PARITY_BUILD_DIR/oracle.mod" \
|
|
42
|
+
-replace="github.com/micro-editor/micro/v2=$MICRO_SOURCE"
|
|
43
|
+
go build -mod=mod -modfile="$PARITY_BUILD_DIR/oracle.mod" \
|
|
44
|
+
-o "$PARITY_BUILD_DIR/oracle" oracle.go
|
|
45
|
+
bun compare.mjs "$MICRO_SOURCE" "$PARITY_BUILD_DIR/oracle" --upstream-syntax
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The final `bun compare.mjs` command writes `comparison.html`, `REPORT.md` and
|
|
49
|
+
`report.json` into this directory. Open `comparison.html` in a browser and expand
|
|
50
|
+
a language to compare micro (left) with jmi (right). Once the oracle executable
|
|
51
|
+
has been built, rerun just that final command to regenerate the page. The HTML
|
|
52
|
+
is intentionally not checked in and has no Git ignore rule; remove it after
|
|
53
|
+
viewing if you do not want it included in a later commit.
|
|
54
|
+
|
|
55
|
+
Go downloads test-only dependencies to its module cache. It is not a jsmdcui
|
|
56
|
+
runtime dependency; the checkout's module file and upstream sources remain
|
|
57
|
+
unchanged. The reference commit is recorded in the report. Re-running rewrites
|
|
58
|
+
only the reports; it keeps the checked-in samples. `--generate` regenerates
|
|
59
|
+
lexical witnesses and overwrites hand-written samples, so normal comparisons
|
|
60
|
+
should omit it.
|
|
61
|
+
|
|
62
|
+
Differences are reported rather than hidden or automatically fixed. In
|
|
63
|
+
particular, a regex compiling successfully does not establish equivalence of
|
|
64
|
+
nested region handling, skip masking, or rule ordering.
|
|
65
|
+
|
|
66
|
+
## Scanner safety checks
|
|
67
|
+
|
|
68
|
+
Run `bun test tests/highlight-regions.test.js tests/go-regexp.test.js` from the
|
|
69
|
+
jsmdcui root. These cover zero-width cycles, Unicode empty matches, NUL, isolated
|
|
70
|
+
surrogates, cyclic definitions/state, and a 200,003-character line whose final
|
|
71
|
+
keyword must still be highlighted. Region transitions are iterative; there is
|
|
72
|
+
no input line-length cutoff. Malformed definitions are limited to 128 nested
|
|
73
|
+
rule levels. A repeated state at the same position advances by one Unicode
|
|
74
|
+
character and continues highlighting. If malformed states keep creating fresh
|
|
75
|
+
objects, 256 transitions without advancing reset the unfinished region for that
|
|
76
|
+
line instead of carrying it forward.
|
|
77
|
+
|
|
78
|
+
A manual stability run also processed Vue 3.5.13's `vue.global.prod.js`
|
|
79
|
+
(157,924 bytes, longest line 141,082 UTF-16 units) in about 87 ms on the test
|
|
80
|
+
host, without a stack overflow or truncation. This is not proof of exact Vue
|
|
81
|
+
syntax parity. No downloaded Vue bundle is included in the repository.
|
|
82
|
+
|
|
83
|
+
These guards prevent scanner loops and stack exhaustion. They cannot interrupt
|
|
84
|
+
a single pathological native JavaScript RegExp execution; arbitrary untrusted
|
|
85
|
+
regexes would need worker/process isolation for a hard execution-time limit.
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# micro / jmi syntax parity
|
|
2
|
+
|
|
3
|
+
Upstream commit: 6cf68963a6c0630b696c0e56ae61f733ab7129c0
|
|
4
|
+
|
|
5
|
+
Syntax source: upstream.
|
|
6
|
+
|
|
7
|
+
158 byte-identical YAML files tested; 0 changed/missing files excluded.
|
|
8
|
+
130 match; 28 differ; 0 lack non-default groups in one or both engines.
|
|
9
|
+
|
|
10
|
+
Comparison is by syntax group for every character, not theme RGB values.
|
|
11
|
+
These generated lexical samples exercise rule witnesses, not complete valid programs or exhaustive language coverage.
|
|
12
|
+
|
|
13
|
+
| Syntax | micro colored chars | jmi colored chars | Different chars |
|
|
14
|
+
|---|---:|---:|---:|
|
|
15
|
+
| [powershell](samples/PowerShell.txt) | 297 | 297 | 1 |
|
|
16
|
+
| [ada](samples/ada.txt) | 132 | 132 | 0 |
|
|
17
|
+
| [apacheconf](samples/apacheconf.txt) | 566 | 566 | 0 |
|
|
18
|
+
| [ino](samples/arduino.txt) | 300 | 300 | 0 |
|
|
19
|
+
| [asciidoc](samples/asciidoc.txt) | 123 | 123 | 0 |
|
|
20
|
+
| [asm](samples/asm.txt) | 450 | 450 | 0 |
|
|
21
|
+
| [ATS](samples/ats.txt) | 365 | 367 | 2 |
|
|
22
|
+
| [awk](samples/awk.txt) | 179 | 179 | 0 |
|
|
23
|
+
| [B](samples/b.txt) | 185 | 185 | 0 |
|
|
24
|
+
| [batch](samples/bat.txt) | 182 | 182 | 0 |
|
|
25
|
+
| [c](samples/c.txt) | 283 | 283 | 0 |
|
|
26
|
+
| [caddyfile](samples/caddyfile.txt) | 97 | 97 | 0 |
|
|
27
|
+
| [cake](samples/cake.txt) | 76 | 76 | 0 |
|
|
28
|
+
| [clojure](samples/clojure.txt) | 91 | 91 | 0 |
|
|
29
|
+
| [cmake](samples/cmake.txt) | 117 | 117 | 0 |
|
|
30
|
+
| [coffeescript](samples/coffeescript.txt) | 201 | 201 | 0 |
|
|
31
|
+
| [colortest](samples/colortest.txt) | 99 | 99 | 0 |
|
|
32
|
+
| [conky](samples/conky.txt) | 37 | 37 | 0 |
|
|
33
|
+
| [c++](samples/cpp.txt) | 383 | 383 | 0 |
|
|
34
|
+
| [crontab](samples/crontab.txt) | 62 | 62 | 0 |
|
|
35
|
+
| [crystal](samples/crystal.txt) | 252 | 250 | 2 |
|
|
36
|
+
| [csharp](samples/csharp.txt) | 213 | 213 | 0 |
|
|
37
|
+
| [css](samples/css.txt) | 187 | 187 | 0 |
|
|
38
|
+
| [csharp-script](samples/csx.txt) | 71 | 71 | 1 |
|
|
39
|
+
| [cuda](samples/cuda.txt) | 262 | 262 | 0 |
|
|
40
|
+
| [cython](samples/cython.txt) | 142 | 142 | 0 |
|
|
41
|
+
| [d](samples/d.txt) | 452 | 452 | 4 |
|
|
42
|
+
| [dart](samples/dart.txt) | 198 | 198 | 0 |
|
|
43
|
+
| [unknown](samples/default.txt) | 37 | 37 | 0 |
|
|
44
|
+
| [dockerfile](samples/dockerfile.txt) | 167 | 167 | 0 |
|
|
45
|
+
| [dot](samples/dot.txt) | 125 | 125 | 0 |
|
|
46
|
+
| [elixir](samples/elixir.txt) | 91 | 91 | 0 |
|
|
47
|
+
| [elm](samples/elm.txt) | 129 | 129 | 0 |
|
|
48
|
+
| [erb](samples/erb.txt) | 79 | 79 | 0 |
|
|
49
|
+
| [erlang](samples/erlang.txt) | 128 | 128 | 0 |
|
|
50
|
+
| [fish](samples/fish.txt) | 97 | 97 | 0 |
|
|
51
|
+
| [forth](samples/forth.txt) | 125 | 125 | 0 |
|
|
52
|
+
| [fortran](samples/fortran.txt) | 268 | 268 | 0 |
|
|
53
|
+
| [freebsd-kernel](samples/freebsd-kernel.txt) | 70 | 70 | 0 |
|
|
54
|
+
| [fsharp](samples/fsharp.txt) | 129 | 129 | 0 |
|
|
55
|
+
| [gdscript](samples/gdscript.txt) | 187 | 187 | 0 |
|
|
56
|
+
| [gemini](samples/gemini.txt) | 119 | 119 | 0 |
|
|
57
|
+
| [ebuild](samples/gentoo-ebuild.txt) | 146 | 146 | 0 |
|
|
58
|
+
| [etc-portage](samples/gentoo-etc-portage.txt) | 103 | 103 | 0 |
|
|
59
|
+
| [git-commit](samples/git-commit.txt) | 146 | 146 | 0 |
|
|
60
|
+
| [git-config](samples/git-config.txt) | 51 | 51 | 0 |
|
|
61
|
+
| [git-rebase-todo](samples/git-rebase-todo.txt) | 29 | 29 | 0 |
|
|
62
|
+
| [gleam](samples/gleam.txt) | 239 | 299 | 63 |
|
|
63
|
+
| [glsl](samples/glsl.txt) | 145 | 145 | 0 |
|
|
64
|
+
| [gnuplot](samples/gnuplot.txt) | 44 | 44 | 0 |
|
|
65
|
+
| [go](samples/go.txt) | 213 | 213 | 0 |
|
|
66
|
+
| [godoc](samples/godoc.txt) | 114 | 114 | 0 |
|
|
67
|
+
| [golo](samples/golo.txt) | 336 | 336 | 0 |
|
|
68
|
+
| [gomod](samples/gomod.txt) | 138 | 138 | 0 |
|
|
69
|
+
| [graphql](samples/graphql.txt) | 87 | 87 | 0 |
|
|
70
|
+
| [groff](samples/groff.txt) | 71 | 71 | 1 |
|
|
71
|
+
| [groovy](samples/groovy.txt) | 333 | 333 | 2 |
|
|
72
|
+
| [haml](samples/haml.txt) | 43 | 43 | 0 |
|
|
73
|
+
| [hare](samples/hare.txt) | 179 | 179 | 1 |
|
|
74
|
+
| [haskell](samples/haskell.txt) | 135 | 135 | 0 |
|
|
75
|
+
| [hc](samples/hc.txt) | 186 | 186 | 0 |
|
|
76
|
+
| [html](samples/html.txt) | 170 | 181 | 12 |
|
|
77
|
+
| [html4](samples/html4.txt) | 11 | 19 | 9 |
|
|
78
|
+
| [html5](samples/html5.txt) | 11 | 19 | 9 |
|
|
79
|
+
| [ini](samples/ini.txt) | 86 | 86 | 0 |
|
|
80
|
+
| [inputrc](samples/inputrc.txt) | 37 | 37 | 0 |
|
|
81
|
+
| [java](samples/java.txt) | 150 | 150 | 0 |
|
|
82
|
+
| [javascript](samples/javascript.txt) | 296 | 296 | 2 |
|
|
83
|
+
| [jinja2](samples/jinja2.txt) | 42 | 79 | 37 |
|
|
84
|
+
| [json](samples/json.txt) | 178 | 178 | 0 |
|
|
85
|
+
| [jsonnet](samples/jsonnet.txt) | 249 | 249 | 4 |
|
|
86
|
+
| [julia](samples/julia.txt) | 159 | 159 | 0 |
|
|
87
|
+
| [justfile](samples/justfile.txt) | 146 | 146 | 0 |
|
|
88
|
+
| [keymap](samples/keymap.txt) | 62 | 62 | 0 |
|
|
89
|
+
| [kickstart](samples/kickstart.txt) | 53 | 53 | 0 |
|
|
90
|
+
| [kotlin](samples/kotlin.txt) | 220 | 220 | 0 |
|
|
91
|
+
| [kvlang](samples/kvlang.txt) | 256 | 256 | 0 |
|
|
92
|
+
| [ledger](samples/ledger.txt) | 42 | 42 | 0 |
|
|
93
|
+
| [lfe](samples/lfe.txt) | 51 | 51 | 0 |
|
|
94
|
+
| [lilypond](samples/lilypond.txt) | 68 | 68 | 0 |
|
|
95
|
+
| [lisp](samples/lisp.txt) | 32 | 32 | 0 |
|
|
96
|
+
| [log](samples/log.txt) | 459 | 459 | 0 |
|
|
97
|
+
| [lua](samples/lua.txt) | 490 | 490 | 5 |
|
|
98
|
+
| [mail](samples/mail.txt) | 70 | 70 | 0 |
|
|
99
|
+
| [makefile](samples/makefile.txt) | 142 | 142 | 0 |
|
|
100
|
+
| [man](samples/man.txt) | 20 | 20 | 0 |
|
|
101
|
+
| [markdown](samples/markdown.txt) | 159 | 159 | 0 |
|
|
102
|
+
| [mc](samples/mc.txt) | 62 | 62 | 0 |
|
|
103
|
+
| [meson](samples/meson.txt) | 226 | 226 | 0 |
|
|
104
|
+
| [micro](samples/micro.txt) | 200 | 200 | 0 |
|
|
105
|
+
| [mpd](samples/mpdconf.txt) | 53 | 53 | 0 |
|
|
106
|
+
| [msbuild](samples/msbuild.txt) | 164 | 164 | 0 |
|
|
107
|
+
| [nanorc](samples/nanorc.txt) | 78 | 78 | 0 |
|
|
108
|
+
| [nftables](samples/nftables.txt) | 96 | 96 | 1 |
|
|
109
|
+
| [nginx](samples/nginx.txt) | 68 | 68 | 0 |
|
|
110
|
+
| [nim](samples/nim.txt) | 113 | 113 | 0 |
|
|
111
|
+
| [nix](samples/nix.txt) | 123 | 123 | 0 |
|
|
112
|
+
| [nu](samples/nu.txt) | 773 | 773 | 0 |
|
|
113
|
+
| [objective-c](samples/objc.txt) | 265 | 265 | 12 |
|
|
114
|
+
| [ocaml](samples/ocaml.txt) | 104 | 104 | 0 |
|
|
115
|
+
| [octave](samples/octave.txt) | 206 | 206 | 2 |
|
|
116
|
+
| [odin](samples/odin.txt) | 217 | 217 | 0 |
|
|
117
|
+
| [pascal](samples/pascal.txt) | 169 | 169 | 2 |
|
|
118
|
+
| [patch](samples/patch.txt) | 22 | 22 | 0 |
|
|
119
|
+
| [peg](samples/peg.txt) | 52 | 52 | 0 |
|
|
120
|
+
| [perl](samples/perl.txt) | 239 | 239 | 0 |
|
|
121
|
+
| [php](samples/php.txt) | 283 | 287 | 16 |
|
|
122
|
+
| [pc](samples/pkg-config.txt) | 32 | 32 | 0 |
|
|
123
|
+
| [po](samples/po.txt) | 34 | 34 | 0 |
|
|
124
|
+
| [pony](samples/pony.txt) | 156 | 156 | 0 |
|
|
125
|
+
| [pov](samples/pov.txt) | 126 | 126 | 0 |
|
|
126
|
+
| [privoxy-action](samples/privoxy-action.txt) | 56 | 56 | 0 |
|
|
127
|
+
| [privoxy-config](samples/privoxy-config.txt) | 44 | 44 | 0 |
|
|
128
|
+
| [privoxy-filter](samples/privoxy-filter.txt) | 34 | 34 | 0 |
|
|
129
|
+
| [proto](samples/proto.txt) | 152 | 152 | 0 |
|
|
130
|
+
| [prql](samples/prql.txt) | 293 | 293 | 12 |
|
|
131
|
+
| [puppet](samples/puppet.txt) | 86 | 86 | 0 |
|
|
132
|
+
| [python2](samples/python2.txt) | 148 | 148 | 0 |
|
|
133
|
+
| [python](samples/python3.txt) | 174 | 174 | 0 |
|
|
134
|
+
| [r](samples/r.txt) | 87 | 87 | 0 |
|
|
135
|
+
| [raku](samples/raku.txt) | 120 | 120 | 0 |
|
|
136
|
+
| [rst](samples/reST.txt) | 42 | 42 | 0 |
|
|
137
|
+
| [renpy](samples/renpy.txt) | 56 | 56 | 0 |
|
|
138
|
+
| [rpmspec](samples/rpmspec.txt) | 191 | 191 | 0 |
|
|
139
|
+
| [ruby](samples/ruby.txt) | 285 | 285 | 0 |
|
|
140
|
+
| [rust](samples/rust.txt) | 250 | 250 | 2 |
|
|
141
|
+
| [sage](samples/sage.txt) | 148 | 148 | 0 |
|
|
142
|
+
| [OpenSCAD](samples/scad.txt) | 173 | 173 | 0 |
|
|
143
|
+
| [scala](samples/scala.txt) | 152 | 152 | 0 |
|
|
144
|
+
| [sed](samples/sed.txt) | 27 | 27 | 0 |
|
|
145
|
+
| [shell](samples/sh.txt) | 99 | 99 | 0 |
|
|
146
|
+
| [salt](samples/sls.txt) | 48 | 48 | 0 |
|
|
147
|
+
| [smalltalk](samples/smalltalk.txt) | 239 | 239 | 0 |
|
|
148
|
+
| [solidity](samples/solidity.txt) | 230 | 230 | 0 |
|
|
149
|
+
| [sql](samples/sql.txt) | 169 | 169 | 0 |
|
|
150
|
+
| [stata](samples/stata.txt) | 244 | 246 | 10 |
|
|
151
|
+
| [svelte](samples/svelte.txt) | 46 | 46 | 0 |
|
|
152
|
+
| [swift](samples/swift.txt) | 467 | 467 | 0 |
|
|
153
|
+
| [systemd](samples/systemd.txt) | 61 | 61 | 0 |
|
|
154
|
+
| [tcl](samples/tcl.txt) | 71 | 71 | 0 |
|
|
155
|
+
| [terraform](samples/terraform.txt) | 198 | 198 | 4 |
|
|
156
|
+
| [tex](samples/tex.txt) | 177 | 177 | 0 |
|
|
157
|
+
| [toml](samples/toml.txt) | 286 | 286 | 0 |
|
|
158
|
+
| [twig](samples/twig.txt) | 259 | 259 | 12 |
|
|
159
|
+
| [typescript](samples/typescript.txt) | 237 | 237 | 0 |
|
|
160
|
+
| [v](samples/v.txt) | 90 | 89 | 1 |
|
|
161
|
+
| [vala](samples/vala.txt) | 123 | 123 | 0 |
|
|
162
|
+
| [verilog](samples/verilog.txt) | 269 | 269 | 0 |
|
|
163
|
+
| [vhdl](samples/vhdl.txt) | 253 | 253 | 0 |
|
|
164
|
+
| [vi](samples/vi.txt) | 80 | 80 | 0 |
|
|
165
|
+
| [vue](samples/vue.txt) | 533 | 640 | 109 |
|
|
166
|
+
| [xml](samples/xml.txt) | 110 | 110 | 0 |
|
|
167
|
+
| [xresources](samples/xresources.txt) | 33 | 33 | 0 |
|
|
168
|
+
| [yaml](samples/yaml.txt) | 106 | 106 | 0 |
|
|
169
|
+
| [yum](samples/yum.txt) | 42 | 42 | 0 |
|
|
170
|
+
| [zig](samples/zig.txt) | 153 | 153 | 0 |
|
|
171
|
+
| [zscript](samples/zscript.txt) | 229 | 229 | 0 |
|
|
172
|
+
| [zsh](samples/zsh.txt) | 125 | 125 | 0 |
|
|
173
|
+
|
|
174
|
+
## Excluded YAML files
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## Differences
|
|
179
|
+
|
|
180
|
+
### PowerShell.yaml
|
|
181
|
+
|
|
182
|
+
- Line 23, column 2: micro `constant.string`, jmi `constant.specialChar`; "\"\\\"\""
|
|
183
|
+
|
|
184
|
+
### ats.yaml
|
|
185
|
+
|
|
186
|
+
- Line 32, column 11: micro `default`, jmi `constant.number`; "%{#sample 42%}"
|
|
187
|
+
- Line 32, column 12: micro `default`, jmi `constant.number`; "%{#sample 42%}"
|
|
188
|
+
|
|
189
|
+
### crystal.yaml
|
|
190
|
+
|
|
191
|
+
- Line 14, column 11: micro `constant.number`, jmi `default`; "\"#{sample 42}\""
|
|
192
|
+
- Line 14, column 12: micro `constant.number`, jmi `default`; "\"#{sample 42}\""
|
|
193
|
+
|
|
194
|
+
### csx.yaml
|
|
195
|
+
|
|
196
|
+
- Line 1, column 2: micro `symbol.operator`, jmi `preproc`; "#!"
|
|
197
|
+
|
|
198
|
+
### d.yaml
|
|
199
|
+
|
|
200
|
+
- Line 27, column 3: micro `constant.string`, jmi `constant.specialChar`; "r\"\\x\""
|
|
201
|
+
- Line 27, column 4: micro `constant.string`, jmi `constant.specialChar`; "r\"\\x\""
|
|
202
|
+
- Line 31, column 3: micro `constant.string`, jmi `constant.specialChar`; "x\"\\x\""
|
|
203
|
+
|
|
204
|
+
### gleam.yaml
|
|
205
|
+
|
|
206
|
+
- Line 17, column 3: micro `default`, jmi `identifier`; "#(sample 42)"
|
|
207
|
+
- Line 17, column 4: micro `default`, jmi `identifier`; "#(sample 42)"
|
|
208
|
+
- Line 17, column 5: micro `default`, jmi `identifier`; "#(sample 42)"
|
|
209
|
+
|
|
210
|
+
### groff.yaml
|
|
211
|
+
|
|
212
|
+
- Line 1, column 3: micro `statement`, jmi `type`; ".ds a]"
|
|
213
|
+
|
|
214
|
+
### groovy.yaml
|
|
215
|
+
|
|
216
|
+
- Line 22, column 13: micro `constant.number`, jmi `identifier`; "\"\"\"${sample 42}\"\"\""
|
|
217
|
+
- Line 22, column 14: micro `constant.number`, jmi `identifier`; "\"\"\"${sample 42}\"\"\""
|
|
218
|
+
|
|
219
|
+
### hare.yaml
|
|
220
|
+
|
|
221
|
+
- Line 16, column 2: micro `constant.string`, jmi `error`; "'a'"
|
|
222
|
+
|
|
223
|
+
### html.yaml
|
|
224
|
+
|
|
225
|
+
- Line 11, column 3: micro `symbol.tag`, jmi `symbol`; "<a=>"
|
|
226
|
+
- Line 15, column 17: micro `default`, jmi `constant.number`; "<scriptx>sample 42</scriptx>"
|
|
227
|
+
- Line 15, column 18: micro `default`, jmi `constant.number`; "<scriptx>sample 42</scriptx>"
|
|
228
|
+
|
|
229
|
+
### html4.yaml
|
|
230
|
+
|
|
231
|
+
- Line 1, column 2: micro `default`, jmi `error`; "<ax>"
|
|
232
|
+
- Line 1, column 3: micro `default`, jmi `error`; "<ax>"
|
|
233
|
+
- Line 13, column 1: micro `symbol.tag`, jmi `comment`; "<!--x-->"
|
|
234
|
+
|
|
235
|
+
### html5.yaml
|
|
236
|
+
|
|
237
|
+
- Line 1, column 2: micro `default`, jmi `error`; "<ax>"
|
|
238
|
+
- Line 1, column 3: micro `default`, jmi `error`; "<ax>"
|
|
239
|
+
- Line 13, column 1: micro `symbol.tag`, jmi `comment`; "<!--x-->"
|
|
240
|
+
|
|
241
|
+
### javascript.yaml
|
|
242
|
+
|
|
243
|
+
- Line 33, column 3: micro `comment`, jmi `constant.specialChar`; "/*\\x*/"
|
|
244
|
+
- Line 33, column 4: micro `comment`, jmi `constant.specialChar`; "/*\\x*/"
|
|
245
|
+
|
|
246
|
+
### jinja2.yaml
|
|
247
|
+
|
|
248
|
+
- Line 2, column 1: micro `default`, jmi `symbol.brackets`; "{%-sample 42-%}"
|
|
249
|
+
- Line 2, column 2: micro `default`, jmi `symbol.operator`; "{%-sample 42-%}"
|
|
250
|
+
- Line 2, column 3: micro `default`, jmi `symbol.operator`; "{%-sample 42-%}"
|
|
251
|
+
|
|
252
|
+
### jsonnet.yaml
|
|
253
|
+
|
|
254
|
+
- Line 15, column 3: micro `constant.string`, jmi `constant.specialChar`; "@\"\\\"\""
|
|
255
|
+
- Line 15, column 4: micro `constant.string`, jmi `constant.specialChar`; "@\"\\\"\""
|
|
256
|
+
- Line 17, column 3: micro `constant.string`, jmi `constant.specialChar`; "@'\\''"
|
|
257
|
+
|
|
258
|
+
### lua.yaml
|
|
259
|
+
|
|
260
|
+
- Line 34, column 6: micro `comment.block`, jmi `todo`; "--[=[TODO:]=]"
|
|
261
|
+
- Line 34, column 7: micro `comment.block`, jmi `todo`; "--[=[TODO:]=]"
|
|
262
|
+
- Line 34, column 8: micro `comment.block`, jmi `todo`; "--[=[TODO:]=]"
|
|
263
|
+
|
|
264
|
+
### nftables.yaml
|
|
265
|
+
|
|
266
|
+
- Line 18, column 8: micro `indent-char.whitespace`, jmi `comment`; "\"hello\" # comment"
|
|
267
|
+
|
|
268
|
+
### objc.yaml
|
|
269
|
+
|
|
270
|
+
- Line 15, column 1: micro `preproc`, jmi `special`; " # import \"x/\" "
|
|
271
|
+
- Line 15, column 2: micro `preproc`, jmi `special`; " # import \"x/\" "
|
|
272
|
+
- Line 15, column 3: micro `preproc`, jmi `special`; " # import \"x/\" "
|
|
273
|
+
|
|
274
|
+
### octave.yaml
|
|
275
|
+
|
|
276
|
+
- Line 14, column 2: micro `constant.string`, jmi `constant.specialChar`; "\"%\""
|
|
277
|
+
- Line 19, column 2: micro `constant.string`, jmi `constant.specialChar`; "'%'"
|
|
278
|
+
|
|
279
|
+
### pascal.yaml
|
|
280
|
+
|
|
281
|
+
- Line 10, column 3: micro `constant.string`, jmi `constant.specialChar`; "#0\\x"
|
|
282
|
+
- Line 10, column 4: micro `constant.string`, jmi `constant.specialChar`; "#0\\x"
|
|
283
|
+
|
|
284
|
+
### php.yaml
|
|
285
|
+
|
|
286
|
+
- Line 13, column 1: micro `default`, jmi `constant.string.url`; "ftps://a"
|
|
287
|
+
- Line 13, column 2: micro `default`, jmi `constant.string.url`; "ftps://a"
|
|
288
|
+
- Line 13, column 3: micro `default`, jmi `constant.string.url`; "ftps://a"
|
|
289
|
+
|
|
290
|
+
### prql.yaml
|
|
291
|
+
|
|
292
|
+
- Line 24, column 5: micro `constant.string`, jmi `constant.specialChar`; "f\"\"\"\\000\"\"\""
|
|
293
|
+
- Line 24, column 6: micro `constant.string`, jmi `constant.specialChar`; "f\"\"\"\\000\"\"\""
|
|
294
|
+
- Line 24, column 7: micro `constant.string`, jmi `constant.specialChar`; "f\"\"\"\\000\"\"\""
|
|
295
|
+
|
|
296
|
+
### rust.yaml
|
|
297
|
+
|
|
298
|
+
- Line 10, column 3: micro `constant.string`, jmi `constant.specialChar`; "b\"\\x\""
|
|
299
|
+
- Line 10, column 4: micro `constant.string`, jmi `constant.specialChar`; "b\"\\x\""
|
|
300
|
+
|
|
301
|
+
### stata.yaml
|
|
302
|
+
|
|
303
|
+
- Line 2, column 10: micro `default`, jmi `identifier.macro`; "`\"`sample 42'\"'"
|
|
304
|
+
- Line 2, column 11: micro `constant.number`, jmi `identifier.macro`; "`\"`sample 42'\"'"
|
|
305
|
+
- Line 2, column 12: micro `constant.number`, jmi `identifier.macro`; "`\"`sample 42'\"'"
|
|
306
|
+
|
|
307
|
+
### terraform.yaml
|
|
308
|
+
|
|
309
|
+
- Line 14, column 3: micro `constant.string`, jmi `constant.specialChar`; "''%x''"
|
|
310
|
+
- Line 14, column 4: micro `constant.string`, jmi `constant.specialChar`; "''%x''"
|
|
311
|
+
- Line 15, column 3: micro `constant.string`, jmi `constant.specialChar`; "''\\a''"
|
|
312
|
+
|
|
313
|
+
### twig.yaml
|
|
314
|
+
|
|
315
|
+
- Line 2, column 4: micro `symbol.tag`, jmi `identifier`; "{{ abs }}"
|
|
316
|
+
- Line 2, column 5: micro `symbol.tag`, jmi `identifier`; "{{ abs }}"
|
|
317
|
+
- Line 2, column 6: micro `symbol.tag`, jmi `identifier`; "{{ abs }}"
|
|
318
|
+
|
|
319
|
+
### v.yaml
|
|
320
|
+
|
|
321
|
+
- Line 15, column 2: micro `symbol.attribute`, jmi `default`; "[x]"
|
|
322
|
+
|
|
323
|
+
### vue.yaml
|
|
324
|
+
|
|
325
|
+
- Line 2, column 13: micro `default`, jmi `error`; "<templatex><ax></templatex>"
|
|
326
|
+
- Line 2, column 14: micro `default`, jmi `error`; "<templatex><ax></templatex>"
|
|
327
|
+
- Line 4, column 13: micro `default`, jmi `symbol.tag.extended`; "<templatex></BODY x></templatex>"
|
|
328
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {resolve,dirname,join} from 'node:path';
|
|
2
|
+
import {mkdir} from 'node:fs/promises';
|
|
3
|
+
import {SyntaxDefinition,parseHeaderYaml} from '../../src/highlight/parser.js';
|
|
4
|
+
import {Highlighter} from '../../src/highlight/highlighter.js';
|
|
5
|
+
const here=dirname(Bun.fileURLToPath(import.meta.url));
|
|
6
|
+
const local=resolve(here,'../../runtime/syntax');
|
|
7
|
+
const upstream=resolve(process.argv[2]||'../go-micro');
|
|
8
|
+
const oracle=resolve(process.argv[3]||'/tmp/jmi-micro-go/oracle');
|
|
9
|
+
const generate=process.argv.includes('--generate');
|
|
10
|
+
const upstreamSyntax=process.argv.includes('--upstream-syntax');
|
|
11
|
+
const files=[],excluded=[],definitions=[],samples={};
|
|
12
|
+
const definitionsByFile=new Map();
|
|
13
|
+
for(const name of [...new Bun.Glob('*.yaml').scanSync(local)].sort()){
|
|
14
|
+
const text=await Bun.file(join(upstreamSyntax?join(upstream,'runtime/syntax'):local,name)).text();
|
|
15
|
+
const source=Bun.YAML.parse(text);const def=new SyntaxDefinition(parseHeaderYaml(source),source,text);definitions.push(def);definitionsByFile.set(name,def);
|
|
16
|
+
const orig=Bun.file(join(upstream,'runtime/syntax',name));
|
|
17
|
+
if(!await orig.exists()||await orig.text()!==text){excluded.push(name);continue;}
|
|
18
|
+
files.push(name);
|
|
19
|
+
if(!generate)samples[name]=await Bun.file(join(here,'samples',name.replace(/\.yaml$/,'.txt'))).text();
|
|
20
|
+
}
|
|
21
|
+
const child=Bun.spawn([oracle,join(upstream,'runtime/syntax')],{stdin:'pipe',stdout:'pipe',stderr:'inherit'});
|
|
22
|
+
child.stdin.write(JSON.stringify({files,samples}));
|
|
23
|
+
child.stdin.end();
|
|
24
|
+
const raw=await new Response(child.stdout).text();
|
|
25
|
+
const original=JSON.parse(raw);
|
|
26
|
+
if(await child.exited)throw Error('micro oracle failed');
|
|
27
|
+
await mkdir(join(here,'samples'),{recursive:true});
|
|
28
|
+
const report={syntaxSource:upstreamSyntax?'upstream':'local',upstreamCommit:(await new Response(Bun.spawn(['git','-C',upstream,'rev-parse','HEAD'],{stdout:'pipe'}).stdout).text()).trim(),excluded,results:[]};
|
|
29
|
+
const palette=new Map();
|
|
30
|
+
for(const line of (await Bun.file(join(local,'../colorschemes/monokai.micro')).text()).split('\n')){
|
|
31
|
+
const m=line.match(/^color-link (\S+) "([^"]+)"/);if(m)palette.set(m[1],m[2]);
|
|
32
|
+
}
|
|
33
|
+
function color(group){
|
|
34
|
+
let value=palette.get(group);
|
|
35
|
+
while(!value&&group.includes('.')){group=group.slice(0,group.lastIndexOf('.'));value=palette.get(group);}
|
|
36
|
+
if(value==='default'||!value)value=palette.get('default');
|
|
37
|
+
return value.match(/#[0-9a-fA-F]{6}/)?.[0]||'#F8F8F2';
|
|
38
|
+
}
|
|
39
|
+
const esc=Bun.escapeHTML;
|
|
40
|
+
function painted(text,groups){return text.split('\n').map((line,row)=>{
|
|
41
|
+
const chars=[...line];let out='',start=0;
|
|
42
|
+
while(start<chars.length){const g=groups[row]?.[start]||'default';let end=start+1;
|
|
43
|
+
while(end<chars.length&&(groups[row]?.[end]||'default')===g)end++;
|
|
44
|
+
out+=`<span title="${esc(g)}" style="color:${color(g)}">${esc(chars.slice(start,end).join(''))}</span>`;start=end;
|
|
45
|
+
}return out;
|
|
46
|
+
}).join('\n');}
|
|
47
|
+
let html='<!doctype html><meta charset="utf-8"><title>micro / jmi syntax comparison</title><style>body{background:#181818;color:#eee;font:16px sans-serif}section{margin:2em 0} .pair{display:grid;grid-template-columns:1fr 1fr;gap:1em}pre{background:#282828;padding:1em;overflow:auto;font:14px monospace}summary{cursor:pointer}a{color:#66d9ef}</style><h1>micro / jmi syntax comparison</h1><p>Same Monokai palette. Hover over a character to see its syntax group. Samples are lexical test fragments, not necessarily valid programs.</p>';
|
|
48
|
+
for(const name of files){
|
|
49
|
+
const ref=original[name],def=definitionsByFile.get(name);
|
|
50
|
+
if(generate)await Bun.write(join(here,'samples',name.replace(/\.yaml$/,'.txt')),ref.text);
|
|
51
|
+
const actual=new Highlighter(def,definitions).highlightString(ref.text);
|
|
52
|
+
let coloredMicro=0,coloredJmi=0,different=0;const examples=[],actualGroups=[];
|
|
53
|
+
ref.text.split('\n').forEach((line,row)=>{
|
|
54
|
+
let offset=0,active='default';const chars=[...line],groups=[];actualGroups.push(groups);
|
|
55
|
+
for(let col=0;col<chars.length;col++){
|
|
56
|
+
if(actual[row].has(offset))active=actual[row].get(offset);
|
|
57
|
+
groups.push(active);
|
|
58
|
+
const expected=ref.groups[row]?.[col]||'default';
|
|
59
|
+
if(expected!=='default')coloredMicro++;if(active!=='default')coloredJmi++;
|
|
60
|
+
if(expected!==active){different++;if(examples.length<8)examples.push({line:row+1,column:col+1,text:line,micro:expected,jmi:active});}
|
|
61
|
+
offset+=chars[col].length;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
html+=`<details><summary>${esc(name)} — ${different} different characters</summary><div class="pair"><div><h3>micro</h3><pre>${painted(ref.text,ref.groups)}</pre></div><div><h3>jmi</h3><pre>${painted(ref.text,actualGroups)}</pre></div></div></details>`;
|
|
65
|
+
report.results.push({file:name,filetype:ref.filetype,coloredMicro,coloredJmi,different,examples});
|
|
66
|
+
}
|
|
67
|
+
await Bun.write(join(here,'comparison.html'),html);
|
|
68
|
+
await Bun.write(join(here,'report.json'),JSON.stringify(report,null,2)+'\n');
|
|
69
|
+
const matched=report.results.filter(r=>!r.different),diff=report.results.filter(r=>r.different),uncolored=report.results.filter(r=>!r.coloredMicro||!r.coloredJmi);
|
|
70
|
+
let md=`# micro / jmi syntax parity\n\nUpstream commit: ${report.upstreamCommit}\n\nSyntax source: ${report.syntaxSource}.\n\n${files.length} byte-identical YAML files tested; ${excluded.length} changed/missing files excluded.\n${matched.length} match; ${diff.length} differ; ${uncolored.length} lack non-default groups in one or both engines.\n\nComparison is by syntax group for every character, not theme RGB values.\nThese generated lexical samples exercise rule witnesses, not complete valid programs or exhaustive language coverage.\n\n| Syntax | micro colored chars | jmi colored chars | Different chars |\n|---|---:|---:|---:|\n`;
|
|
71
|
+
for(const r of report.results)md+=`| [${r.filetype}](samples/${r.file.replace(/\.yaml$/,'.txt')}) | ${r.coloredMicro} | ${r.coloredJmi} | ${r.different} |\n`;
|
|
72
|
+
md+='\n## Excluded YAML files\n\n'+excluded.map(x=>'- '+x).join('\n')+'\n\n## Differences\n\n';
|
|
73
|
+
for(const r of diff){md+=`### ${r.file}\n\n`;for(const e of r.examples.slice(0,3))md+=`- Line ${e.line}, column ${e.column}: micro \`${e.micro}\`, jmi \`${e.jmi}\`; ${JSON.stringify(e.text)}\n`;md+='\n';}
|
|
74
|
+
await Bun.write(join(here,'REPORT.md'),md);
|
|
75
|
+
console.log(JSON.stringify({files:files.length,excluded,matched:matched.length,differ:diff.length,uncolored:uncolored.map(r=>r.file)},null,2));
|