fabro/apps/fabro-web/app/data/dot-grammar.ts
Bryan Helmkamp 21aff5431c Update docs, frontend, marketing, and skills for .fabro extension
Update 47 MDX doc pages, OpenAPI spec, SVG diagram, language
grammar, frontend demo data, marketing page, skills, and README
to use .fabro extension. Add "fabro" to fileTypes in language
grammars. Document stack.child_workflow alongside stack.child_dotfile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 22:38:25 -04:00

106 lines
3.5 KiB
TypeScript

import type { LanguageRegistration } from "@pierre/diffs";
export const dotLanguage: LanguageRegistration = {
name: "dot",
scopeName: "source.dot",
fileTypes: ["fabro", "dot", "DOT", "gv"],
firstLineMatch: "digraph.*",
patterns: [
{
match: " ?(digraph)[ \\t]+([A-Za-z0-9]+) ?(\\{)",
captures: {
"1": { name: "storage.type.dot" },
"2": { name: "variable.other.dot" },
"3": { name: "punctuation.section.dot" },
},
},
{
match: "(<|-)(>|-)",
name: "keyword.operator.dot",
},
{
match: "\\b(node|edge|graph|digraph|subgraph|strict)\\b",
name: "storage.type.dot",
},
{
match:
"\\b(bottomlabel|color|comment|distortion|fillcolor|fixedsize|fontcolor|fontname|fontsize|group|height|label|layer|orientation|peripheries|regular|shape|shapefile|sides|skew|style|toplabel|URL|width|z)\\b",
name: "support.constant.attribute.node.dot",
},
{
match:
"\\b(arrowhead|arrowsize|arrowtail|color|comment|constraint|decorate|dir|fontcolor|fontname|fontsize|headlabel|headport|headURL|label|labelangle|labeldistance|labelfloat|labelcolor|labelfontname|labelfontsize|layer|lhead|ltail|minlen|samehead|sametail|splines|style|taillabel|tailport|tailURL|weight)\\b",
name: "support.constant.attribute.edge.dot",
},
{
match:
"\\b(bgcolor|center|clusterrank|color|comment|compound|concentrate|fillcolor|fontname|fontpath|fontsize|label|labeljust|labelloc|layers|margin|mclimit|nodesep|nslimit|nslimit1|ordering|orientation|page|pagedir|quantum|rank|rankdir|ranksep|ratio|remincross|rotate|samplepoints|searchsize|size|style|URL)\\b",
name: "support.constant.attribute.graph.dot",
},
{
match:
"\\b(box|polygon|ellipse|circle|point|egg|triangle|plaintext|diamond|trapezium|parallelogram|house|pentagon|hexagon|septagon|octagon|doublecircle|doubleoctagon|tripleoctagon|invtriangle|invtrapezium|invhouse|Mdiamond|Msquare|Mcircle|rect|rectangle|none|note|tab|folder|box3d|component|max|min|same)\\b",
name: "variable.other.dot",
},
{
begin: '"',
beginCaptures: {
"0": { name: "punctuation.definition.string.begin.dot" },
},
end: '"',
endCaptures: {
"0": { name: "punctuation.definition.string.end.dot" },
},
name: "string.quoted.double.dot",
patterns: [
{
match: "\\\\.",
name: "constant.character.escape.dot",
},
],
},
{
begin: "(^[ \\t]+)?(?=//)",
beginCaptures: {
"1": { name: "punctuation.whitespace.comment.leading.dot" },
},
end: "(?!\\G)",
patterns: [
{
begin: "//",
beginCaptures: {
"0": { name: "punctuation.definition.comment.dot" },
},
end: "\\n",
name: "comment.line.double-slash.dot",
},
],
},
{
begin: "(^[ \\t]+)?(?=#)",
beginCaptures: {
"1": { name: "punctuation.whitespace.comment.leading.dot" },
},
end: "(?!\\G)",
patterns: [
{
begin: "#",
beginCaptures: {
"0": { name: "punctuation.definition.comment.dot" },
},
end: "\\n",
name: "comment.line.number-sign.dot",
},
],
},
{
begin: "/\\*",
captures: {
"0": { name: "punctuation.definition.comment.dot" },
},
end: "\\*/",
name: "comment.block.dot",
},
],
repository: {},
};