@mermanjs/tree-sitter-mermaid 0.2.0 → 0.3.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/CMakeLists.txt +1 -1
- package/Makefile +1 -1
- package/README.md +9 -6
- package/THIRD_PARTY_NOTICES.md +9 -2
- package/grammar/families/sequence.js +17 -11
- package/metadata/derivations.json +4 -4
- package/metadata/provenance.json +17 -6
- package/package.json +4 -4
- package/prebuilds/darwin-arm64/@mermanjs+tree-sitter-mermaid.node +0 -0
- package/prebuilds/darwin-x64/@mermanjs+tree-sitter-mermaid.node +0 -0
- package/prebuilds/linux-x64/@mermanjs+tree-sitter-mermaid.node +0 -0
- package/prebuilds/win32-x64/@mermanjs+tree-sitter-mermaid.node +0 -0
- package/src/grammar.json +40 -89
- package/src/parser.c +201211 -200173
- package/tree-sitter-mermaid.wasm +0 -0
- package/tree-sitter.json +1 -1
package/CMakeLists.txt
CHANGED
package/Makefile
CHANGED
package/README.md
CHANGED
|
@@ -6,6 +6,9 @@ A tolerant, incremental [Tree-sitter] grammar for Mermaid source. It provides st
|
|
|
6
6
|
syntax trees and editor queries for 37 public diagram families: the original 35-family Mermaid
|
|
7
7
|
11.16.1 syntax baseline, plus Agentflow and Usecase from Mermaid 12.0.0. The ZenUML integration
|
|
8
8
|
follows ZenUML Core 3.50.1.
|
|
9
|
+
Sequence actor-menu names (`link`, `links`, `properties`, and `details`) also work as message
|
|
10
|
+
endpoints, following the focused Mermaid 12.1.0 lexer fix without changing the other families'
|
|
11
|
+
syntax baseline.
|
|
9
12
|
|
|
10
13
|
Use this package for syntax highlighting, syntax-aware selection, folding, and other editor features
|
|
11
14
|
that must keep working while a document is incomplete. Use [`@mermanjs/web`] or the Merman Rust
|
|
@@ -26,12 +29,12 @@ The grammar has its own version line, independent of Merman. Its npm and Cargo a
|
|
|
26
29
|
grammar version, but their registry names differ: the npm package is scoped under `@mermanjs`, while
|
|
27
30
|
the Rust crate and C library retain the standard `tree-sitter-mermaid` name.
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
This guide documents `0.3.0`, including the Mermaid 12.1 sequence endpoint fix and updated generator/runtime contract. Match the examples to the version installed in your project; earlier versions have their own tagged documentation. Custom query consumers should review the [migration guide](https://github.com/Latias94/merman/blob/main/distribution/tree-sitter-mermaid/docs/query-migration.md).
|
|
30
33
|
|
|
31
34
|
## Node.js
|
|
32
35
|
|
|
33
36
|
```console
|
|
34
|
-
npm install tree-sitter@0.25.1 @mermanjs/tree-sitter-mermaid@0.
|
|
37
|
+
npm install tree-sitter@0.25.1 @mermanjs/tree-sitter-mermaid@0.3.0
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
With npm 12 or later, review and approve the native install scripts, then rebuild:
|
|
@@ -68,7 +71,7 @@ import Mermaid from '@mermanjs/tree-sitter-mermaid';
|
|
|
68
71
|
## Browser and Workers
|
|
69
72
|
|
|
70
73
|
```console
|
|
71
|
-
npm install web-tree-sitter@0.27.0 @mermanjs/tree-sitter-mermaid@0.
|
|
74
|
+
npm install web-tree-sitter@0.27.0 @mermanjs/tree-sitter-mermaid@0.3.0
|
|
72
75
|
```
|
|
73
76
|
|
|
74
77
|
The package exports `@mermanjs/tree-sitter-mermaid/tree-sitter-mermaid.wasm`. Copy that asset to a
|
|
@@ -89,7 +92,7 @@ A no-build browser prototype can pin the exact grammar version on jsDelivr:
|
|
|
89
92
|
|
|
90
93
|
```js
|
|
91
94
|
const language = await Language.load(
|
|
92
|
-
'https://cdn.jsdelivr.net/npm/@mermanjs/tree-sitter-mermaid@0.
|
|
95
|
+
'https://cdn.jsdelivr.net/npm/@mermanjs/tree-sitter-mermaid@0.3.0/tree-sitter-mermaid.wasm',
|
|
93
96
|
);
|
|
94
97
|
```
|
|
95
98
|
|
|
@@ -101,7 +104,7 @@ diagnostics, completion, navigation, and rename.
|
|
|
101
104
|
## Rust
|
|
102
105
|
|
|
103
106
|
```console
|
|
104
|
-
cargo add tree-sitter@=0.
|
|
107
|
+
cargo add tree-sitter@=0.27.0 tree-sitter-mermaid@=0.3.0
|
|
105
108
|
```
|
|
106
109
|
|
|
107
110
|
```rust
|
|
@@ -151,7 +154,7 @@ int main(void) {
|
|
|
151
154
|
| Agentflow and Usecase syntax | 12.0.0 |
|
|
152
155
|
| ZenUML Core syntax baseline | 3.50.1 |
|
|
153
156
|
| Tree-sitter language ABI | 15 |
|
|
154
|
-
| Tested Rust runtime | 0.
|
|
157
|
+
| Tested Rust runtime | 0.27.0 |
|
|
155
158
|
| Tested Web runtime | 0.27.0 |
|
|
156
159
|
| Native Node runtime contract | 0.25.x |
|
|
157
160
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -4,11 +4,18 @@ This source distribution derives syntax behavior or compatibility evidence from
|
|
|
4
4
|
MIT-licensed projects. The corresponding license texts are included below
|
|
5
5
|
`THIRD_PARTY_LICENSES/`.
|
|
6
6
|
|
|
7
|
-
## Tree-sitter 0.
|
|
7
|
+
## Tree-sitter 0.27.0 (generator and support headers)
|
|
8
|
+
|
|
9
|
+
- Source: https://github.com/tree-sitter/tree-sitter.git
|
|
10
|
+
- Commit: `6070dbfefd326bd735e5683eb128cc1b57dad0c0`
|
|
11
|
+
- Use: pinned generator and copied generated support headers
|
|
12
|
+
- License: `THIRD_PARTY_LICENSES/tree-sitter/LICENSE`
|
|
13
|
+
|
|
14
|
+
## Tree-sitter 0.26.12 (retained implementation templates)
|
|
8
15
|
|
|
9
16
|
- Source: https://github.com/tree-sitter/tree-sitter.git
|
|
10
17
|
- Commit: `808e4b1fc06e269a107c4bd8bd936cc6fde18b00`
|
|
11
|
-
- Use:
|
|
18
|
+
- Use: modified C, Rust, and Node binding templates and WASM build helper retained from the original implementation
|
|
12
19
|
- License: `THIRD_PARTY_LICENSES/tree-sitter/LICENSE`
|
|
13
20
|
|
|
14
21
|
## Mermaid 11.16.1
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Source translation: Mermaid 11.16.1
|
|
2
2
|
// packages/mermaid/src/diagrams/sequence/parser/sequenceDiagram.jison
|
|
3
3
|
// commit 7ecca0cd7f1658ef74f4e7e91f925724ef403bbf.
|
|
4
|
+
// Actor-menu keyword endpoints also follow Mermaid 12.1.0,
|
|
5
|
+
// commit 21f72f07ea22c0af48a3149c550654e80d8e40cb (same Jison source).
|
|
4
6
|
|
|
5
7
|
const diagramKeyword = ($) => field(
|
|
6
8
|
'keyword',
|
|
@@ -167,6 +169,7 @@ const sequenceRules = {
|
|
|
167
169
|
|
|
168
170
|
_sequence_actor_identifier: ($) => choice(
|
|
169
171
|
$._sequence_keyword_prefixed_actor_identifier,
|
|
172
|
+
$._sequence_actor_menu_keyword,
|
|
170
173
|
token(prec(30, choice(
|
|
171
174
|
// Reserve `-x` for cross arrows while retaining ordinary hyphenated ids.
|
|
172
175
|
/[A-Za-z0-9_\u00c0-\uffff](?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])*/,
|
|
@@ -175,12 +178,17 @@ const sequenceRules = {
|
|
|
175
178
|
))),
|
|
176
179
|
),
|
|
177
180
|
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
_sequence_keyword_prefixed_actor_identifier: (_) => token(prec(
|
|
181
|
-
|
|
182
|
-
/(?:
|
|
183
|
-
|
|
181
|
+
// Give longer actor ids priority over shorter keyword tokens. Keep bare
|
|
182
|
+
// `links` out of the `link` prefix branch so it remains a shared menu token.
|
|
183
|
+
_sequence_keyword_prefixed_actor_identifier: (_) => token(prec(50, choice(
|
|
184
|
+
/(?:loop|rect|opt|alt|else|par_over|par|and|critical|option|break|box|end)(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])+/i,
|
|
185
|
+
/(?:links|properties|details)(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])+/i,
|
|
186
|
+
/link(?:[A-RT-Za-rt-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])*/i,
|
|
187
|
+
))),
|
|
188
|
+
|
|
189
|
+
// Share the lexical token between metadata and endpoints. The following
|
|
190
|
+
// actor or arrow chooses the statement without consuming an endpoint as a directive.
|
|
191
|
+
_sequence_actor_menu_keyword: (_) => token(prec(40, /(?:links|link|properties|details)/i)),
|
|
184
192
|
|
|
185
193
|
sequence_participant_config: (_) => token(prec(30, /@\{[^}\r\n]*\}/)),
|
|
186
194
|
|
|
@@ -381,11 +389,9 @@ const sequenceRules = {
|
|
|
381
389
|
),
|
|
382
390
|
|
|
383
391
|
sequence_actor_metadata_statement: ($) => seq(
|
|
384
|
-
field('
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
statementKeyword($, /properties/i),
|
|
388
|
-
statementKeyword($, /details/i),
|
|
392
|
+
field('keyword', alias(
|
|
393
|
+
$._sequence_actor_menu_keyword,
|
|
394
|
+
$.sequence_statement_keyword,
|
|
389
395
|
)),
|
|
390
396
|
actorReference($, 'participant'),
|
|
391
397
|
field('delimiter', ':'),
|
|
@@ -513,12 +513,12 @@
|
|
|
513
513
|
],
|
|
514
514
|
"sources": [
|
|
515
515
|
{
|
|
516
|
-
"sourceId": "tree-sitter",
|
|
516
|
+
"sourceId": "tree-sitter-templates",
|
|
517
517
|
"relationship": "modified",
|
|
518
518
|
"sourcePaths": [
|
|
519
519
|
"crates/cli/src/templates/binding.gyp",
|
|
520
|
-
"crates/cli/src/templates/
|
|
521
|
-
"crates/cli/src/templates/
|
|
520
|
+
"crates/cli/src/templates/cmakelists.cmake",
|
|
521
|
+
"crates/cli/src/templates/makefile",
|
|
522
522
|
"crates/cli/src/templates/PARSER_NAME.pc.in",
|
|
523
523
|
"crates/cli/src/templates/PARSER_NAME.h",
|
|
524
524
|
"crates/cli/src/templates/js-binding.cc",
|
|
@@ -564,7 +564,7 @@
|
|
|
564
564
|
],
|
|
565
565
|
"sources": [
|
|
566
566
|
{
|
|
567
|
-
"sourceId": "tree-sitter",
|
|
567
|
+
"sourceId": "tree-sitter-templates",
|
|
568
568
|
"relationship": "modified",
|
|
569
569
|
"sourcePaths": [
|
|
570
570
|
"crates/loader/src/loader.rs:1290-1467"
|
package/metadata/provenance.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"package": {
|
|
4
4
|
"name": "tree-sitter-mermaid",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"releaseState": "candidate"
|
|
7
7
|
},
|
|
8
8
|
"language": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"querySchemaVersion": 1
|
|
13
13
|
},
|
|
14
14
|
"toolchain": {
|
|
15
|
-
"treeSitterCli": "0.
|
|
16
|
-
"rustRuntime": "0.
|
|
15
|
+
"treeSitterCli": "0.27.0",
|
|
16
|
+
"rustRuntime": "0.27.0",
|
|
17
17
|
"nodeRuntime": "0.25.1",
|
|
18
18
|
"webRuntime": "0.27.0",
|
|
19
19
|
"wasiSdk": "29.0",
|
|
@@ -30,14 +30,25 @@
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"id": "tree-sitter",
|
|
33
|
-
"kind": "generator-
|
|
33
|
+
"kind": "generator-source",
|
|
34
|
+
"version": "0.27.0",
|
|
35
|
+
"repository": "https://github.com/tree-sitter/tree-sitter.git",
|
|
36
|
+
"ref": "v0.27.0",
|
|
37
|
+
"commit": "6070dbfefd326bd735e5683eb128cc1b57dad0c0",
|
|
38
|
+
"usage": "Pinned generator and generated support headers",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"legalComponentId": "tree-sitter-generator"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "tree-sitter-templates",
|
|
44
|
+
"kind": "implementation-template-source",
|
|
34
45
|
"version": "0.26.12",
|
|
35
46
|
"repository": "https://github.com/tree-sitter/tree-sitter.git",
|
|
36
47
|
"ref": "v0.26.12",
|
|
37
48
|
"commit": "808e4b1fc06e269a107c4bd8bd936cc6fde18b00",
|
|
38
|
-
"usage": "
|
|
49
|
+
"usage": "Modified C, Rust, and Node binding templates and WASM build helper retained from the original implementation",
|
|
39
50
|
"license": "MIT",
|
|
40
|
-
"legalComponentId": "tree-sitter-
|
|
51
|
+
"legalComponentId": "tree-sitter-templates"
|
|
41
52
|
},
|
|
42
53
|
{
|
|
43
54
|
"id": "mermaid",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mermanjs/tree-sitter-mermaid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Tolerant Tree-sitter grammar and editor queries for Mermaid",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -80,15 +80,15 @@
|
|
|
80
80
|
"node-gyp-build": "4.8.4"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"node-gyp": "13.0.
|
|
83
|
+
"node-gyp": "13.0.2",
|
|
84
84
|
"prebuildify": "6.0.1",
|
|
85
85
|
"tree-sitter": "0.25.1",
|
|
86
|
-
"tree-sitter-cli": "0.
|
|
86
|
+
"tree-sitter-cli": "0.27.0",
|
|
87
87
|
"web-tree-sitter": "0.27.0"
|
|
88
88
|
},
|
|
89
89
|
"allowScripts": {
|
|
90
90
|
"tree-sitter@0.25.1": true,
|
|
91
|
-
"tree-sitter-cli@0.
|
|
91
|
+
"tree-sitter-cli@0.27.0": true
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"tree-sitter": "^0.25.0"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grammar.json
CHANGED
|
@@ -56824,6 +56824,10 @@
|
|
|
56824
56824
|
"type": "SYMBOL",
|
|
56825
56825
|
"name": "_sequence_keyword_prefixed_actor_identifier"
|
|
56826
56826
|
},
|
|
56827
|
+
{
|
|
56828
|
+
"type": "SYMBOL",
|
|
56829
|
+
"name": "_sequence_actor_menu_keyword"
|
|
56830
|
+
},
|
|
56827
56831
|
{
|
|
56828
56832
|
"type": "TOKEN",
|
|
56829
56833
|
"content": {
|
|
@@ -56851,9 +56855,36 @@
|
|
|
56851
56855
|
"content": {
|
|
56852
56856
|
"type": "PREC",
|
|
56853
56857
|
"value": 50,
|
|
56858
|
+
"content": {
|
|
56859
|
+
"type": "CHOICE",
|
|
56860
|
+
"members": [
|
|
56861
|
+
{
|
|
56862
|
+
"type": "PATTERN",
|
|
56863
|
+
"value": "(?:loop|rect|opt|alt|else|par_over|par|and|critical|option|break|box|end)(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])+",
|
|
56864
|
+
"flags": "i"
|
|
56865
|
+
},
|
|
56866
|
+
{
|
|
56867
|
+
"type": "PATTERN",
|
|
56868
|
+
"value": "(?:links|properties|details)(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])+",
|
|
56869
|
+
"flags": "i"
|
|
56870
|
+
},
|
|
56871
|
+
{
|
|
56872
|
+
"type": "PATTERN",
|
|
56873
|
+
"value": "link(?:[A-RT-Za-rt-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])*",
|
|
56874
|
+
"flags": "i"
|
|
56875
|
+
}
|
|
56876
|
+
]
|
|
56877
|
+
}
|
|
56878
|
+
}
|
|
56879
|
+
},
|
|
56880
|
+
"_sequence_actor_menu_keyword": {
|
|
56881
|
+
"type": "TOKEN",
|
|
56882
|
+
"content": {
|
|
56883
|
+
"type": "PREC",
|
|
56884
|
+
"value": 40,
|
|
56854
56885
|
"content": {
|
|
56855
56886
|
"type": "PATTERN",
|
|
56856
|
-
"value": "(?:
|
|
56887
|
+
"value": "(?:links|link|properties|details)",
|
|
56857
56888
|
"flags": "i"
|
|
56858
56889
|
}
|
|
56859
56890
|
}
|
|
@@ -58917,95 +58948,15 @@
|
|
|
58917
58948
|
"members": [
|
|
58918
58949
|
{
|
|
58919
58950
|
"type": "FIELD",
|
|
58920
|
-
"name": "
|
|
58951
|
+
"name": "keyword",
|
|
58921
58952
|
"content": {
|
|
58922
|
-
"type": "
|
|
58923
|
-
"
|
|
58924
|
-
|
|
58925
|
-
|
|
58926
|
-
|
|
58927
|
-
|
|
58928
|
-
|
|
58929
|
-
"content": {
|
|
58930
|
-
"type": "TOKEN",
|
|
58931
|
-
"content": {
|
|
58932
|
-
"type": "PREC",
|
|
58933
|
-
"value": 40,
|
|
58934
|
-
"content": {
|
|
58935
|
-
"type": "PATTERN",
|
|
58936
|
-
"value": "links",
|
|
58937
|
-
"flags": "i"
|
|
58938
|
-
}
|
|
58939
|
-
}
|
|
58940
|
-
},
|
|
58941
|
-
"named": true,
|
|
58942
|
-
"value": "sequence_statement_keyword"
|
|
58943
|
-
}
|
|
58944
|
-
},
|
|
58945
|
-
{
|
|
58946
|
-
"type": "FIELD",
|
|
58947
|
-
"name": "keyword",
|
|
58948
|
-
"content": {
|
|
58949
|
-
"type": "ALIAS",
|
|
58950
|
-
"content": {
|
|
58951
|
-
"type": "TOKEN",
|
|
58952
|
-
"content": {
|
|
58953
|
-
"type": "PREC",
|
|
58954
|
-
"value": 40,
|
|
58955
|
-
"content": {
|
|
58956
|
-
"type": "PATTERN",
|
|
58957
|
-
"value": "link",
|
|
58958
|
-
"flags": "i"
|
|
58959
|
-
}
|
|
58960
|
-
}
|
|
58961
|
-
},
|
|
58962
|
-
"named": true,
|
|
58963
|
-
"value": "sequence_statement_keyword"
|
|
58964
|
-
}
|
|
58965
|
-
},
|
|
58966
|
-
{
|
|
58967
|
-
"type": "FIELD",
|
|
58968
|
-
"name": "keyword",
|
|
58969
|
-
"content": {
|
|
58970
|
-
"type": "ALIAS",
|
|
58971
|
-
"content": {
|
|
58972
|
-
"type": "TOKEN",
|
|
58973
|
-
"content": {
|
|
58974
|
-
"type": "PREC",
|
|
58975
|
-
"value": 40,
|
|
58976
|
-
"content": {
|
|
58977
|
-
"type": "PATTERN",
|
|
58978
|
-
"value": "properties",
|
|
58979
|
-
"flags": "i"
|
|
58980
|
-
}
|
|
58981
|
-
}
|
|
58982
|
-
},
|
|
58983
|
-
"named": true,
|
|
58984
|
-
"value": "sequence_statement_keyword"
|
|
58985
|
-
}
|
|
58986
|
-
},
|
|
58987
|
-
{
|
|
58988
|
-
"type": "FIELD",
|
|
58989
|
-
"name": "keyword",
|
|
58990
|
-
"content": {
|
|
58991
|
-
"type": "ALIAS",
|
|
58992
|
-
"content": {
|
|
58993
|
-
"type": "TOKEN",
|
|
58994
|
-
"content": {
|
|
58995
|
-
"type": "PREC",
|
|
58996
|
-
"value": 40,
|
|
58997
|
-
"content": {
|
|
58998
|
-
"type": "PATTERN",
|
|
58999
|
-
"value": "details",
|
|
59000
|
-
"flags": "i"
|
|
59001
|
-
}
|
|
59002
|
-
}
|
|
59003
|
-
},
|
|
59004
|
-
"named": true,
|
|
59005
|
-
"value": "sequence_statement_keyword"
|
|
59006
|
-
}
|
|
59007
|
-
}
|
|
59008
|
-
]
|
|
58953
|
+
"type": "ALIAS",
|
|
58954
|
+
"content": {
|
|
58955
|
+
"type": "SYMBOL",
|
|
58956
|
+
"name": "_sequence_actor_menu_keyword"
|
|
58957
|
+
},
|
|
58958
|
+
"named": true,
|
|
58959
|
+
"value": "sequence_statement_keyword"
|
|
59009
58960
|
}
|
|
59010
58961
|
},
|
|
59011
58962
|
{
|