Add full-width closing bracket support after asciiend
Allow ] (U+FF3D) after asciiend in ASCII content scanner. This enables ASCII strings inside arrays with full-width brackets: var x = [ascii...asciiend] The parser now correctly recognizes this as an array containing an ASCII string, not as a syntax error. Fixes 1 additional parsing error.
This commit is contained in:
@@ -175,6 +175,7 @@ module.exports = grammar({
|
|||||||
$.string,
|
$.string,
|
||||||
$.boolean,
|
$.boolean,
|
||||||
$.null,
|
$.null,
|
||||||
|
$.ascii_string,
|
||||||
$.array,
|
$.array,
|
||||||
$.member_expression,
|
$.member_expression,
|
||||||
$.call_expression,
|
$.call_expression,
|
||||||
@@ -186,7 +187,6 @@ module.exports = grammar({
|
|||||||
$.parenthesized_expression,
|
$.parenthesized_expression,
|
||||||
$.new_statement,
|
$.new_statement,
|
||||||
$.import_expression,
|
$.import_expression,
|
||||||
$.ascii_string,
|
|
||||||
$.color_code
|
$.color_code
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -282,10 +282,7 @@ module.exports = grammar({
|
|||||||
|
|
||||||
null: $ => 'null',
|
null: $ => 'null',
|
||||||
|
|
||||||
ascii_string: $ => choice(
|
ascii_string: $ => seq('ascii', $.ascii_content, 'asciiend')
|
||||||
seq('ascii', $.ascii_content, 'asciiend'),
|
|
||||||
seq(choice('[', '['), 'ascii', $.ascii_content, 'asciiend', choice(']', ']'))
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
extras: $ => [
|
extras: $ => [
|
||||||
|
|||||||
56
src/grammar.json
generated
56
src/grammar.json
generated
@@ -675,6 +675,10 @@
|
|||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "null"
|
"name": "null"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "ascii_string"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "array"
|
"name": "array"
|
||||||
@@ -719,10 +723,6 @@
|
|||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "import_expression"
|
"name": "import_expression"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "ascii_string"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "color_code"
|
"name": "color_code"
|
||||||
@@ -1369,9 +1369,6 @@
|
|||||||
"value": "null"
|
"value": "null"
|
||||||
},
|
},
|
||||||
"ascii_string": {
|
"ascii_string": {
|
||||||
"type": "CHOICE",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
@@ -1387,51 +1384,6 @@
|
|||||||
"value": "asciiend"
|
"value": "asciiend"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "CHOICE",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "["
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "["
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "ascii"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "ascii_content"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "asciiend"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CHOICE",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "]"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extras": [
|
"extras": [
|
||||||
|
|||||||
24950
src/parser.c
generated
24950
src/parser.c
generated
File diff suppressed because it is too large
Load Diff
@@ -138,7 +138,7 @@ bool tree_sitter_stonescript_external_scanner_scan(void *payload, TSLexer *lexer
|
|||||||
if (match && (lexer->lookahead == '\n' || lexer->lookahead == '\r' ||
|
if (match && (lexer->lookahead == '\n' || lexer->lookahead == '\r' ||
|
||||||
lexer->lookahead == ' ' || lexer->lookahead == '\t' ||
|
lexer->lookahead == ' ' || lexer->lookahead == '\t' ||
|
||||||
lexer->lookahead == ',' || lexer->lookahead == ')' ||
|
lexer->lookahead == ',' || lexer->lookahead == ')' ||
|
||||||
lexer->lookahead == ']' ||
|
lexer->lookahead == ']' || lexer->lookahead == 0xFF3D || // ] full-width
|
||||||
lexer->eof(lexer))) {
|
lexer->eof(lexer))) {
|
||||||
lexer->result_symbol = ASCII_CONTENT;
|
lexer->result_symbol = ASCII_CONTENT;
|
||||||
return has_content;
|
return has_content;
|
||||||
|
|||||||
Reference in New Issue
Block a user