fix unquoted strings and identifiers
This commit is contained in:
parent
6ec0bb5c59
commit
612b7fb871
6 changed files with 21 additions and 5 deletions
|
@ -116,7 +116,12 @@ module.exports = grammar({
|
|||
shape_key: ($) => choice($.string, seq($._identifier, optional($._dash))),
|
||||
|
||||
_identifier: ($) =>
|
||||
token(prec(PREC.IDENTIFIER, /\-?([\w\d]+|([\w\d]+( +|\-)[\w\d]+)+)/)),
|
||||
token(
|
||||
prec(
|
||||
PREC.IDENTIFIER,
|
||||
/\-?([\w\d]+([\w\d`'"]+)?|([\w\d]+([\w\d `'"]+)?( +|\-)[\w\d]+([\w\d `'"]+)?)+)/
|
||||
)
|
||||
),
|
||||
|
||||
// attributes
|
||||
|
||||
|
@ -255,7 +260,7 @@ module.exports = grammar({
|
|||
dot: ($) => token("."),
|
||||
|
||||
_unquoted_string: ($) =>
|
||||
token(prec(PREC.UNQUOTED_STRING, /[\w\-?!]([^'"`\n;{}]*[\w\-?!])?/)),
|
||||
token(prec(PREC.UNQUOTED_STRING, /[^'"`\n\s;{}]([^\n;{}]*[^\n\s;{}])?/)),
|
||||
|
||||
string: ($) =>
|
||||
choice(
|
||||
|
|
|
@ -502,7 +502,7 @@
|
|||
"value": 0,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\-?([\\w\\d]+|([\\w\\d]+( +|\\-)[\\w\\d]+)+)"
|
||||
"value": "\\-?([\\w\\d]+([\\w\\d`'\"]+)?|([\\w\\d]+([\\w\\d `'\"]+)?( +|\\-)[\\w\\d]+([\\w\\d `'\"]+)?)+)"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1103,7 +1103,7 @@
|
|||
"value": 0,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "[\\w\\-?!]([^'\"`\\n;{}]*[\\w\\-?!])?"
|
||||
"value": "[^'\"`\\n\\s;{}]([^\\n;{}]*[^\\n\\s;{}])?"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
BIN
src/parser.c
BIN
src/parser.c
Binary file not shown.
|
@ -6,7 +6,7 @@ direction: value
|
|||
shape: oval
|
||||
label: ten
|
||||
constraint: utehu
|
||||
icon: huell
|
||||
icon: ./test.svg
|
||||
opacity: 1
|
||||
fill: red
|
||||
stroke: red
|
||||
|
@ -392,3 +392,4 @@ foo -> bar: {
|
|||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -26,12 +26,22 @@ Complex shape key
|
|||
================================================================================
|
||||
Foo bar
|
||||
-Biz-baz-
|
||||
imAShape
|
||||
im_a_shape
|
||||
im a shape
|
||||
i'm a shape
|
||||
a-shape
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(shape (shape_key))
|
||||
(shape (shape_key))
|
||||
(shape (shape_key))
|
||||
(shape (shape_key))
|
||||
(shape (shape_key))
|
||||
(shape (shape_key))
|
||||
(shape (shape_key))
|
||||
)
|
||||
|
||||
================================================================================
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue