Added support for DOT (#2690)

This commit is contained in:
Michael Schmidt 2021-01-17 14:29:35 +01:00 committed by GitHub
parent 4e7b2a82d7
commit 1f91868e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 412 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -322,6 +322,12 @@
"alias": "dockerfile",
"owner": "JustinBeckwith"
},
"dot": {
"title": "DOT (Graphviz)",
"alias": "gv",
"optional": "markup",
"owner": "RunDevelopment"
},
"ebnf": {
"title": "EBNF",
"owner": "RunDevelopment"

77
components/prism-dot.js Normal file
View File

@ -0,0 +1,77 @@
// https://www.graphviz.org/doc/info/lang.html
(function (Prism) {
var ID = '(?:' + [
// an identifier
/[a-zA-Z_\x80-\uFFFF][\w\x80-\uFFFF]*/.source,
// a number
/-?(?:\.\d+|\d+(?:\.\d*)?)/.source,
// a double-quoted string
/"[^"\\]*(?:\\[\s\S][^"\\]*)*"/.source,
// HTML-like string
/<(?:[^<>]|(?!<!--)<(?:[^<>"']|"[^"]*"|'[^']*')+>|<!--(?:[^-]|-(?!->))*-->)*>/.source
].join('|') + ')';
var IDInside = {
'markup': {
pattern: /(^<)[\s\S]+(?=>$)/,
lookbehind: true,
alias: ['language-markup', 'language-html', 'language-xml'],
inside: Prism.languages.markup
}
};
/**
* @param {string} source
* @param {string} flags
* @returns {RegExp}
*/
function withID(source, flags) {
return RegExp(source.replace(/<ID>/g, function () { return ID; }), flags);
}
Prism.languages.dot = {
'comment': {
pattern: /\/\/.*|\/\*[\s\S]*?\*\/|^#.*/m,
greedy: true
},
'graph-name': {
pattern: withID(/(\b(?:digraph|graph|subgraph)[ \t\r\n]+)<ID>/.source, 'i'),
lookbehind: true,
greedy: true,
alias: 'class-name',
inside: IDInside
},
'attr-value': {
pattern: withID(/(=[ \t\r\n]*)<ID>/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
'attr-name': {
pattern: withID(/([\[;, \t\r\n])<ID>(?=[ \t\r\n]*=)/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
'keyword': /\b(?:digraph|edge|graph|node|strict|subgraph)\b/i,
'compass-point': {
pattern: /(:[ \t\r\n]*)(?:[ns][ew]?|[ewc_])(?![\w\x80-\uFFFF])/,
lookbehind: true,
alias: 'builtin'
},
'node': {
pattern: withID(/(^|[^-.\w\x80-\uFFFF\\])<ID>/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
'operator': /[=:]|-[->]/,
'punctuation': /[\[\]{};,]/
};
Prism.languages.gv = Prism.languages.dot;
}(Prism));

1
components/prism-dot.min.js vendored Normal file
View File

@ -0,0 +1 @@
!function(e){var n="(?:"+["[a-zA-Z_\\x80-\\uFFFF][\\w\\x80-\\uFFFF]*","-?(?:\\.\\d+|\\d+(?:\\.\\d*)?)",'"[^"\\\\]*(?:\\\\[^][^"\\\\]*)*"',"<(?:[^<>]|(?!\x3c!--)<(?:[^<>\"']|\"[^\"]*\"|'[^']*')+>|\x3c!--(?:[^-]|-(?!->))*--\x3e)*>"].join("|")+")",a={markup:{pattern:/(^<)[\s\S]+(?=>$)/,lookbehind:!0,alias:["language-markup","language-html","language-xml"],inside:e.languages.markup}};function r(e,a){return RegExp(e.replace(/<ID>/g,function(){return n}),a)}e.languages.dot={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\/|^#.*/m,greedy:!0},"graph-name":{pattern:r("(\\b(?:digraph|graph|subgraph)[ \t\r\n]+)<ID>","i"),lookbehind:!0,greedy:!0,alias:"class-name",inside:a},"attr-value":{pattern:r("(=[ \t\r\n]*)<ID>"),lookbehind:!0,greedy:!0,inside:a},"attr-name":{pattern:r("([\\[;, \t\r\n])<ID>(?=[ \t\r\n]*=)"),lookbehind:!0,greedy:!0,inside:a},keyword:/\b(?:digraph|edge|graph|node|strict|subgraph)\b/i,"compass-point":{pattern:/(:[ \t\r\n]*)(?:[ns][ew]?|[ewc_])(?![\w\x80-\uFFFF])/,lookbehind:!0,alias:"builtin"},node:{pattern:r("(^|[^-.\\w\\x80-\\uFFFF\\\\])<ID>"),lookbehind:!0,greedy:!0,inside:a},operator:/[=:]|-[->]/,punctuation:/[\[\]{};,]/},e.languages.gv=e.languages.dot}(Prism);

31
examples/prism-dot.html Normal file
View File

@ -0,0 +1,31 @@
<h2>Full example</h2>
<pre><code>// source: http://www.ryandesign.com/canviz/graphs/dot/directed/ctext.gv.txt
# Generated Tue Aug 21 10:21:21 GMT 2007 by dot - Graphviz version 2.15.20070819.0440 (Tue Aug 21 09:56:32 GMT 2007)
#
#
# real 0m0.105s
# user 0m0.076s
# sys 0m0.022s
digraph G {
node [label="\N"];
graph [bb="0,0,352,238",
_draw_="c 5 -white C 5 -white P 4 0 0 0 238 352 238 352 0 ",
xdotversion="1.2"];
xyz [label="hello\nworld", color=slateblue, fontsize=24, fontname="Palatino-Italic", style=filled, fontcolor=hotpink, pos="67,191", width="1.64", height="1.29", _draw_="S 6 -filled c 9 -slateblue C 9 -slateblue E 67 191 59 47 ", _ldraw_="F 24.000000 15 -Palatino-Italic c 7 -hotpink T 67 196 0 65 5 -hello F 24.000000 15 -Palatino-Italic c 7 -hotpink T 67 167 0 75 5\
-world "];
red [color=red, style=filled, pos="171,191", width="0.75", height="0.50", _draw_="S 6 -filled c 3 -red C 3 -red E 171 191 27 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 171 186 0 24 3 -red "];
green [color=green, style=filled, pos="128,90", width="0.92", height="0.50", _draw_="S 6 -filled c 5 -green C 5 -green E 128 90 33 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 128 85 0 41 5 -green "];
blue [color=blue, style=filled, fontcolor=black, pos="214,90", width="0.78", height="0.50", _draw_="S 6 -filled c 4 -blue C 4 -blue E 214 90 28 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 214 85 0 31 4 -blue "];
cyan [color=cyan, style=filled, pos="214,18", width="0.83", height="0.50", _draw_="S 6 -filled c 4 -cyan C 4 -cyan E 214 18 30 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 214 13 0 34 4 -cyan "];
magenta [color=magenta, style=filled, pos="307,18", width="1.25", height="0.50", _draw_="S 6 -filled c 7 -magenta C 7 -magenta E 307 18 45 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 307 13 0 64 7 -magenta "];
yellow [color=yellow, style=filled, pos="36,18", width="1.00", height="0.50", _draw_="S 6 -filled c 6 -yellow C 6 -yellow E 36 18 36 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 36 13 0 47 6 -yellow "];
orange [color=orange, style=filled, pos="128,18", width="1.06", height="0.50", _draw_="S 6 -filled c 6 -orange C 6 -orange E 128 18 38 18 ", _ldraw_="F 14.000000 11 -Times-Roman c 5 -black T 128 13 0 51 6 -orange "];
red -> green [pos="e,136,108 164,173 157,158 147,135 140,118", _draw_="c 5 -black B 4 164 173 157 158 147 135 140 118 ", _hdraw_="S 5 -solid S 15 -setlinewidth(1) c 5 -black C 5 -black P 3 143 116 136 108 136 119 "];
red -> blue [pos="e,206,108 178,173 185,158 195,135 202,118", _draw_="c 5 -black B 4 178 173 185 158 195 135 202 118 ", _hdraw_="S 5 -solid S 15 -setlinewidth(1) c 5 -black C 5 -black P 3 206 119 206 108 199 116 "];
blue -> cyan [pos="e,214,36 214,72 214,64 214,55 214,46", _draw_="c 5 -black B 4 214 72 214 64 214 55 214 46 ", _hdraw_="S 5 -solid S 15 -setlinewidth(1) c 5 -black C 5 -black P 3 218 46 214 36 211 46 "];
blue -> magenta [pos="e,286,34 232,76 246,66 263,52 278,40", _draw_="c 5 -black B 4 232 76 246 66 263 52 278 40 ", _hdraw_="S 5 -solid S 15 -setlinewidth(1) c 5 -black C 5 -black P 3 280 43 286 34 276 37 "];
green -> yellow [pos="e,56,33 109,75 96,65 78,51 64,40", _draw_="c 5 -black B 4 109 75 96 65 78 51 64 40 ", _hdraw_="S 5 -solid S 15 -setlinewidth(1) c 5 -black C 5 -black P 3 66 37 56 33 61 42 "];
green -> orange [pos="e,128,36 128,72 128,64 128,55 128,46", _draw_="c 5 -black B 4 128 72 128 64 128 55 128 46 ", _hdraw_="S 5 -solid S 15 -setlinewidth(1) c 5 -black C 5 -black P 3 132 46 128 36 125 46 "];
}
</code></pre>

View File

@ -173,6 +173,7 @@
"jinja2": "django",
"dns-zone": "dns-zone-file",
"dockerfile": "docker",
"gv": "dot",
"eta": "ejs",
"xlsx": "excel-formula",
"xls": "excel-formula",

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,8 @@
"dns-zone-file": "DNS zone file",
"dns-zone": "DNS zone file",
"dockerfile": "Docker",
"dot": "DOT (Graphviz)",
"gv": "DOT (Graphviz)",
"ebnf": "EBNF",
"editorconfig": "EditorConfig",
"ejs": "EJS",

View File

@ -1 +1 @@
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={none:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||r[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={none:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,s=a.getAttribute("data-language")||r[e.language]||((t=e.language)?(t.substring(0,1).toUpperCase()+t.substring(1)).replace(/s(?=cript)/,"S"):t);if(s){var o=document.createElement("span");return o.textContent=s,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();

View File

@ -0,0 +1,129 @@
[label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR>
</TABLE>>]
----------------------------------------------------
[
["punctuation", "["],
["attr-name", ["label"]],
["operator", "="],
["attr-value", [
"<",
["markup", [
["tag", [
["tag", [
["punctuation", "<"],
"TABLE"
]],
["attr-name", ["BORDER"]],
["attr-value", [
["punctuation", "="],
["punctuation", "\""],
"0",
["punctuation", "\""]
]],
["attr-name", ["CELLBORDER"]],
["attr-value", [
["punctuation", "="],
["punctuation", "\""],
"1",
["punctuation", "\""]
]],
["attr-name", ["CELLSPACING"]],
["attr-value", [
["punctuation", "="],
["punctuation", "\""],
"0",
["punctuation", "\""]
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "<"],
"TR"
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "<"],
"TD"
]],
["punctuation", ">"]
]],
"left",
["tag", [
["tag", [
["punctuation", "</"],
"TD"
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "<"],
"TD"
]],
["attr-name", ["PORT"]],
["attr-value", [
["punctuation", "="],
["punctuation", "\""],
"f1",
["punctuation", "\""]
]],
["punctuation", ">"]
]],
"mid dle",
["tag", [
["tag", [
["punctuation", "</"],
"TD"
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "<"],
"TD"
]],
["attr-name", ["PORT"]],
["attr-value", [
["punctuation", "="],
["punctuation", "\""],
"f2",
["punctuation", "\""]
]],
["punctuation", ">"]
]],
"right",
["tag", [
["tag", [
["punctuation", "</"],
"TD"
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "</"],
"TR"
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "</"],
"TABLE"
]],
["punctuation", ">"]
]]
]],
">"
]],
["punctuation", "]"]
]

View File

@ -0,0 +1,53 @@
[foo=bar]
[
foo = 123;
"graph" = "
some
value", 123 = bar baz = 123
]
[label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR>
</TABLE>>]
----------------------------------------------------
[
["punctuation", "["],
["attr-name", ["foo"]],
["operator", "="],
["attr-value", ["bar"]],
["punctuation", "]"],
["punctuation", "["],
["attr-name", ["foo"]],
["operator", "="],
["attr-value", ["123"]],
["punctuation", ";"],
["attr-name", ["\"graph\""]],
["operator", "="],
["attr-value", ["\"\r\nsome\r\nvalue\""]],
["punctuation", ","],
["attr-name", ["123"]],
["operator", "="],
["attr-value", ["bar"]],
["attr-name", ["baz"]],
["operator", "="],
["attr-value", ["123"]],
["punctuation", "]"],
["punctuation", "["],
["attr-name", ["label"]],
["operator", "="],
["attr-value", [
"<",
["markup", "\r\n<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\">\r\n <TR><TD>left</TD><TD PORT=\"f1\">mid dle</TD><TD PORT=\"f2\">right</TD></TR>\r\n</TABLE>"],
">"
]],
["punctuation", "]"]
]

View File

@ -0,0 +1,15 @@
// comment
/*
comment
*/
# not really a comment but ignored
----------------------------------------------------
[
["comment", "// comment"],
["comment", "/*\r\ncomment\r\n*/"],
["comment", "# not really a comment but ignored"]
]

View File

@ -0,0 +1,22 @@
graph ethane {}
digraph foo {}
subgraph bar {}
----------------------------------------------------
[
["keyword", "graph"],
["graph-name", ["ethane"]],
["punctuation", "{"],
["punctuation", "}"],
["keyword", "digraph"],
["graph-name", ["foo"]],
["punctuation", "{"],
["punctuation", "}"],
["keyword", "subgraph"],
["graph-name", ["bar"]],
["punctuation", "{"],
["punctuation", "}"]
]

View File

@ -0,0 +1,17 @@
digraph;
edge;
graph;
node;
strict;
subgraph;
----------------------------------------------------
[
["keyword", "digraph"], ["punctuation", ";"],
["keyword", "edge"], ["punctuation", ";"],
["keyword", "graph"], ["punctuation", ";"],
["keyword", "node"], ["punctuation", ";"],
["keyword", "strict"], ["punctuation", ";"],
["keyword", "subgraph"], ["punctuation", ";"]
]

View File

@ -0,0 +1,34 @@
struct1:f1 -> struct2:f0;
struct1:f2 -> struct3:here;
A:ne -> B:sw
----------------------------------------------------
[
["node", ["struct1"]],
["operator", ":"],
["node", ["f1"]],
["operator", "->"],
["node", ["struct2"]],
["operator", ":"],
["node", ["f0"]],
["punctuation", ";"],
["node", ["struct1"]],
["operator", ":"],
["node", ["f2"]],
["operator", "->"],
["node", ["struct3"]],
["operator", ":"],
["node", ["here"]],
["punctuation", ";"],
["node", ["A"]],
["operator", ":"],
["compass-point", "ne"],
["operator", "->"],
["node", ["B"]],
["operator", ":"],
["compass-point", "sw"]
]

View File

@ -0,0 +1,9 @@
-- ->
= :
----------------------------------------------------
[
["operator", "--"], ["operator", "->"],
["operator", "="], ["operator", ":"]
]

View File

@ -0,0 +1,12 @@
[ ] { } ; ,
----------------------------------------------------
[
["punctuation", "["],
["punctuation", "]"],
["punctuation", "{"],
["punctuation", "}"],
["punctuation", ";"],
["punctuation", ","]
]