parent
0003298cb8
commit
fdcb5613a5
5 changed files with 59 additions and 10 deletions
|
@ -199,14 +199,15 @@ module.exports = grammar({
|
||||||
|
|
||||||
_identifier: ($) =>
|
_identifier: ($) =>
|
||||||
seq(
|
seq(
|
||||||
choice(/[\w\d$-]/, $.escape_sequence),
|
choice(token(prec(PREC.IDENTIFIER, /[\w\d$-]/)), $.escape_sequence),
|
||||||
repeat(
|
repeat(
|
||||||
choice(
|
choice(
|
||||||
$.escape_sequence,
|
$.escape_sequence,
|
||||||
token(prec(PREC.IDENTIFIER, /([\w\d'"$(),]+)?( +|-)[\w\d'"$()]+/))
|
token(prec(PREC.IDENTIFIER, /[\w\d'"$(),]+/)),
|
||||||
|
token(prec(PREC.IDENTIFIER, /( +|-)[\w\d'"$()]+/))
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
optional(/[\w\d'"$()]+/),
|
optional(token(prec(PREC.IDENTIFIER, /[\w\d'"$()]+/))),
|
||||||
optional($._dash)
|
optional($._dash)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -388,7 +389,7 @@ module.exports = grammar({
|
||||||
token(
|
token(
|
||||||
prec(
|
prec(
|
||||||
PREC.UNQUOTED_STRING,
|
PREC.UNQUOTED_STRING,
|
||||||
/[^'"`\\|\n\s;{}\[\]]([^\\\n;{}\[\]]*[^\\\n\s;{}\[\]])?/
|
/[^'"`\\|\n\s;{}\[\]][^\\\n;{}\[\]]*[^\\\n\s;{}\[\]]?/
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -866,8 +866,15 @@
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "PATTERN",
|
"type": "TOKEN",
|
||||||
"value": "[\\w\\d$-]"
|
"content": {
|
||||||
|
"type": "PREC",
|
||||||
|
"value": 0,
|
||||||
|
"content": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[\\w\\d$-]"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
|
@ -891,7 +898,18 @@
|
||||||
"value": 0,
|
"value": 0,
|
||||||
"content": {
|
"content": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "([\\w\\d'\"$(),]+)?( +|-)[\\w\\d'\"$()]+"
|
"value": "[\\w\\d'\"$(),]+"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "PREC",
|
||||||
|
"value": 0,
|
||||||
|
"content": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "( +|-)[\\w\\d'\"$()]+"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -902,8 +920,15 @@
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "PATTERN",
|
"type": "TOKEN",
|
||||||
"value": "[\\w\\d'\"$()]+"
|
"content": {
|
||||||
|
"type": "PREC",
|
||||||
|
"value": 0,
|
||||||
|
"content": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[\\w\\d'\"$()]+"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "BLANK"
|
"type": "BLANK"
|
||||||
|
@ -2047,7 +2072,7 @@
|
||||||
"value": -1,
|
"value": -1,
|
||||||
"content": {
|
"content": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[^'\"`\\\\|\\n\\s;{}\\[\\]]([^\\\\\\n;{}\\[\\]]*[^\\\\\\n\\s;{}\\[\\]])?"
|
"value": "[^'\"`\\\\|\\n\\s;{}\\[\\]][^\\\\\\n;{}\\[\\]]*[^\\\\\\n\\s;{}\\[\\]]?"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
src/parser.c
BIN
src/parser.c
Binary file not shown.
|
@ -1,3 +1,26 @@
|
||||||
|
================================================================================
|
||||||
|
Declare unquoted shape identifier with escape sequence (issue #21)
|
||||||
|
================================================================================
|
||||||
|
hello\[world\]
|
||||||
|
\#ello\[world\]
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(shape
|
||||||
|
(shape_key
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(shape
|
||||||
|
(shape_key
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Handle end of file (issue #1)
|
Handle end of file (issue #1)
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue