From a95e6251f01802d5563ee19e6f76725b0f8c100b Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 9 Dec 2022 11:31:05 +0300 Subject: [PATCH] some cleanup --- grammar.js | 138 +++-------------------- queries/highlights.scm | 8 +- src/grammar.json | 73 +++--------- src/parser.c | Bin 116286 -> 115444 bytes test/old_corpus/attributes.txt | 110 ------------------ test/old_corpus/connection.txt | 198 --------------------------------- test/old_corpus/container.txt | 97 ---------------- test/old_corpus/shape.txt | 134 ---------------------- 8 files changed, 36 insertions(+), 722 deletions(-) delete mode 100644 test/old_corpus/attributes.txt delete mode 100644 test/old_corpus/connection.txt delete mode 100644 test/old_corpus/container.txt delete mode 100644 test/old_corpus/shape.txt diff --git a/grammar.js b/grammar.js index 2c28145..eb42878 100644 --- a/grammar.js +++ b/grammar.js @@ -10,8 +10,6 @@ const PREC = { ATTRIBUTE_KEY: 0, }; -spaces = /[ \t]/; - module.exports = grammar({ name: "d2", @@ -22,28 +20,17 @@ module.exports = grammar({ word: ($) => $._identifier, - conflicts: ($) => [ - [$._connection_path, $.container], - //[$.shape_key], - /* - [$._shape_path], - [$._shape_block], - [$._shape_block_definition], - [$._style_attr_block], - [$._inner_style_attribute], - [$._emptyline], -*/ - ], + conflicts: ($) => [[$._connection_path, $.container]], rules: { - source_file: ($) => repeat($._new_root_definition), + source_file: ($) => repeat($._root_definition), - _new_root_definition: ($) => + _root_definition: ($) => choice( $._eol, seq( choice( - alias($._new_root_attribute, $.attribute), + alias($._root_attribute, $.attribute), $.shape, $.container, $.connection @@ -57,17 +44,14 @@ module.exports = grammar({ connection: ($) => seq( $._connection_path, - repeat1(seq($._arrow, $._connection_path)), + repeat1(seq($.arrow, $._connection_path)), optional(seq($._colon, $.label)) ), _connection_path: ($) => seq( repeat( - prec( - PREC.CONNECTION, - seq(alias($.shape_key, $.container_key), $._dot) - ) + prec(PREC.CONNECTION, seq(alias($.shape_key, $.container_key), $.dot)) ), $.shape_key ), @@ -80,24 +64,24 @@ module.exports = grammar({ seq( alias($.shape_key, $.container_key), choice( - seq($._dot, choice($.shape, $.container)), + seq($.dot, choice($.shape, $.container)), seq( seq( optional(seq($._colon, optional($.label))), - optional(seq(alias($._new_container_block, $.block))) + optional(seq(alias($._container_block, $.block))) ) ) ) ) ), - _new_container_block: ($) => + _container_block: ($) => prec( PREC.CONTAINER, - seq("{", repeat($._new_container_block_definition), "}") + seq("{", repeat($._container_block_definition), "}") ), - _new_container_block_definition: ($) => + _container_block_definition: ($) => prec( PREC.CONTAINER, choice($._eol, seq(choice($.shape, $.container, $.connection), $._end)) @@ -112,10 +96,10 @@ module.exports = grammar({ $.shape_key, optional( choice( - seq($._dot, alias($._style_attribute, $.attribute)), + seq($.dot, alias($._style_attribute, $.attribute)), seq( optional(seq($._colon, optional($.label))), - optional(seq(alias($._new_shape_block, $.block))) + optional(seq(alias($._shape_block, $.block))) ) ) ) @@ -127,14 +111,14 @@ module.exports = grammar({ _identifier: ($) => token(prec(PREC.IDENTIFIER, /\-?([\w\d]+|([\w\d]+( +|\-)[\w\d]+)+)/)), - _new_shape_block: ($) => - prec(PREC.SHAPE, seq("{", repeat($._new_shape_block_definition), "}")), + _shape_block: ($) => + prec(PREC.SHAPE, seq("{", repeat($._shape_block_definition), "}")), - _new_shape_block_definition: ($) => prec(PREC.SHAPE, choice($._eol)), + _shape_block_definition: ($) => prec(PREC.SHAPE, choice($._eol)), // attributes - _new_root_attribute: ($) => + _root_attribute: ($) => seq(alias($._root_attr_key, $.attr_key), $._colon, $.attr_value), _root_attr_key: ($) => @@ -176,7 +160,7 @@ module.exports = grammar({ seq( alias("style", $.attr_key), choice( - seq($._dot, alias($._inner_style_attribute, $.attribute)), + seq($.dot, alias($._inner_style_attribute, $.attribute)), seq($._colon, alias($._style_attribute_block, $.block)) ) ) @@ -229,95 +213,12 @@ module.exports = grammar({ // -------------------------------------------- - // source_file: ($) => repeat($._root_definition), - /* - - _root_definition: ($) => - choice( - $._emptyline, - $._root_attribute, - $.connection, - $._shape_definition - ), - - _shape_definition: ($) => - seq( - $._shape_path, - optional( - choice( - seq($.dot, $._shape_attribute), - seq( - optional(seq($._colon, optional(seq(spaces, $.label)))), - optional(alias($._shape_block, $.block)) - ) - ) - ), - $._end - ), - - _shape_path: ($) => - seq( - spaces, - repeat(seq(alias($.shape_key, $.container_key), spaces, $.dot, spaces)), - $.shape_key - ), - - - _shape_block: ($) => - seq( - spaces, - "{", - repeat(choice($._emptyline, seq(spaces, $._shape_block_definition))), - optional(seq($._shape_block_definition, optional($._end))), - spaces, - "}" - ), - - _shape_block_definition: ($) => - choice($.connection, $._shape_definition, $._shape_attribute), - - _shape_attribute: ($) => - choice( - seq(alias($._shape_attr_key, $.attr_key), $._colon, $.attr_value), - $._style_attribute - ), - - _style_attribute: ($) => - seq( - alias("style", $.attr_key), - choice( - seq($.dot, $._inner_style_attribute), - seq($._colon, alias($._style_attr_block, $.block)) - ) - ), - - _style_attr_block: ($) => - seq( - spaces, - "{", - spaces, - repeat(choice($._emptyline, seq($._inner_style_attribute, $._end))), - optional(seq($._inner_style_attribute, optional($._end))), - spaces, - "}" - ), - - _inner_style_attribute: ($) => - seq(spaces, alias($._style_attr_key, $.attr_key), $._colon, $.attr_value), - - _connection_attribute: ($) => - seq(alias($._connection_attr_key, $.attr_key), $._colon, $.attr_value), - */ - _dash: ($) => token.immediate("-"), _colon: ($) => seq(":"), - _arrow: ($) => seq($.arrow), - arrow: ($) => token(prec(PREC.ARROW, choice(/-+>/, /--+/, /<-+/, /<-+>/))), - _dot: ($) => seq($.dot), dot: ($) => token("."), _unquoted_string: ($) => @@ -332,9 +233,6 @@ module.exports = grammar({ line_comment: ($) => token(prec(PREC.COMMENT, seq("#", /.*/))), - _word: ($) => /[\w\d]+/, - - _emptyline: ($) => prec(-1, seq(spaces, $._eol)), _eol: ($) => choice("\n", "\0"), _end: ($) => seq(choice(";", $._eol)), }, diff --git a/queries/highlights.scm b/queries/highlights.scm index 2e9f129..71fdff8 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -1,8 +1,3 @@ -; Special (treesitter don't overwrite) -;------------------------------------------------------------------------------- - -(ERROR) @error -; (invalid (_) @error) ;------------------------------------------------------------------------------- (container_key) @constant @@ -15,7 +10,7 @@ (container_key (string) @string.special) (shape_key (string) @string) (label) @string -; (attr_value) @string +(attr_value) @string ; Comments ;------------------------------------------------------------------------------- @@ -42,4 +37,3 @@ ;------------------------------------------------------------------------------- (ERROR) @error -; (invalid (_) @error) diff --git a/src/grammar.json b/src/grammar.json index 48a9f29..d2cd3a7 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -6,10 +6,10 @@ "type": "REPEAT", "content": { "type": "SYMBOL", - "name": "_new_root_definition" + "name": "_root_definition" } }, - "_new_root_definition": { + "_root_definition": { "type": "CHOICE", "members": [ { @@ -26,7 +26,7 @@ "type": "ALIAS", "content": { "type": "SYMBOL", - "name": "_new_root_attribute" + "name": "_root_attribute" }, "named": true, "value": "attribute" @@ -67,7 +67,7 @@ "members": [ { "type": "SYMBOL", - "name": "_arrow" + "name": "arrow" }, { "type": "SYMBOL", @@ -121,7 +121,7 @@ }, { "type": "SYMBOL", - "name": "_dot" + "name": "dot" } ] } @@ -156,7 +156,7 @@ "members": [ { "type": "SYMBOL", - "name": "_dot" + "name": "dot" }, { "type": "CHOICE", @@ -218,7 +218,7 @@ "type": "ALIAS", "content": { "type": "SYMBOL", - "name": "_new_container_block" + "name": "_container_block" }, "named": true, "value": "block" @@ -239,7 +239,7 @@ ] } }, - "_new_container_block": { + "_container_block": { "type": "PREC", "value": 2, "content": { @@ -253,7 +253,7 @@ "type": "REPEAT", "content": { "type": "SYMBOL", - "name": "_new_container_block_definition" + "name": "_container_block_definition" } }, { @@ -263,7 +263,7 @@ ] } }, - "_new_container_block_definition": { + "_container_block_definition": { "type": "PREC", "value": 2, "content": { @@ -323,7 +323,7 @@ "members": [ { "type": "SYMBOL", - "name": "_dot" + "name": "dot" }, { "type": "ALIAS", @@ -378,7 +378,7 @@ "type": "ALIAS", "content": { "type": "SYMBOL", - "name": "_new_shape_block" + "name": "_shape_block" }, "named": true, "value": "block" @@ -443,7 +443,7 @@ } } }, - "_new_shape_block": { + "_shape_block": { "type": "PREC", "value": 3, "content": { @@ -457,7 +457,7 @@ "type": "REPEAT", "content": { "type": "SYMBOL", - "name": "_new_shape_block_definition" + "name": "_shape_block_definition" } }, { @@ -467,7 +467,7 @@ ] } }, - "_new_shape_block_definition": { + "_shape_block_definition": { "type": "PREC", "value": 3, "content": { @@ -480,7 +480,7 @@ ] } }, - "_new_root_attribute": { + "_root_attribute": { "type": "SEQ", "members": [ { @@ -605,7 +605,7 @@ "members": [ { "type": "SYMBOL", - "name": "_dot" + "name": "dot" }, { "type": "ALIAS", @@ -836,15 +836,6 @@ } ] }, - "_arrow": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "arrow" - } - ] - }, "arrow": { "type": "TOKEN", "content": { @@ -873,15 +864,6 @@ } } }, - "_dot": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "dot" - } - ] - }, "dot": { "type": "TOKEN", "content": { @@ -994,27 +976,6 @@ } } }, - "_word": { - "type": "PATTERN", - "value": "[\\w\\d]+" - }, - "_emptyline": { - "type": "PREC", - "value": -1, - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[ \\t]" - }, - { - "type": "SYMBOL", - "name": "_eol" - } - ] - } - }, "_eol": { "type": "CHOICE", "members": [ diff --git a/src/parser.c b/src/parser.c index aa657a9d30ee213df834dfd269fc34d2bc28c557..3d1bdfa32f8cec2d5cc131e35afe3eb51eed87eb 100644 GIT binary patch delta 7702 zcmb_hdvH`$ny;^KNOw9A@+1i)=?)1JAS8Y7?R&egJQCgu0*O2ZnXnUr1PNdgkhk&{ zO9lpmm*Ha^m8jzYDi9`0903hAGi%k35BO)-Do5AZ+MTW0K?|yOT&=}rf9IU;PC{pE zXR7v}^gZYM&Ub#_`<#<^k9hy%pts`=g^zugPnMf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Xd zl=1x3@(dQp{n(43fHUG_i1 zOHki^&=S#!%Ys%Wv{LHa2%Jl`hgk>1+a)66j-T!~>QR=wIn;re8Ga zTbDt+0xc^Y$ik41jTxn}T%UAks zq9SOisiUzS?t(4Q)6xl8I-!T9ubIh@{+4cwprt1I8V`PzN-NQ((g|1^B9M1nE>5AWI2&IN-|ffYZPR|* z%4_B65Bn+TKcH4?8oxQ152bnN{M89G|0@Pf%E48j3Hs3?3Ze&@ zZz2BbHEKrnIQBM;;kgFRIUU{P%SBaH2tK{v3g2Q}u|9ARO>j~-x<>T-m_fP#!*Jb? zMhFK}VTs0ymD&{i&%O^D4R4BQ$8fotB;*QWs8?I~=-Zfvdly2MJP48tVD0V3nMYXX zSc(Lcrrqz;NOg~J?R8v2zwtUvwcq{?7W(7>ZH1KgAEYN-mS`AcAzB?DIe;sh$%m-c z5eV`&`~v+Fe#Fw*eCrTxc3Jkrk(A!Ubsn4n-&Gvw)~hrC_~YaECOQv6w$68!EKv2@#-72oY;K;vFANZ zS-EnDEaIRz!6~IM{%HQiaVo)_BbxH?6O=2waH@X~)8c2xG3v~}0MFMR$NewP7v(3g zW<#=b%sc&NTrgh1m}|%4AojjRVL|`m1a(NjuYQXv z1E+8(lsixPl07WfZN(V|3Q$kM9pJVlN6XMmll8t!Tl2EklAN{|4s%>BudRGAEKbyh!fkTO+t#;gZ1`cGC6&H{T4<*d~gL%z6V16xuKb)Y+ zCF;Xtzi+{~+~Cg>G@Y9-fzUJWqmH1UjTH?{24!kj%2!|PFoRGJpazBb`gv&m)%#Wv zoN$ruRfz}-ZNF&iC8?N;Ayx&i9#nNKH<)}^bhcfDoX=dsmYeTVcCNjMGu#8GX$m)f z02l0(`sY0YhRZ&n*K(~?#>Bx5sFvhQgg>N8;!_{ter)YWG?hPp9p~fbkEkH=vybTR G%>MxlK>qar diff --git a/test/old_corpus/attributes.txt b/test/old_corpus/attributes.txt deleted file mode 100644 index f48a55c..0000000 --- a/test/old_corpus/attributes.txt +++ /dev/null @@ -1,110 +0,0 @@ -================================================================================ -Root attribute -================================================================================ -direction: value - --------------------------------------------------------------------------------- - -(source_file - (attr_key) (attr_value) -) - -================================================================================ -Block shape attribute -================================================================================ -foo: { - shape: oval - - foo.bar.baz: { - shape: oval - } -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (block - (attr_key) (attr_value) - (container_key) (dot) (container_key) (dot) (shape_key) - (block - (attr_key) (attr_value) - ) - ) -) - - -================================================================================ -Inline shape attribute -================================================================================ -foo.shape: oval -foo.bar.baz.shape: oval - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (dot) (attr_key) (attr_value) - (container_key) (dot) (container_key) (dot) (shape_key) (dot) (attr_key) (attr_value) -) - -================================================================================ -Inline style attribute -================================================================================ -foo.style.opacity: 5 - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (dot) (attr_key) (dot) (attr_key) (attr_value) -) - -================================================================================ -Block style attributes -================================================================================ -foo.style: { - opacity: 5 - - fill: red; -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (dot) (attr_key) - (block - (attr_key) (attr_value) - (attr_key) (attr_value) - ) -) - -================================================================================ -Inline block style attributes -================================================================================ -foo.style: { opacity: 5; fill: red; } -foo.style: { opacity: 5 } - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (dot) (attr_key) - (block - (attr_key) (attr_value) - (attr_key) (attr_value) - ) - (shape_key) (dot) (attr_key) - (block - (attr_key) (attr_value) - ) -) - -================================================================================ -Color in string -================================================================================ -foo.style.fill: "#ffffff"; - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (dot) (attr_key) (dot) (attr_key) (attr_value (string)) -) - diff --git a/test/old_corpus/connection.txt b/test/old_corpus/connection.txt deleted file mode 100644 index f1d8b64..0000000 --- a/test/old_corpus/connection.txt +++ /dev/null @@ -1,198 +0,0 @@ -================================================================================ -Simple connection -================================================================================ -foo--bar -biz->baz -biz<->baz -biz<-baz - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) -) - -================================================================================ -Formatted connection -================================================================================ -foo -- bar -biz -> baz -biz <-> baz -biz <- baz - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) -) - -================================================================================ -Connection with looooong arrow -================================================================================ -foo ----------- bar -biz ----------> baz -biz <---------> baz -biz <---------- baz - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) -) - - -================================================================================ -Complex identifier connection -================================================================================ -Foo Bar -- Biz Baz --Bar-Foo- <- -Baz-Biz- - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) -) - -================================================================================ -Inline connection -================================================================================ -foo--bar->biz->baz - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - (arrow) - (shape_key) - (arrow) - (shape_key) - ) -) - -================================================================================ -Many connections inline -================================================================================ -foo--bar;biz->baz - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - ) - (connection - (shape_key) - (arrow) - (shape_key) - ) -) - -================================================================================ -Labeled connections -================================================================================ -foo--bar: Question? -bar -> baz: Yes - --------------------------------------------------------------------------------- - -(source_file - (connection - (shape_key) - (arrow) - (shape_key) - (label) - ) - (connection - (shape_key) - (arrow) - (shape_key) - (label) - ) -) - -================================================================================ -Connection of shapes inside a containers -================================================================================ -foo.biz.baz -> bar.baz.biz: Label - --------------------------------------------------------------------------------- - -(source_file - (connection - (container_key) (dot) (container_key) (dot) (shape_key) - (arrow) - (container_key) (dot) (container_key) (dot) (shape_key) - (label) - ) -) diff --git a/test/old_corpus/container.txt b/test/old_corpus/container.txt deleted file mode 100644 index d0b5691..0000000 --- a/test/old_corpus/container.txt +++ /dev/null @@ -1,97 +0,0 @@ -================================================================================ -Declare a shape inside a container -================================================================================ -foo.baz - --------------------------------------------------------------------------------- - -(source_file - (container_key) (dot) (shape_key) -) - -================================================================================ -Use quoted string as a shape key -================================================================================ -'foo'.'baz' - --------------------------------------------------------------------------------- - -(source_file - (container_key (string)) (dot) (shape_key (string)) -) - -================================================================================ -Declare container inside a container using block -================================================================================ - -foo: { - bar: { - baz: { - biz - } - } -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (block - (shape_key) - (block - (shape_key) - (block - (shape_key) - ) - ) - ) -) - -================================================================================ -Declare labaled container inside a labeled container using block -================================================================================ - -foo: Foo { - bar: Bar { - baz: Baz { - biz: Biz - } - } -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (label) - (block - (shape_key) (label) - (block - (shape_key) (label) - (block - (shape_key) (label) - ) - ) - ) -) - -================================================================================ -Declare many shapes inside a container -================================================================================ - -foo: { - bar - biz - baz -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (block - (shape_key) - (shape_key) - (shape_key) - ) -) - diff --git a/test/old_corpus/shape.txt b/test/old_corpus/shape.txt deleted file mode 100644 index c73d2f7..0000000 --- a/test/old_corpus/shape.txt +++ /dev/null @@ -1,134 +0,0 @@ -================================================================================ -Simple shape key -================================================================================ -foo -bar - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (shape_key) -) - -================================================================================ -Complex shape key -================================================================================ - Foo bar --Biz-baz- - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (shape_key) -) - -================================================================================ -Use quoted string as a shape key -================================================================================ -'foo' - --------------------------------------------------------------------------------- - -(source_file - (shape_key (string)) -) - -================================================================================ -Define multiple shapes using semicolons -================================================================================ -a;b;c - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (shape_key) - (shape_key) -) - -================================================================================ -Labeled shapes -================================================================================ -a: Foo Bar -a: Foo Bar; b: Biz Baz - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (label) - (shape_key) (label) - (shape_key) (label) -) - -================================================================================ -It should skip white spaces -================================================================================ - -foo - -bar : Foo Bar; baz - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (shape_key) (label) - (shape_key) -) - -================================================================================ -Shape block -================================================================================ - -foo: { - bar: { - baz: { - biz - } - } -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) - (block - (shape_key) - (block - (shape_key) - (block - (shape_key) - ) - ) - ) -) - -================================================================================ -Aliased shape block -================================================================================ - -foo: Foo { - bar: Bar { - baz: Baz { - biz: Biz - } - } -} - --------------------------------------------------------------------------------- - -(source_file - (shape_key) (label) - (block - (shape_key) (label) - (block - (shape_key) (label) - (block - (shape_key) (label) - ) - ) - ) -) -