add root attributes

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-09 10:40:58 +03:00
parent 1ea16740eb
commit f279551465
Signed by: pleshevskiy
GPG Key ID: 1B59187B161C0215
8 changed files with 415 additions and 752 deletions

19
examples/all.d2 Normal file
View File

@ -0,0 +1,19 @@
shape: oval
label: ten
constraint: utehu
icon: huell
opacity: 1
fill: red
stroke: red
stroke-width: 5
stroke-dash: 4
border-radius: 1
font-color: red
shadow: true
multiple: true
animated: true
link: https://to
near: abc
hello

View File

@ -1,11 +1,13 @@
const PREC = { const PREC = {
COMMENT: -2, COMMENT: -2,
UNQUOTED_STRING: 5, UNQUOTED_STRING: 0,
CONTAINER: 9, CONTAINER: 2,
CONNECTION: 9, CONNECTION: 2,
SHAPE: 11, SHAPE: 3,
IDENTIFIER: 12, IDENTIFIER: 0,
ARROW: 13, ARROW: 0,
ATTRIBUTE: 0,
ATTRIBUTE_KEY: 0,
}; };
spaces = /[ \t]/; spaces = /[ \t]/;
@ -18,7 +20,7 @@ module.exports = grammar({
$.line_comment, $.line_comment,
], ],
word: ($) => $._word, word: ($) => $._identifier,
conflicts: ($) => [ conflicts: ($) => [
[$._connection_path, $.container], [$._connection_path, $.container],
@ -37,7 +39,20 @@ module.exports = grammar({
source_file: ($) => repeat($._new_root_definition), source_file: ($) => repeat($._new_root_definition),
_new_root_definition: ($) => _new_root_definition: ($) =>
choice($._eol, seq(choice($.shape, $.container, $.connection), $._end)), choice(
$._eol,
seq(
choice(
alias($._new_root_attribute, $.attribute),
$.shape,
$.container,
$.connection
),
$._end
)
),
// connections
connection: ($) => connection: ($) =>
seq( seq(
@ -57,6 +72,8 @@ module.exports = grammar({
$.shape_key $.shape_key
), ),
// containers
container: ($) => container: ($) =>
prec( prec(
PREC.CONTAINER, PREC.CONTAINER,
@ -74,6 +91,20 @@ module.exports = grammar({
) )
), ),
_new_container_block: ($) =>
prec(
PREC.CONTAINER,
seq("{", repeat($._new_container_block_definition), "}")
),
_new_container_block_definition: ($) =>
prec(
PREC.CONTAINER,
choice($._eol, seq(choice($.shape, $.container, $.connection), $._end))
),
// shapes
shape: ($) => shape: ($) =>
prec( prec(
PREC.SHAPE, PREC.SHAPE,
@ -88,35 +119,87 @@ module.exports = grammar({
) )
), ),
shape_key: ($) => shape_key: ($) => choice($.string, seq($._identifier, optional($._dash))),
choice(
$.string, _identifier: ($) =>
seq( token(prec(PREC.IDENTIFIER, /\-?([\w\d]+|([\w\d]+( +|\-)[\w\d]+)+)/)),
token(prec(PREC.IDENTIFIER, /\-?([\w\d]+|([\w\d]+( +|\-)[\w\d]+)+)/)),
optional($._dash)
)
),
_new_shape_block: ($) => _new_shape_block: ($) =>
prec(PREC.SHAPE, seq("{", repeat($._new_shape_block_definition), "}")), prec(PREC.SHAPE, seq("{", repeat($._new_shape_block_definition), "}")),
_new_shape_block_definition: ($) => prec(PREC.SHAPE, choice($._eol)), _new_shape_block_definition: ($) => prec(PREC.SHAPE, choice($._eol)),
_new_container_block: ($) => // attributes
_new_root_attribute: ($) =>
prec( prec(
PREC.CONTAINER, PREC.ATTRIBUTE,
seq("{", repeat($._new_container_block_definition), "}") seq(alias($._root_attr_key, $.attr_key), $._colon, $.attr_value)
), ),
_new_container_block_definition: ($) => _root_attr_key: ($) =>
prec( choice(
PREC.CONTAINER, "direction",
choice($._eol, seq(choice($.shape, $.container, $.connection), $._end)) // reserved but doesn't affected for root
alias(
choice(
"shape",
"label",
"constraint",
"icon",
$._common_style_attr_key,
$._text_attr_key
),
$.reserved
)
), ),
_shape_attr_key: ($) =>
prec(
PREC.ATTRIBUTE_KEY,
choice(
"shape",
"label",
// sql
"constraint",
// image
"icon",
"width",
"height"
)
),
_style_attr_key: ($) => choice($._common_style_attr_key, "3d"),
_common_style_attr_key: ($) =>
choice(
"opacity",
"fill",
"stroke",
"stroke-width",
"stroke-dash",
"border-radius",
"font-color",
"shadow",
"multiple",
"animated",
"link"
),
_text_attr_key: ($) => "near",
_connection_attr_key: ($) => choice("source-arrowhead", "target-arrowhead"),
//
label: ($) => choice($.string, $._unquoted_string),
attr_value: ($) => seq(choice($.string, $._unquoted_string)),
// -------------------------------------------- // --------------------------------------------
// source_file: ($) => repeat($._root_definition), // source_file: ($) => repeat($._root_definition),
/*
_root_definition: ($) => _root_definition: ($) =>
choice( choice(
@ -148,24 +231,6 @@ module.exports = grammar({
$.shape_key $.shape_key
), ),
_dash: ($) => token.immediate("-"),
label: ($) => choice($.string, $._unquoted_string),
attr_value: ($) => seq(spaces, choice($.string, $._unquoted_string)),
_root_attribute: ($) =>
choice(
seq(
alias($._root_attr_key, $.attr_key),
$._colon,
$.attr_value,
$._end
),
alias(seq($._shape_attribute, $._end), $.invalid)
),
_root_attr_key: ($) => "direction",
_shape_block: ($) => _shape_block: ($) =>
seq( seq(
@ -211,38 +276,9 @@ module.exports = grammar({
_connection_attribute: ($) => _connection_attribute: ($) =>
seq(alias($._connection_attr_key, $.attr_key), $._colon, $.attr_value), seq(alias($._connection_attr_key, $.attr_key), $._colon, $.attr_value),
*/
_shape_attr_key: ($) => _dash: ($) => token.immediate("-"),
choice(
"shape",
"label",
// sql
"constraint",
// image
"icon",
"width",
"height"
),
_style_attr_key: ($) =>
choice(
"opacity",
"fill",
"stroke",
"stroke-width",
"stroke-dash",
"border-radius",
"font-color",
"shadow",
"multiple",
"animated",
"3d",
"link"
),
_text_attr_key: ($) => "near",
_connection_attr_key: ($) => choice("source-arrowhead", "target-arrowhead"),
_colon: ($) => seq(":"), _colon: ($) => seq(":"),

View File

@ -2,7 +2,7 @@
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
(ERROR) @error (ERROR) @error
(invalid (_) @error) ; (invalid (_) @error)
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
(container_key) @constant (container_key) @constant
@ -15,7 +15,7 @@
(container_key (string) @string.special) (container_key (string) @string.special)
(shape_key (string) @string) (shape_key (string) @string)
(label) @string (label) @string
(attr_value) @string ; (attr_value) @string
; Comments ; Comments
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -42,4 +42,4 @@
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
(ERROR) @error (ERROR) @error
(invalid (_) @error) ; (invalid (_) @error)

View File

@ -1,6 +1,6 @@
{ {
"name": "d2", "name": "d2",
"word": "_word", "word": "_identifier",
"rules": { "rules": {
"source_file": { "source_file": {
"type": "REPEAT", "type": "REPEAT",
@ -22,6 +22,15 @@
{ {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_new_root_attribute"
},
"named": true,
"value": "attribute"
},
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "shape" "name": "shape"
@ -97,7 +106,7 @@
"type": "REPEAT", "type": "REPEAT",
"content": { "content": {
"type": "PREC", "type": "PREC",
"value": 9, "value": 2,
"content": { "content": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@ -126,7 +135,7 @@
}, },
"container": { "container": {
"type": "PREC", "type": "PREC",
"value": 9, "value": 2,
"content": { "content": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@ -230,9 +239,72 @@
] ]
} }
}, },
"_new_container_block": {
"type": "PREC",
"value": 2,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_new_container_block_definition"
}
},
{
"type": "STRING",
"value": "}"
}
]
}
},
"_new_container_block_definition": {
"type": "PREC",
"value": 2,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_eol"
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "shape"
},
{
"type": "SYMBOL",
"name": "container"
},
{
"type": "SYMBOL",
"name": "connection"
}
]
},
{
"type": "SYMBOL",
"name": "_end"
}
]
}
]
}
},
"shape": { "shape": {
"type": "PREC", "type": "PREC",
"value": 11, "value": 3,
"content": { "content": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@ -318,15 +390,8 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "TOKEN", "type": "SYMBOL",
"content": { "name": "_identifier"
"type": "PREC",
"value": 12,
"content": {
"type": "PATTERN",
"value": "\\-?([\\w\\d]+|([\\w\\d]+( +|\\-)[\\w\\d]+)+)"
}
}
}, },
{ {
"type": "CHOICE", "type": "CHOICE",
@ -344,9 +409,20 @@
} }
] ]
}, },
"_identifier": {
"type": "TOKEN",
"content": {
"type": "PREC",
"value": 0,
"content": {
"type": "PATTERN",
"value": "\\-?([\\w\\d]+|([\\w\\d]+( +|\\-)[\\w\\d]+)+)"
}
}
},
"_new_shape_block": { "_new_shape_block": {
"type": "PREC", "type": "PREC",
"value": 11, "value": 3,
"content": { "content": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@ -370,7 +446,7 @@
}, },
"_new_shape_block_definition": { "_new_shape_block_definition": {
"type": "PREC", "type": "PREC",
"value": 11, "value": 3,
"content": { "content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
@ -381,656 +457,122 @@
] ]
} }
}, },
"_new_container_block": { "_new_root_attribute": {
"type": "PREC", "type": "PREC",
"value": 9, "value": 0,
"content": { "content": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "STRING", "type": "ALIAS",
"value": "{"
},
{
"type": "REPEAT",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_new_container_block_definition" "name": "_root_attr_key"
} },
"named": true,
"value": "attr_key"
}, },
{
"type": "STRING",
"value": "}"
}
]
}
},
"_new_container_block_definition": {
"type": "PREC",
"value": 9,
"content": {
"type": "CHOICE",
"members": [
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_eol" "name": "_colon"
}, },
{ {
"type": "SEQ", "type": "SYMBOL",
"members": [ "name": "attr_value"
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "shape"
},
{
"type": "SYMBOL",
"name": "container"
},
{
"type": "SYMBOL",
"name": "connection"
}
]
},
{
"type": "SYMBOL",
"name": "_end"
}
]
} }
] ]
} }
}, },
"_root_definition": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_emptyline"
},
{
"type": "SYMBOL",
"name": "_root_attribute"
},
{
"type": "SYMBOL",
"name": "connection"
},
{
"type": "SYMBOL",
"name": "_shape_definition"
}
]
},
"_shape_definition": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_shape_path"
},
{
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "dot"
},
{
"type": "SYMBOL",
"name": "_shape_attribute"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "SYMBOL",
"name": "label"
}
]
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_shape_block"
},
"named": true,
"value": "block"
},
{
"type": "BLANK"
}
]
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_end"
}
]
},
"_shape_path": {
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "shape_key"
},
"named": true,
"value": "container_key"
},
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "SYMBOL",
"name": "dot"
},
{
"type": "PATTERN",
"value": "[ \\t]"
}
]
}
},
{
"type": "SYMBOL",
"name": "shape_key"
}
]
},
"_dash": {
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "-"
}
},
"label": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "_unquoted_string"
}
]
},
"attr_value": {
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "_unquoted_string"
}
]
}
]
},
"_root_attribute": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_root_attr_key"
},
"named": true,
"value": "attr_key"
},
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "attr_value"
},
{
"type": "SYMBOL",
"name": "_end"
}
]
},
{
"type": "ALIAS",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_shape_attribute"
},
{
"type": "SYMBOL",
"name": "_end"
}
]
},
"named": true,
"value": "invalid"
}
]
},
"_root_attr_key": { "_root_attr_key": {
"type": "STRING", "type": "CHOICE",
"value": "direction"
},
"_shape_block": {
"type": "SEQ",
"members": [ "members": [
{
"type": "PATTERN",
"value": "[ \\t]"
},
{ {
"type": "STRING", "type": "STRING",
"value": "{" "value": "direction"
}, },
{ {
"type": "REPEAT", "type": "ALIAS",
"content": { "content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "STRING",
"name": "_emptyline" "value": "shape"
}, },
{ {
"type": "SEQ", "type": "STRING",
"members": [ "value": "label"
{ },
"type": "PATTERN", {
"value": "[ \\t]" "type": "STRING",
}, "value": "constraint"
{ },
"type": "SYMBOL", {
"name": "_shape_block_definition" "type": "STRING",
} "value": "icon"
] },
{
"type": "SYMBOL",
"name": "_common_style_attr_key"
},
{
"type": "SYMBOL",
"name": "_text_attr_key"
} }
] ]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_shape_block_definition"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_end"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "STRING",
"value": "}"
}
]
},
"_shape_block_definition": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "connection"
},
{
"type": "SYMBOL",
"name": "_shape_definition"
},
{
"type": "SYMBOL",
"name": "_shape_attribute"
}
]
},
"_shape_attribute": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_shape_attr_key"
},
"named": true,
"value": "attr_key"
},
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "attr_value"
}
]
},
{
"type": "SYMBOL",
"name": "_style_attribute"
}
]
},
"_style_attribute": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "STRING",
"value": "style"
}, },
"named": true, "named": true,
"value": "attr_key" "value": "reserved"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "dot"
},
{
"type": "SYMBOL",
"name": "_inner_style_attribute"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_style_attr_block"
},
"named": true,
"value": "block"
}
]
}
]
}
]
},
"_style_attr_block": {
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_emptyline"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_inner_style_attribute"
},
{
"type": "SYMBOL",
"name": "_end"
}
]
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_inner_style_attribute"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_end"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "STRING",
"value": "}"
}
]
},
"_inner_style_attribute": {
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[ \\t]"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_style_attr_key"
},
"named": true,
"value": "attr_key"
},
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "attr_value"
}
]
},
"_connection_attribute": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_connection_attr_key"
},
"named": true,
"value": "attr_key"
},
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "attr_value"
} }
] ]
}, },
"_shape_attr_key": { "_shape_attr_key": {
"type": "PREC",
"value": 0,
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "shape"
},
{
"type": "STRING",
"value": "label"
},
{
"type": "STRING",
"value": "constraint"
},
{
"type": "STRING",
"value": "icon"
},
{
"type": "STRING",
"value": "width"
},
{
"type": "STRING",
"value": "height"
}
]
}
},
"_style_attr_key": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "STRING", "type": "SYMBOL",
"value": "shape" "name": "_common_style_attr_key"
}, },
{ {
"type": "STRING", "type": "STRING",
"value": "label" "value": "3d"
},
{
"type": "STRING",
"value": "constraint"
},
{
"type": "STRING",
"value": "icon"
},
{
"type": "STRING",
"value": "width"
},
{
"type": "STRING",
"value": "height"
} }
] ]
}, },
"_style_attr_key": { "_common_style_attr_key": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@ -1073,10 +615,6 @@
"type": "STRING", "type": "STRING",
"value": "animated" "value": "animated"
}, },
{
"type": "STRING",
"value": "3d"
},
{ {
"type": "STRING", "type": "STRING",
"value": "link" "value": "link"
@ -1100,6 +638,44 @@
} }
] ]
}, },
"label": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "_unquoted_string"
}
]
},
"attr_value": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "_unquoted_string"
}
]
}
]
},
"_dash": {
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "-"
}
},
"_colon": { "_colon": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@ -1122,7 +698,7 @@
"type": "TOKEN", "type": "TOKEN",
"content": { "content": {
"type": "PREC", "type": "PREC",
"value": 13, "value": 0,
"content": { "content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
@ -1166,7 +742,7 @@
"type": "TOKEN", "type": "TOKEN",
"content": { "content": {
"type": "PREC", "type": "PREC",
"value": 5, "value": 0,
"content": { "content": {
"type": "PATTERN", "type": "PATTERN",
"value": "[\\w\\-?!]([^'\"`\\n;{}]*[\\w\\-?!])?" "value": "[\\w\\-?!]([^'\"`\\n;{}]*[\\w\\-?!])?"

View File

@ -2,7 +2,17 @@
{ {
"type": "attr_key", "type": "attr_key",
"named": true, "named": true,
"fields": {} "fields": {},
"children": {
"multiple": false,
"required": false,
"types": [
{
"type": "reserved",
"named": true
}
]
}
}, },
{ {
"type": "attr_value", "type": "attr_value",
@ -20,12 +30,12 @@
} }
}, },
{ {
"type": "block", "type": "attribute",
"named": true, "named": true,
"fields": {}, "fields": {},
"children": { "children": {
"multiple": true, "multiple": true,
"required": false, "required": true,
"types": [ "types": [
{ {
"type": "attr_key", "type": "attr_key",
@ -34,11 +44,18 @@
{ {
"type": "attr_value", "type": "attr_value",
"named": true "named": true
}, }
{ ]
"type": "block", }
"named": true },
}, {
"type": "block",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{ {
"type": "connection", "type": "connection",
"named": true "named": true
@ -47,25 +64,9 @@
"type": "container", "type": "container",
"named": true "named": true
}, },
{
"type": "container_key",
"named": true
},
{
"type": "dot",
"named": true
},
{
"type": "label",
"named": true
},
{ {
"type": "shape", "type": "shape",
"named": true "named": true
},
{
"type": "shape_key",
"named": true
} }
] ]
} }
@ -151,33 +152,6 @@
] ]
} }
}, },
{
"type": "invalid",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "attr_key",
"named": true
},
{
"type": "attr_value",
"named": true
},
{
"type": "block",
"named": true
},
{
"type": "dot",
"named": true
}
]
}
},
{ {
"type": "label", "type": "label",
"named": true, "named": true,
@ -193,6 +167,11 @@
] ]
} }
}, },
{
"type": "reserved",
"named": true,
"fields": {}
},
{ {
"type": "shape", "type": "shape",
"named": true, "named": true,
@ -239,6 +218,10 @@
"multiple": true, "multiple": true,
"required": false, "required": false,
"types": [ "types": [
{
"type": "attribute",
"named": true
},
{ {
"type": "connection", "type": "connection",
"named": true "named": true
@ -307,6 +290,10 @@
"type": "constraint", "type": "constraint",
"named": false "named": false
}, },
{
"type": "direction",
"named": false
},
{ {
"type": "dot", "type": "dot",
"named": true "named": true

Binary file not shown.

View File

@ -0,0 +1,45 @@
================================================================================
Root attribute
================================================================================
direction: value
shape: oval
label: ten
constraint: utehu
icon: huell
opacity: 1
fill: red
stroke: red
stroke-width: 5
stroke-dash: 4
border-radius: 1
font-color: red
shadow: true
multiple: true
animated: true
link: https://to
near: abc
--------------------------------------------------------------------------------
(source_file
(attribute (attr_key) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value))
)

Binary file not shown.