@mermanjs/tree-sitter-mermaid 0.1.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 +44 -0
- package/LICENSE +22 -0
- package/Makefile +80 -0
- package/README.md +201 -0
- package/THIRD_PARTY_LICENSES/mermaid/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/monaqa-tree-sitter-mermaid/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/pappasam-tree-sitter-mermaid/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/singularity-tree-sitter-mermaid/LICENSE +22 -0
- package/THIRD_PARTY_LICENSES/tree-sitter/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/zenuml-core/LICENSE +21 -0
- package/THIRD_PARTY_NOTICES.md +47 -0
- package/binding.gyp +56 -0
- package/bindings/c/tree-sitter-mermaid.pc.in +10 -0
- package/bindings/c/tree_sitter/tree-sitter-mermaid.h +16 -0
- package/bindings/node/binding.cc +25 -0
- package/bindings/node/index.d.ts +5 -0
- package/bindings/node/index.js +10 -0
- package/grammar/families/architecture.js +361 -0
- package/grammar/families/block.js +370 -0
- package/grammar/families/c4.js +394 -0
- package/grammar/families/class.js +441 -0
- package/grammar/families/cynefin.js +127 -0
- package/grammar/families/entity-relationship.js +408 -0
- package/grammar/families/event-modeling.js +307 -0
- package/grammar/families/flowchart.js +690 -0
- package/grammar/families/gantt.js +445 -0
- package/grammar/families/git-graph.js +326 -0
- package/grammar/families/info.js +77 -0
- package/grammar/families/ishikawa.js +103 -0
- package/grammar/families/journey.js +221 -0
- package/grammar/families/kanban.js +264 -0
- package/grammar/families/mindmap.js +221 -0
- package/grammar/families/packet.js +108 -0
- package/grammar/families/pie.js +118 -0
- package/grammar/families/quadrant-chart.js +385 -0
- package/grammar/families/radar.js +286 -0
- package/grammar/families/railroad-abnf.js +124 -0
- package/grammar/families/railroad-ebnf.js +179 -0
- package/grammar/families/railroad-peg.js +128 -0
- package/grammar/families/railroad-shared.js +114 -0
- package/grammar/families/railroad.js +143 -0
- package/grammar/families/requirement.js +475 -0
- package/grammar/families/sankey.js +139 -0
- package/grammar/families/sequence.js +437 -0
- package/grammar/families/state.js +400 -0
- package/grammar/families/swimlane.js +25 -0
- package/grammar/families/timeline.js +251 -0
- package/grammar/families/tree-view.js +189 -0
- package/grammar/families/treemap.js +146 -0
- package/grammar/families/venn.js +256 -0
- package/grammar/families/wardley.js +530 -0
- package/grammar/families/xy-chart.js +460 -0
- package/grammar/families/zenuml.js +725 -0
- package/grammar/shared/common.js +78 -0
- package/grammar/shared/header.js +16 -0
- package/grammar/shared/indentation.js +22 -0
- package/grammar/shared/langium.js +166 -0
- package/grammar/shared/preamble.js +26 -0
- package/grammar.js +188 -0
- package/metadata/derivations.json +519 -0
- package/metadata/provenance.json +98 -0
- package/package.json +107 -0
- 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/queries/helix/highlights.scm +960 -0
- package/queries/helix/indents.scm +45 -0
- package/queries/helix/injections.scm +15 -0
- package/queries/helix/locals.scm +134 -0
- package/queries/helix/textobjects.scm +264 -0
- package/queries/neovim/README.md +28 -0
- package/queries/neovim/brackets.scm +65 -0
- package/queries/neovim/folds.scm +53 -0
- package/queries/neovim/highlights.scm +121 -0
- package/queries/neovim/indents.scm +110 -0
- package/queries/neovim/injections.scm +86 -0
- package/queries/neovim/locals.scm +277 -0
- package/queries/neovim/outline.scm +117 -0
- package/queries/neovim/tags.scm +149 -0
- package/queries/neovim/textobjects.scm +97 -0
- package/queries/portable/highlights.scm +961 -0
- package/queries/portable/injections.scm +45 -0
- package/queries/portable/locals.scm +290 -0
- package/queries/portable/tags.scm +182 -0
- package/queries/zed/README.md +48 -0
- package/queries/zed/brackets.scm +111 -0
- package/queries/zed/highlights.scm +961 -0
- package/queries/zed/indents.scm +111 -0
- package/queries/zed/injections.scm +11 -0
- package/queries/zed/outline.scm +167 -0
- package/queries/zed/textobjects.scm +68 -0
- package/src/grammar.json +71138 -0
- package/src/node-types.json +34871 -0
- package/src/parser.c +321353 -0
- package/src/scanner.c +462 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +336 -0
- package/src/tree_sitter/parser.h +286 -0
- package/tree-sitter-mermaid.wasm +0 -0
- package/tree-sitter.json +40 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
; Zed auto-indentation profile. @indent is required by Zed; @end aligns
|
|
2
|
+
; closing delimiters and family-owned block terminators with their opener.
|
|
3
|
+
|
|
4
|
+
; Anonymous delimiters are attached to explicit CST owners. This avoids
|
|
5
|
+
; double-indenting nodes such as C4 boundaries that contain both a call
|
|
6
|
+
; argument list and a block body.
|
|
7
|
+
[
|
|
8
|
+
(architecture_icon ")" @end)
|
|
9
|
+
(c4_entity_declaration ")" @end)
|
|
10
|
+
(c4_relationship_statement ")" @end)
|
|
11
|
+
(c4_style_update_statement ")" @end)
|
|
12
|
+
(class_call_action ")" @end)
|
|
13
|
+
(gantt_call_action ")" @end)
|
|
14
|
+
(railroad_sequence ")" @end)
|
|
15
|
+
(railroad_terminal ")" @end)
|
|
16
|
+
(railroad_reference ")" @end)
|
|
17
|
+
(railroad_repetition ")" @end)
|
|
18
|
+
(railroad_special ")" @end)
|
|
19
|
+
(railroad_peg_group ")" @end)
|
|
20
|
+
(wardley_strategy_decorator ")" @end)
|
|
21
|
+
(zenuml_starter_declaration ")" @end)
|
|
22
|
+
(zenuml_argument_list ")" @end)
|
|
23
|
+
(zenuml_condition_clause ")" @end)
|
|
24
|
+
] @indent
|
|
25
|
+
|
|
26
|
+
[
|
|
27
|
+
(architecture_title "]" @end)
|
|
28
|
+
(er_entity_alias "]" @end)
|
|
29
|
+
(quadrant_chart_coordinates "]" @end)
|
|
30
|
+
(radar_label "]" @end)
|
|
31
|
+
(railroad_abnf_optional_group "]" @end)
|
|
32
|
+
(railroad_ebnf_optional_group "]" @end)
|
|
33
|
+
(wardley_position "]" @end)
|
|
34
|
+
] @indent
|
|
35
|
+
|
|
36
|
+
[
|
|
37
|
+
(c4_boundary_statement "}" @end)
|
|
38
|
+
(class_namespace_declaration "}" @end)
|
|
39
|
+
(class_member_block "}" @end)
|
|
40
|
+
(er_attribute_block "}" @end)
|
|
41
|
+
(event_data_block "}" @end)
|
|
42
|
+
(event_nested_data_block "}" @end)
|
|
43
|
+
(radar_curve_entries "}" @end)
|
|
44
|
+
(railroad_ebnf_repetition_group "}" @end)
|
|
45
|
+
(requirement_declaration "}" @end)
|
|
46
|
+
(requirement_element_declaration "}" @end)
|
|
47
|
+
(state_composite_declaration "}" @end)
|
|
48
|
+
(zenuml_block "}" @end)
|
|
49
|
+
] @indent
|
|
50
|
+
|
|
51
|
+
(_
|
|
52
|
+
open: (block_shape_delimiter)
|
|
53
|
+
close: (block_shape_delimiter) @end) @indent
|
|
54
|
+
|
|
55
|
+
(_
|
|
56
|
+
open: (flow_shape_delimiter)
|
|
57
|
+
close: (flow_shape_delimiter) @end) @indent
|
|
58
|
+
|
|
59
|
+
(_
|
|
60
|
+
open: (swimlane_shape_delimiter)
|
|
61
|
+
close: (swimlane_shape_delimiter) @end) @indent
|
|
62
|
+
|
|
63
|
+
(_
|
|
64
|
+
open: (mindmap_shape_delimiter)
|
|
65
|
+
close: (mindmap_shape_delimiter) @end) @indent
|
|
66
|
+
|
|
67
|
+
(_
|
|
68
|
+
open: (kanban_shape_delimiter)
|
|
69
|
+
close: (kanban_shape_delimiter) @end) @indent
|
|
70
|
+
|
|
71
|
+
(_
|
|
72
|
+
open: (kanban_metadata_delimiter)
|
|
73
|
+
close: (kanban_metadata_delimiter) @end) @indent
|
|
74
|
+
|
|
75
|
+
[
|
|
76
|
+
(xy_chart_category_array
|
|
77
|
+
close: (xy_chart_array_close) @end)
|
|
78
|
+
(xy_chart_series_array
|
|
79
|
+
close: (xy_chart_array_close) @end)
|
|
80
|
+
] @indent
|
|
81
|
+
|
|
82
|
+
(block_composite_statement
|
|
83
|
+
end: (block_end) @end) @indent
|
|
84
|
+
|
|
85
|
+
(flow_subgraph
|
|
86
|
+
end: (flow_subgraph_end) @end) @indent
|
|
87
|
+
|
|
88
|
+
(swimlane_subgraph
|
|
89
|
+
end: (swimlane_subgraph_end) @end) @indent
|
|
90
|
+
|
|
91
|
+
[
|
|
92
|
+
(sequence_alt_block
|
|
93
|
+
end: (sequence_block_end) @end)
|
|
94
|
+
(sequence_box_block
|
|
95
|
+
end: (sequence_block_end) @end)
|
|
96
|
+
(sequence_break_block
|
|
97
|
+
end: (sequence_block_end) @end)
|
|
98
|
+
(sequence_critical_block
|
|
99
|
+
end: (sequence_block_end) @end)
|
|
100
|
+
(sequence_loop_block
|
|
101
|
+
end: (sequence_block_end) @end)
|
|
102
|
+
(sequence_opt_block
|
|
103
|
+
end: (sequence_block_end) @end)
|
|
104
|
+
(sequence_par_block
|
|
105
|
+
end: (sequence_block_end) @end)
|
|
106
|
+
(sequence_rect_block
|
|
107
|
+
end: (sequence_block_end) @end)
|
|
108
|
+
] @indent
|
|
109
|
+
|
|
110
|
+
(state_multiline_note
|
|
111
|
+
end: (state_note_end) @end) @indent
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
; Zed injection profile. Host Markdown grammars own Mermaid fence injection;
|
|
2
|
+
; this query only exposes embedded payloads inside a Mermaid source file.
|
|
3
|
+
|
|
4
|
+
((frontmatter) @injection.content
|
|
5
|
+
(#set! injection.language "yaml"))
|
|
6
|
+
|
|
7
|
+
([
|
|
8
|
+
(xy_chart_markdown_content)
|
|
9
|
+
(xy_chart_markdown_backtick_content)
|
|
10
|
+
] @injection.content
|
|
11
|
+
(#set! injection.language "markdown-inline"))
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
; Zed outline profile. Every family contributes its diagram root, while
|
|
2
|
+
; declaration-bearing families expose stable nested items when the CST has a
|
|
3
|
+
; source-owned name field.
|
|
4
|
+
|
|
5
|
+
(_
|
|
6
|
+
header: (_
|
|
7
|
+
(diagram_keyword) @name)) @item
|
|
8
|
+
|
|
9
|
+
(architecture_group_statement
|
|
10
|
+
id: (architecture_identifier) @name) @item
|
|
11
|
+
|
|
12
|
+
[
|
|
13
|
+
(architecture_service_statement
|
|
14
|
+
id: (architecture_identifier) @name)
|
|
15
|
+
(architecture_junction_statement
|
|
16
|
+
id: (architecture_identifier) @name)
|
|
17
|
+
] @item
|
|
18
|
+
|
|
19
|
+
(block_node_statement
|
|
20
|
+
node: (block_node
|
|
21
|
+
id: (block_identifier) @name)) @item
|
|
22
|
+
|
|
23
|
+
[
|
|
24
|
+
(c4_entity_declaration
|
|
25
|
+
id: (c4_reference) @name)
|
|
26
|
+
(c4_boundary_statement
|
|
27
|
+
id: (c4_reference) @name)
|
|
28
|
+
] @item
|
|
29
|
+
|
|
30
|
+
(class_definition_statement
|
|
31
|
+
name: (class_style_name) @name) @item
|
|
32
|
+
|
|
33
|
+
(er_entity_declaration
|
|
34
|
+
name: (er_entity_name) @name) @item
|
|
35
|
+
|
|
36
|
+
[
|
|
37
|
+
(event_entity_statement
|
|
38
|
+
name: (event_qualified_name) @name)
|
|
39
|
+
(event_data_statement
|
|
40
|
+
name: (event_data_name) @name)
|
|
41
|
+
(event_frame_statement
|
|
42
|
+
frame: (event_frame_id) @name)
|
|
43
|
+
] @item
|
|
44
|
+
|
|
45
|
+
(flow_vertex
|
|
46
|
+
id: (flow_node_id) @name) @item
|
|
47
|
+
|
|
48
|
+
(flow_subgraph
|
|
49
|
+
id: (flow_node_id) @name) @item
|
|
50
|
+
|
|
51
|
+
[
|
|
52
|
+
(gantt_section_statement
|
|
53
|
+
name: (gantt_line_text) @name)
|
|
54
|
+
(gantt_task_statement
|
|
55
|
+
name: (gantt_task_name) @name)
|
|
56
|
+
] @item
|
|
57
|
+
|
|
58
|
+
(git_graph_branch_statement
|
|
59
|
+
name: (_) @name) @item
|
|
60
|
+
|
|
61
|
+
[
|
|
62
|
+
(ishikawa_effect_statement
|
|
63
|
+
label: (ishikawa_label) @name)
|
|
64
|
+
(ishikawa_cause_statement
|
|
65
|
+
label: (ishikawa_label) @name)
|
|
66
|
+
] @item
|
|
67
|
+
|
|
68
|
+
[
|
|
69
|
+
(journey_section_statement
|
|
70
|
+
section: (journey_section_name) @name)
|
|
71
|
+
(journey_task_statement
|
|
72
|
+
task: (journey_task_name) @name)
|
|
73
|
+
] @item
|
|
74
|
+
|
|
75
|
+
(kanban_item_statement
|
|
76
|
+
item: (kanban_item
|
|
77
|
+
[
|
|
78
|
+
id: (kanban_item_id) @name
|
|
79
|
+
label: (kanban_plain_label) @name
|
|
80
|
+
])) @item
|
|
81
|
+
|
|
82
|
+
(mindmap_node_statement
|
|
83
|
+
node: (mindmap_node
|
|
84
|
+
[
|
|
85
|
+
id: (mindmap_node_id) @name
|
|
86
|
+
label: (mindmap_plain_label) @name
|
|
87
|
+
])) @item
|
|
88
|
+
|
|
89
|
+
(packet_block_statement
|
|
90
|
+
label: (_) @name) @item
|
|
91
|
+
|
|
92
|
+
(pie_section
|
|
93
|
+
label: (_) @name) @item
|
|
94
|
+
|
|
95
|
+
(quadrant_chart_point_statement
|
|
96
|
+
label: (quadrant_chart_point_label) @name) @item
|
|
97
|
+
|
|
98
|
+
[
|
|
99
|
+
(radar_axis
|
|
100
|
+
name: (radar_identifier) @name)
|
|
101
|
+
(radar_curve
|
|
102
|
+
name: (radar_identifier) @name)
|
|
103
|
+
] @item
|
|
104
|
+
|
|
105
|
+
[
|
|
106
|
+
(railroad_rule
|
|
107
|
+
name: (railroad_identifier) @name)
|
|
108
|
+
(railroad_abnf_rule
|
|
109
|
+
name: (railroad_abnf_rule_name) @name)
|
|
110
|
+
(railroad_ebnf_rule
|
|
111
|
+
name: (railroad_ebnf_identifier) @name)
|
|
112
|
+
(railroad_peg_rule
|
|
113
|
+
name: (railroad_peg_identifier) @name)
|
|
114
|
+
] @item
|
|
115
|
+
|
|
116
|
+
[
|
|
117
|
+
(requirement_declaration
|
|
118
|
+
name: (requirement_name) @name)
|
|
119
|
+
(requirement_element_declaration
|
|
120
|
+
name: (requirement_name) @name)
|
|
121
|
+
] @item
|
|
122
|
+
|
|
123
|
+
(sequence_participant_declaration
|
|
124
|
+
name: (sequence_participant_name) @name) @item
|
|
125
|
+
|
|
126
|
+
[
|
|
127
|
+
(state_alias_declaration
|
|
128
|
+
alias: (state_alias_clause
|
|
129
|
+
name: (state_name) @name))
|
|
130
|
+
(state_named_declaration
|
|
131
|
+
name: (state_name) @name)
|
|
132
|
+
(state_composite_declaration
|
|
133
|
+
name: (state_name) @name)
|
|
134
|
+
(state_pseudostate_declaration
|
|
135
|
+
name: (state_name) @name)
|
|
136
|
+
] @item
|
|
137
|
+
|
|
138
|
+
(swimlane_vertex
|
|
139
|
+
id: (swimlane_node_id) @name) @item
|
|
140
|
+
|
|
141
|
+
(swimlane_subgraph
|
|
142
|
+
id: (swimlane_node_id) @name) @item
|
|
143
|
+
|
|
144
|
+
(timeline_section_statement
|
|
145
|
+
name: (timeline_section_name) @name) @item
|
|
146
|
+
|
|
147
|
+
(tree_view_node
|
|
148
|
+
name: (_) @name) @item
|
|
149
|
+
|
|
150
|
+
(treemap_section
|
|
151
|
+
name: (_) @name) @item
|
|
152
|
+
|
|
153
|
+
(venn_set_statement
|
|
154
|
+
expression: (venn_set_expression) @name) @item
|
|
155
|
+
|
|
156
|
+
(wardley_component_statement
|
|
157
|
+
name: (wardley_name) @name) @item
|
|
158
|
+
|
|
159
|
+
[
|
|
160
|
+
(xy_chart_bar_statement
|
|
161
|
+
title: (xy_chart_text) @name)
|
|
162
|
+
(xy_chart_line_statement
|
|
163
|
+
title: (xy_chart_text) @name)
|
|
164
|
+
] @item
|
|
165
|
+
|
|
166
|
+
(zenuml_participant_declaration
|
|
167
|
+
name: (zenuml_name) @name) @item
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
; Zed Vim text objects. A Mermaid diagram is the large section; named
|
|
2
|
+
; declarations and control blocks are function-sized sections.
|
|
3
|
+
|
|
4
|
+
(_
|
|
5
|
+
header: (_
|
|
6
|
+
(diagram_keyword))
|
|
7
|
+
body: (_) @class.inside) @class.around
|
|
8
|
+
|
|
9
|
+
[
|
|
10
|
+
(architecture_group_statement)
|
|
11
|
+
(architecture_service_statement)
|
|
12
|
+
(block_composite_statement)
|
|
13
|
+
(block_node_statement)
|
|
14
|
+
(c4_boundary_statement)
|
|
15
|
+
(c4_entity_declaration)
|
|
16
|
+
(class_declaration)
|
|
17
|
+
(er_entity_declaration)
|
|
18
|
+
(event_data_statement)
|
|
19
|
+
(event_frame_statement)
|
|
20
|
+
(flow_subgraph)
|
|
21
|
+
(flow_node_statement)
|
|
22
|
+
(gantt_section_statement)
|
|
23
|
+
(gantt_task_statement)
|
|
24
|
+
(git_graph_branch_statement)
|
|
25
|
+
(ishikawa_cause_statement)
|
|
26
|
+
(ishikawa_effect_statement)
|
|
27
|
+
(journey_section_statement)
|
|
28
|
+
(journey_task_statement)
|
|
29
|
+
(kanban_item_statement)
|
|
30
|
+
(mindmap_node_statement)
|
|
31
|
+
(packet_block_statement)
|
|
32
|
+
(pie_section)
|
|
33
|
+
(quadrant_chart_point_statement)
|
|
34
|
+
(radar_axis_statement)
|
|
35
|
+
(radar_curve_statement)
|
|
36
|
+
(railroad_rule)
|
|
37
|
+
(railroad_abnf_rule)
|
|
38
|
+
(railroad_ebnf_rule)
|
|
39
|
+
(railroad_peg_rule)
|
|
40
|
+
(requirement_declaration)
|
|
41
|
+
(requirement_element_declaration)
|
|
42
|
+
(sequence_alt_block)
|
|
43
|
+
(sequence_box_block)
|
|
44
|
+
(sequence_break_block)
|
|
45
|
+
(sequence_critical_block)
|
|
46
|
+
(sequence_loop_block)
|
|
47
|
+
(sequence_opt_block)
|
|
48
|
+
(sequence_par_block)
|
|
49
|
+
(sequence_rect_block)
|
|
50
|
+
(sequence_participant_declaration)
|
|
51
|
+
(state_composite_declaration)
|
|
52
|
+
(state_named_declaration)
|
|
53
|
+
(swimlane_subgraph)
|
|
54
|
+
(swimlane_node_statement)
|
|
55
|
+
(timeline_section_statement)
|
|
56
|
+
(timeline_event_statement)
|
|
57
|
+
(tree_view_node_statement)
|
|
58
|
+
(treemap_item_statement)
|
|
59
|
+
(venn_set_statement)
|
|
60
|
+
(wardley_component_statement)
|
|
61
|
+
(xy_chart_bar_statement)
|
|
62
|
+
(xy_chart_line_statement)
|
|
63
|
+
(zenuml_participant_declaration)
|
|
64
|
+
(zenuml_section_statement)
|
|
65
|
+
(zenuml_sync_message_statement)
|
|
66
|
+
] @function.around
|
|
67
|
+
|
|
68
|
+
(comment)+ @comment.around
|