From 3b2e0e7fae1c80fc3e7a1a6ef92579cb33addd7a Mon Sep 17 00:00:00 2001 From: blindfs Date: Sat, 23 Aug 2025 16:42:46 +0800 Subject: [PATCH] fix: allow colon in short flags --- grammar.js | 3 ++- src/grammar.json | 2 +- src/parser.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/grammar.js b/grammar.js index 2a85b44e..6d606fd9 100644 --- a/grammar.js +++ b/grammar.js @@ -1246,7 +1246,8 @@ module.exports = grammar({ optional($._flag_equals_value), ), - short_flag_identifier: (_$) => token.immediate(/[\p{XID_Continue}?@!%_-]+/), + short_flag_identifier: (_$) => + token.immediate(/[\p{XID_Continue}:?@!%_-]+/), long_flag: ($) => seq( diff --git a/src/grammar.json b/src/grammar.json index 7cf48552..790495d0 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -16011,7 +16011,7 @@ "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", - "value": "[\\p{XID_Continue}?@!%_-]+" + "value": "[\\p{XID_Continue}:?@!%_-]+" } }, "long_flag": { diff --git a/src/parser.c b/src/parser.c index 71be5d9a..fd7856db 100644 --- a/src/parser.c +++ b/src/parser.c @@ -11103,7 +11103,7 @@ static const TSCharacterRange aux_sym__record_key_token1_character_set_1[] = { }; static const TSCharacterRange sym_short_flag_identifier_character_set_1[] = { - {'!', '!'}, {'%', '%'}, {'-', '-'}, {'0', '9'}, {'?', 'Z'}, {'_', '_'}, {'a', 'z'}, {0xaa, 0xaa}, + {'!', '!'}, {'%', '%'}, {'-', '-'}, {'0', ':'}, {'?', 'Z'}, {'_', '_'}, {'a', 'z'}, {0xaa, 0xaa}, {0xb5, 0xb5}, {0xb7, 0xb7}, {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6}, {0xf8, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, {0x2ec, 0x2ec}, {0x2ee, 0x2ee}, {0x300, 0x374}, {0x376, 0x377}, {0x37b, 0x37d}, {0x37f, 0x37f}, {0x386, 0x38a}, {0x38c, 0x38c}, {0x38e, 0x3a1}, {0x3a3, 0x3f5}, {0x3f7, 0x481}, {0x483, 0x487}, {0x48a, 0x52f}, {0x531, 0x556}, {0x559, 0x559}, {0x560, 0x588},