parent
32b1fa5555
commit
6a04387009
9 changed files with 84 additions and 10 deletions
|
@ -190,6 +190,8 @@ module.exports = grammar({
|
|||
choice(
|
||||
"shape",
|
||||
"label",
|
||||
"link",
|
||||
"tooltip",
|
||||
// sql
|
||||
"constraint",
|
||||
// image
|
||||
|
|
|
@ -777,6 +777,14 @@
|
|||
"type": "STRING",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "link"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "tooltip"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "constraint"
|
||||
|
@ -1286,15 +1294,27 @@
|
|||
}
|
||||
},
|
||||
"_unquoted_string": {
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "escape_sequence"
|
||||
},
|
||||
{
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
"value": -1,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^'\"`|\\n\\s;{}]([^\\n;{}]*[^\\n\\s;{}])?"
|
||||
"value": "[^'\"`\\\\|\\n\\s;{}]([^\\\\\\n;{}]*[^\\\\\\n\\s;{}])?"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"string": {
|
||||
"type": "CHOICE",
|
||||
|
|
|
@ -19,13 +19,17 @@
|
|||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "escape_sequence",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "float",
|
||||
"named": true
|
||||
|
@ -202,9 +206,13 @@
|
|||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "escape_sequence",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"named": true
|
||||
|
@ -476,6 +484,10 @@
|
|||
"type": "target-arrowhead",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "tooltip",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "true",
|
||||
"named": false
|
||||
|
|
BIN
src/parser.c
BIN
src/parser.c
Binary file not shown.
|
@ -125,6 +125,8 @@ foo: {
|
|||
icon: pathto
|
||||
width: 100
|
||||
height: 200
|
||||
link: https://microsoft.com
|
||||
tooltip: Gee, I feel kind of LIGHT in the head now,\nknowing I can't make my satellite dish PAYMENTS!
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -139,6 +141,8 @@ foo: {
|
|||
(attribute (attr_key) (attr_value))
|
||||
(attribute (attr_key) (attr_value (integer)))
|
||||
(attribute (attr_key) (attr_value (integer)))
|
||||
(attribute (attr_key) (attr_value))
|
||||
(attribute (attr_key) (attr_value (escape_sequence)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -103,6 +103,21 @@ a: Foo Bar; b: Biz Baz
|
|||
(shape (shape_key) (label))
|
||||
)
|
||||
|
||||
================================================================================
|
||||
Label with escape sequence
|
||||
================================================================================
|
||||
a: Foo\nB\#ar
|
||||
a: Foo\nB\@r; b: Biz\nBaz
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(shape (shape_key) (label (escape_sequence) (escape_sequence)))
|
||||
(shape (shape_key) (label (escape_sequence) (escape_sequence)))
|
||||
(shape (shape_key) (label (escape_sequence)))
|
||||
)
|
||||
|
||||
|
||||
================================================================================
|
||||
It should skip white spaces
|
||||
================================================================================
|
||||
|
|
|
@ -26,7 +26,6 @@ foo: Label {
|
|||
# ^ property
|
||||
}
|
||||
|
||||
|
||||
foo: {
|
||||
style: {
|
||||
opacity: 0.5
|
||||
|
@ -43,3 +42,18 @@ foo: {
|
|||
# ^ boolean
|
||||
}
|
||||
}
|
||||
|
||||
foo: Label {
|
||||
tooltip: Gee, I feel kind of LIGHT in the head now,\nknowing I can't make my satellite dish PAYMENTS!
|
||||
# <- property
|
||||
# ^ string
|
||||
# ^ string.escape
|
||||
|
||||
link: https://microsoft.com
|
||||
# <- property
|
||||
# ^ string
|
||||
|
||||
style.fill: red
|
||||
# <- property
|
||||
# ^ property
|
||||
}
|
||||
|
|
|
@ -35,3 +35,10 @@ foo: Foo Bar {
|
|||
# ^ variable
|
||||
}
|
||||
# <- punctuation.bracket
|
||||
|
||||
foo: Foo\#Ba\@r {
|
||||
# ^ text.title
|
||||
# ^ string.escape
|
||||
# ^ text.title
|
||||
# ^ string.escape
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue