diff --git a/CMakeLists.txt b/CMakeLists.txt index e94eb1b..45a2c4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.13) project(tree-sitter-dotenv - VERSION "1.1.3" + VERSION "1.1.2" DESCRIPTION "Dotenv grammar for tree-sitter" HOMEPAGE_URL "https://github.com/pnx/tree-sitter-dotenv" LANGUAGES C) diff --git a/Cargo.toml b/Cargo.toml index 7b4eb73..a5ac602 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-dotenv" description = "Dotenv grammar for tree-sitter" -version = "1.1.3" +version = "1.1.2" license = "MIT" readme = "README.md" keywords = ["incremental", "parsing", "tree-sitter", "dotenv"] @@ -23,4 +23,4 @@ tree-sitter-language = "0.1" cc = "1.0.87" [dev-dependencies] -tree-sitter = "0.27.0" +tree-sitter = "0.26.5" diff --git a/Makefile b/Makefile index e0977a4..8930634 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ ifeq ($(OS),Windows_NT) $(error Windows is not supported) endif -VERSION := 1.1.3 +VERSION := 1.1.2 LANGUAGE_NAME := tree-sitter-dotenv diff --git a/grammar.js b/grammar.js index f973b9c..c808b0a 100644 --- a/grammar.js +++ b/grammar.js @@ -45,12 +45,10 @@ module.exports = grammar({ comment: _ => /\#[^\n]*/, identifier: _ => /[A-Za-z_][A-Za-z0-9_]*/, - variable: $ => choice( - seq('$', $.identifier), - $._braced_variable, - ), - - _braced_variable: $ => seq('$', '{', $.identifier, '}'), + variable: $ => seq('$', choice( + $.identifier, + seq('{', $.identifier, '}') + )), _value: $ => choice( $.string, @@ -68,35 +66,7 @@ module.exports = grammar({ $._unquoted_string, ), - _unquoted_string: $ => choice( - alias($._unquoted_content, $.string_content), - seq( - choice( - alias($.value, $.string_content), - alias($.boolean, $.string_content), - alias($.decimal, $.string_content), - alias($.hexadecimal, $.string_content), - alias($.float, $.string_content), - alias($._unquoted_content, $.string_content), - ), - alias($._braced_variable, $.variable), - optional(choice( - alias($.value, $.string_content), - alias($._unquoted_content, $.string_content), - )), - ), - ), - - _unquoted_content: _ => token(choice( - /[^\#\s\"\'\$]+(?:[ \t]+[^\#\s\"\'\$]+)+/, - seq( - /[^\#\s\"\'\$]+(?:[ \t]+[^\#\s\"\'\$]+)*/, - repeat1(seq( - /\$[A-Za-z_][A-Za-z0-9_]*/, - optional(/(?:[ \t]*[^\#\s\"\'\$]+)+/), - )), - ), - )), + _unquoted_string: $ => alias(/[^\#\s\"\'\$]+(?:[ \t]+[^\#\s\"\'\$]+)+/, $.string_content), _literal_string: $ => seq( "'", diff --git a/package-lock.json b/package-lock.json index acd9a7f..d85ede1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tree-sitter-dotenv", - "version": "1.1.2", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tree-sitter-dotenv", - "version": "1.1.2", + "version": "1.1.1", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -15,7 +15,7 @@ }, "devDependencies": { "prebuildify": "^6.0.1", - "tree-sitter-cli": "^0.27.1" + "tree-sitter-cli": "^0.26.12" }, "peerDependencies": { "tree-sitter": "^0.21.1" @@ -338,9 +338,9 @@ } }, "node_modules/tree-sitter-cli": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.27.1.tgz", - "integrity": "sha512-WFPEjxwscCjZP9uYj0rxT2TyGBkDcXUkGTthrMpxZFGvzXEYsbC3J0633Ps8dd2mMsdsbU8oVwmQ148lLHI7Xw==", + "version": "0.26.12", + "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.26.12.tgz", + "integrity": "sha512-rIdMAm6nv75MVFoZ7UTaLVB1OG5h3ZSlCZEp5pne4gOUTalJIkL0A1NlYBg0oEl/d7gvIyc2Y5Jz8m5Xj+NOEw==", "dev": true, "hasInstallScript": true, "license": "MIT", diff --git a/package.json b/package.json index 6be92da..fd10eb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tree-sitter-dotenv", - "version": "1.1.3", + "version": "1.1.2", "description": "Dotenv grammar for tree-sitter", "repository": "github:pnx/tree-sitter-dotenv", "license": "MIT", @@ -27,7 +27,7 @@ }, "devDependencies": { "prebuildify": "^6.0.1", - "tree-sitter-cli": "^0.27.1" + "tree-sitter-cli": "^0.26.12" }, "peerDependencies": { "tree-sitter": "^0.21.1" diff --git a/pyproject.toml b/pyproject.toml index 0274cd1..68f68c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "tree-sitter-dotenv" description = "Dotenv grammar for tree-sitter" -version = "1.1.3" +version = "1.1.2" keywords = ["incremental", "parsing", "tree-sitter", "dotenv"] classifiers = [ "Intended Audience :: Developers", diff --git a/src/grammar.json b/src/grammar.json index 1f921db..fbaac81 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -143,28 +143,6 @@ "value": "[A-Za-z_][A-Za-z0-9_]*" }, "variable": { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "$" - }, - { - "type": "SYMBOL", - "name": "identifier" - } - ] - }, - { - "type": "SYMBOL", - "name": "_braced_variable" - } - ] - }, - "_braced_variable": { "type": "SEQ", "members": [ { @@ -172,16 +150,30 @@ "value": "$" }, { - "type": "STRING", - "value": "{" - }, - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "STRING", - "value": "}" + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{" + }, + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "STRING", + "value": "}" + } + ] + } + ] } ] }, @@ -228,167 +220,13 @@ ] }, "_unquoted_string": { - "type": "CHOICE", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_unquoted_content" - }, - "named": true, - "value": "string_content" - }, - { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "value" - }, - "named": true, - "value": "string_content" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "boolean" - }, - "named": true, - "value": "string_content" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "decimal" - }, - "named": true, - "value": "string_content" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "hexadecimal" - }, - "named": true, - "value": "string_content" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "float" - }, - "named": true, - "value": "string_content" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_unquoted_content" - }, - "named": true, - "value": "string_content" - } - ] - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_braced_variable" - }, - "named": true, - "value": "variable" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "value" - }, - "named": true, - "value": "string_content" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_unquoted_content" - }, - "named": true, - "value": "string_content" - } - ] - }, - { - "type": "BLANK" - } - ] - } - ] - } - ] - }, - "_unquoted_content": { - "type": "TOKEN", + "type": "ALIAS", "content": { - "type": "CHOICE", - "members": [ - { - "type": "PATTERN", - "value": "[^\\#\\s\\\"\\'\\$]+(?:[ \\t]+[^\\#\\s\\\"\\'\\$]+)+" - }, - { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[^\\#\\s\\\"\\'\\$]+(?:[ \\t]+[^\\#\\s\\\"\\'\\$]+)*" - }, - { - "type": "REPEAT1", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "\\$[A-Za-z_][A-Za-z0-9_]*" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "PATTERN", - "value": "(?:[ \\t]*[^\\#\\s\\\"\\'\\$]+)+" - }, - { - "type": "BLANK" - } - ] - } - ] - } - } - ] - } - ] - } + "type": "PATTERN", + "value": "[^\\#\\s\\\"\\'\\$]+(?:[ \\t]+[^\\#\\s\\\"\\'\\$]+)+" + }, + "named": true, + "value": "string_content" }, "_literal_string": { "type": "SEQ", diff --git a/src/parser.c b/src/parser.c index 842e11c..7966ed8 100644 --- a/src/parser.c +++ b/src/parser.c @@ -7,16 +7,16 @@ #endif #define LANGUAGE_VERSION 15 -#define STATE_COUNT 55 +#define STATE_COUNT 47 #define LARGE_STATE_COUNT 6 -#define SYMBOL_COUNT 32 +#define SYMBOL_COUNT 31 #define ALIAS_COUNT 0 #define TOKEN_COUNT 19 #define EXTERNAL_TOKEN_COUNT 1 #define FIELD_COUNT 2 #define MAX_ALIAS_SEQUENCE_LENGTH 5 #define MAX_RESERVED_WORD_SET_SIZE 0 -#define PRODUCTION_ID_COUNT 12 +#define PRODUCTION_ID_COUNT 9 #define SUPERTYPE_COUNT 0 enum ts_symbol_identifiers { @@ -27,7 +27,7 @@ enum ts_symbol_identifiers { anon_sym_DOLLAR = 5, anon_sym_LBRACE = 6, anon_sym_RBRACE = 7, - sym__unquoted_content = 8, + aux_sym__unquoted_string_token1 = 8, anon_sym_SQUOTE = 9, aux_sym__literal_string_token1 = 10, anon_sym_DQUOTE = 11, @@ -41,16 +41,15 @@ enum ts_symbol_identifiers { sym_document = 19, sym_assignment = 20, sym_variable = 21, - sym__braced_variable = 22, - sym__value = 23, - sym_string = 24, - sym__unquoted_string = 25, - sym__literal_string = 26, - sym__string = 27, - sym_number = 28, - sym_integer = 29, - aux_sym_document_repeat1 = 30, - aux_sym__string_repeat1 = 31, + sym__value = 22, + sym_string = 23, + sym__unquoted_string = 24, + sym__literal_string = 25, + sym__string = 26, + sym_number = 27, + sym_integer = 28, + aux_sym_document_repeat1 = 29, + aux_sym__string_repeat1 = 30, }; static const char * const ts_symbol_names[] = { @@ -62,7 +61,7 @@ static const char * const ts_symbol_names[] = { [anon_sym_DOLLAR] = "$", [anon_sym_LBRACE] = "{", [anon_sym_RBRACE] = "}", - [sym__unquoted_content] = "string_content", + [aux_sym__unquoted_string_token1] = "string_content", [anon_sym_SQUOTE] = "'", [aux_sym__literal_string_token1] = "string_content", [anon_sym_DQUOTE] = "\"", @@ -76,7 +75,6 @@ static const char * const ts_symbol_names[] = { [sym_document] = "document", [sym_assignment] = "assignment", [sym_variable] = "variable", - [sym__braced_variable] = "_braced_variable", [sym__value] = "_value", [sym_string] = "string", [sym__unquoted_string] = "_unquoted_string", @@ -97,11 +95,11 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_DOLLAR] = anon_sym_DOLLAR, [anon_sym_LBRACE] = anon_sym_LBRACE, [anon_sym_RBRACE] = anon_sym_RBRACE, - [sym__unquoted_content] = sym__unquoted_content, + [aux_sym__unquoted_string_token1] = aux_sym__unquoted_string_token1, [anon_sym_SQUOTE] = anon_sym_SQUOTE, - [aux_sym__literal_string_token1] = sym__unquoted_content, + [aux_sym__literal_string_token1] = aux_sym__unquoted_string_token1, [anon_sym_DQUOTE] = anon_sym_DQUOTE, - [aux_sym__string_token1] = sym__unquoted_content, + [aux_sym__string_token1] = aux_sym__unquoted_string_token1, [sym_decimal] = sym_decimal, [sym_hexadecimal] = sym_hexadecimal, [sym_float] = sym_float, @@ -111,7 +109,6 @@ static const TSSymbol ts_symbol_map[] = { [sym_document] = sym_document, [sym_assignment] = sym_assignment, [sym_variable] = sym_variable, - [sym__braced_variable] = sym__braced_variable, [sym__value] = sym__value, [sym_string] = sym_string, [sym__unquoted_string] = sym__unquoted_string, @@ -156,7 +153,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, - [sym__unquoted_content] = { + [aux_sym__unquoted_string_token1] = { .visible = true, .named = true, }, @@ -212,10 +209,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, - [sym__braced_variable] = { - .visible = false, - .named = true, - }, [sym__value] = { .visible = false, .named = true, @@ -267,13 +260,13 @@ static const char * const ts_field_names[] = { static const TSMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { [1] = {.index = 0, .length = 1}, - [3] = {.index = 0, .length = 1}, - [4] = {.index = 1, .length = 1}, + [2] = {.index = 0, .length = 1}, + [3] = {.index = 1, .length = 1}, + [4] = {.index = 2, .length = 2}, + [5] = {.index = 1, .length = 1}, [6] = {.index = 2, .length = 2}, - [7] = {.index = 1, .length = 1}, - [8] = {.index = 2, .length = 2}, - [9] = {.index = 4, .length = 2}, - [11] = {.index = 4, .length = 2}, + [7] = {.index = 4, .length = 2}, + [8] = {.index = 4, .length = 2}, }; static const TSFieldMapEntry ts_field_map_entries[] = { @@ -294,33 +287,18 @@ static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE [1] = { [0] = sym_identifier, }, - [2] = { - [0] = sym__unquoted_content, + [3] = { + [1] = sym_identifier, }, [4] = { - [1] = sym_identifier, - }, - [5] = { - [0] = sym__unquoted_content, - [1] = sym_variable, - }, - [6] = { [0] = sym_identifier, }, - [9] = { + [7] = { [1] = sym_identifier, }, - [10] = { - [0] = sym__unquoted_content, - [1] = sym_variable, - [2] = sym__unquoted_content, - }, }; static const uint16_t ts_non_terminal_alias_map[] = { - sym__braced_variable, 2, - sym__braced_variable, - sym_variable, 0, }; @@ -348,15 +326,15 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [20] = 20, [21] = 21, [22] = 22, - [23] = 23, + [23] = 22, [24] = 24, [25] = 25, [26] = 26, [27] = 27, - [28] = 25, + [28] = 28, [29] = 29, [30] = 30, - [31] = 30, + [31] = 31, [32] = 32, [33] = 33, [34] = 34, @@ -366,20 +344,12 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [38] = 38, [39] = 39, [40] = 40, - [41] = 41, + [41] = 21, [42] = 42, - [43] = 43, + [43] = 20, [44] = 44, - [45] = 45, - [46] = 26, - [47] = 47, - [48] = 27, - [49] = 49, - [50] = 50, - [51] = 51, - [52] = 52, - [53] = 42, - [54] = 49, + [45] = 36, + [46] = 44, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -387,414 +357,372 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(12); + if (eof) ADVANCE(10); ADVANCE_MAP( - '"', 30, - '#', 14, - '$', 22, - '\'', 27, - '-', 7, + '"', 27, + '#', 12, + '$', 20, + '\'', 24, + '-', 6, '0', 5, - '=', 13, - 'f', 15, - 't', 18, - '{', 23, - '}', 24, + '=', 11, + 'f', 13, + 't', 16, + '{', 21, + '}', 22, ); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(0); - if (('1' <= lookahead && lookahead <= '9')) ADVANCE(34); + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(30); if (('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 1: - if (lookahead == '"') ADVANCE(30); - if (lookahead == '$') ADVANCE(22); - if (lookahead == '\'') ADVANCE(27); - if (lookahead == '-') ADVANCE(47); - if (lookahead == '0') ADVANCE(46); - if (lookahead == 'f') ADVANCE(40); - if (lookahead == 't') ADVANCE(43); + if (lookahead == '"') ADVANCE(27); + if (lookahead == '$') ADVANCE(20); + if (lookahead == '\'') ADVANCE(24); + if (lookahead == '-') ADVANCE(44); + if (lookahead == '0') ADVANCE(43); + if (lookahead == 'f') ADVANCE(37); + if (lookahead == 't') ADVANCE(40); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(1); - if (('1' <= lookahead && lookahead <= '9')) ADVANCE(33); + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(31); if (lookahead != 0 && - (lookahead < '"' || '$' < lookahead)) ADVANCE(50); + (lookahead < '"' || '$' < lookahead)) ADVANCE(47); END_STATE(); case 2: - if (lookahead == '"') ADVANCE(30); - if (lookahead == '$') ADVANCE(22); - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') ADVANCE(31); - if (lookahead != 0) ADVANCE(32); - END_STATE(); - case 3: - if (lookahead == '\'') ADVANCE(27); + if (lookahead == '"') ADVANCE(27); + if (lookahead == '$') ADVANCE(20); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(28); if (lookahead != 0) ADVANCE(29); END_STATE(); + case 3: + if (lookahead == '\'') ADVANCE(24); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(25); + if (lookahead != 0) ADVANCE(26); + END_STATE(); case 4: if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(26); + lookahead != '\'') ADVANCE(23); END_STATE(); case 5: if (lookahead == 'X' || - lookahead == 'x') ADVANCE(9); + lookahead == 'x') ADVANCE(8); END_STATE(); case 6: - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') SKIP(6); - if (lookahead != 0 && - (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(30); END_STATE(); case 7: - if (('1' <= lookahead && lookahead <= '9')) ADVANCE(34); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(35); END_STATE(); case 8: - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(38); - END_STATE(); - case 9: if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(36); + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(33); + END_STATE(); + case 9: + if (eof) ADVANCE(10); + if (lookahead == '#') ADVANCE(12); + if (lookahead == '=') ADVANCE(11); + if (lookahead == '{') ADVANCE(21); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') SKIP(9); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 10: - if (('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(25); - END_STATE(); - case 11: - if (eof) ADVANCE(12); - if (lookahead == '#') ADVANCE(14); - if (lookahead == '=') ADVANCE(13); - if (lookahead == '{') ADVANCE(23); - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') SKIP(11); - if (('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); - END_STATE(); - case 12: ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); - case 13: + case 11: ACCEPT_TOKEN(anon_sym_EQ); END_STATE(); - case 14: + case 12: ACCEPT_TOKEN(sym_comment); if (lookahead != 0 && - lookahead != '\n') ADVANCE(14); + lookahead != '\n') ADVANCE(12); + END_STATE(); + case 13: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'a') ADVANCE(15); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(19); + END_STATE(); + case 14: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'e') ADVANCE(19); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 15: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'a') ADVANCE(17); + if (lookahead == 'l') ADVANCE(17); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('b' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 16: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'e') ADVANCE(21); + if (lookahead == 'r') ADVANCE(18); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 17: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'l') ADVANCE(19); + if (lookahead == 's') ADVANCE(14); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 18: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'r') ADVANCE(20); + if (lookahead == 'u') ADVANCE(14); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 19: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 's') ADVANCE(16); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); END_STATE(); case 20: - ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'u') ADVANCE(16); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); - END_STATE(); - case 21: - ACCEPT_TOKEN(sym_identifier); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); - END_STATE(); - case 22: ACCEPT_TOKEN(anon_sym_DOLLAR); END_STATE(); - case 23: + case 21: ACCEPT_TOKEN(anon_sym_LBRACE); END_STATE(); - case 24: + case 22: ACCEPT_TOKEN(anon_sym_RBRACE); END_STATE(); - case 25: - ACCEPT_TOKEN(sym__unquoted_content); - if (lookahead == '$') ADVANCE(10); + case 23: + ACCEPT_TOKEN(aux_sym__unquoted_string_token1); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(25); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && + lookahead != '\'') ADVANCE(23); + END_STATE(); + case 24: + ACCEPT_TOKEN(anon_sym_SQUOTE); + END_STATE(); + case 25: + ACCEPT_TOKEN(aux_sym__literal_string_token1); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(25); + if (lookahead != 0 && lookahead != '\'') ADVANCE(26); END_STATE(); case 26: - ACCEPT_TOKEN(sym__unquoted_content); - if (lookahead == '$') ADVANCE(10); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); + ACCEPT_TOKEN(aux_sym__literal_string_token1); if (lookahead != 0 && - (lookahead < '\t' || '\r' < lookahead) && - (lookahead < '"' || '$' < lookahead) && lookahead != '\'') ADVANCE(26); END_STATE(); case 27: - ACCEPT_TOKEN(anon_sym_SQUOTE); + ACCEPT_TOKEN(anon_sym_DQUOTE); END_STATE(); case 28: - ACCEPT_TOKEN(aux_sym__literal_string_token1); + ACCEPT_TOKEN(aux_sym__string_token1); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(28); if (lookahead != 0 && - lookahead != '\'') ADVANCE(29); + lookahead != '"' && + lookahead != '$') ADVANCE(29); END_STATE(); case 29: - ACCEPT_TOKEN(aux_sym__literal_string_token1); + ACCEPT_TOKEN(aux_sym__string_token1); if (lookahead != 0 && - lookahead != '\'') ADVANCE(29); + lookahead != '"' && + lookahead != '$') ADVANCE(29); END_STATE(); case 30: - ACCEPT_TOKEN(anon_sym_DQUOTE); + ACCEPT_TOKEN(sym_decimal); + if (lookahead == '.') ADVANCE(7); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(30); END_STATE(); case 31: - ACCEPT_TOKEN(aux_sym__string_token1); - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') ADVANCE(31); + ACCEPT_TOKEN(sym_decimal); + if (lookahead == '.') ADVANCE(45); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(4); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(31); if (lookahead != 0 && - lookahead != '"' && - lookahead != '$') ADVANCE(32); + (lookahead < '\t' || '\r' < lookahead) && + (lookahead < '"' || '$' < lookahead) && + lookahead != '\'') ADVANCE(47); END_STATE(); case 32: - ACCEPT_TOKEN(aux_sym__string_token1); + ACCEPT_TOKEN(sym_hexadecimal); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(4); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(32); if (lookahead != 0 && - lookahead != '"' && - lookahead != '$') ADVANCE(32); + (lookahead < '\t' || '\r' < lookahead) && + (lookahead < '"' || '$' < lookahead) && + lookahead != '\'') ADVANCE(47); END_STATE(); case 33: - ACCEPT_TOKEN(sym_decimal); - if (lookahead == '$') ADVANCE(10); - if (lookahead == '.') ADVANCE(48); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(33); - if (lookahead != 0 && - (lookahead < '\t' || '\r' < lookahead) && - (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + ACCEPT_TOKEN(sym_hexadecimal); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(33); END_STATE(); case 34: - ACCEPT_TOKEN(sym_decimal); - if (lookahead == '.') ADVANCE(8); + ACCEPT_TOKEN(sym_float); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(4); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(34); + if (lookahead != 0 && + (lookahead < '\t' || '\r' < lookahead) && + (lookahead < '"' || '$' < lookahead) && + lookahead != '\'') ADVANCE(47); END_STATE(); case 35: - ACCEPT_TOKEN(sym_hexadecimal); - if (lookahead == '$') ADVANCE(10); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(35); - if (lookahead != 0 && - (lookahead < '\t' || '\r' < lookahead) && - (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + ACCEPT_TOKEN(sym_float); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(35); END_STATE(); case 36: - ACCEPT_TOKEN(sym_hexadecimal); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(36); + ACCEPT_TOKEN(sym_boolean); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(4); + if (lookahead != 0 && + (lookahead < '\t' || '\r' < lookahead) && + (lookahead < '"' || '$' < lookahead) && + lookahead != '\'') ADVANCE(47); END_STATE(); case 37: - ACCEPT_TOKEN(sym_float); - if (lookahead == '$') ADVANCE(10); + ACCEPT_TOKEN(sym_value); + if (lookahead == 'a') ADVANCE(39); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(37); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); case 38: - ACCEPT_TOKEN(sym_float); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(38); - END_STATE(); - case 39: - ACCEPT_TOKEN(sym_boolean); - if (lookahead == '$') ADVANCE(10); + ACCEPT_TOKEN(sym_value); + if (lookahead == 'e') ADVANCE(36); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); + END_STATE(); + case 39: + ACCEPT_TOKEN(sym_value); + if (lookahead == 'l') ADVANCE(41); + if (lookahead == '\t' || + lookahead == ' ') ADVANCE(4); + if (lookahead != 0 && + (lookahead < '\t' || '\r' < lookahead) && + (lookahead < '"' || '$' < lookahead) && + lookahead != '\'') ADVANCE(47); END_STATE(); case 40: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); - if (lookahead == 'a') ADVANCE(42); + if (lookahead == 'r') ADVANCE(42); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); case 41: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); - if (lookahead == 'e') ADVANCE(39); + if (lookahead == 's') ADVANCE(38); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); case 42: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); - if (lookahead == 'l') ADVANCE(44); + if (lookahead == 'u') ADVANCE(38); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); case 43: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); - if (lookahead == 'r') ADVANCE(45); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); - if (lookahead != 0 && - (lookahead < '\t' || '\r' < lookahead) && - (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); - END_STATE(); - case 44: - ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); - if (lookahead == 's') ADVANCE(41); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); - if (lookahead != 0 && - (lookahead < '\t' || '\r' < lookahead) && - (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); - END_STATE(); - case 45: - ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); - if (lookahead == 'u') ADVANCE(41); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(4); - if (lookahead != 0 && - (lookahead < '\t' || '\r' < lookahead) && - (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); - END_STATE(); - case 46: - ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead == 'X' || - lookahead == 'x') ADVANCE(49); + lookahead == 'x') ADVANCE(46); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); - case 47: + case 44: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); - if (('1' <= lookahead && lookahead <= '9')) ADVANCE(33); + if (('1' <= lookahead && lookahead <= '9')) ADVANCE(31); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); - case 48: + case 45: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(37); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(34); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); - case 49: + case 46: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(35); + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(32); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); - case 50: + case 47: ACCEPT_TOKEN(sym_value); - if (lookahead == '$') ADVANCE(10); if (lookahead == '\t' || lookahead == ' ') ADVANCE(4); if (lookahead != 0 && (lookahead < '\t' || '\r' < lookahead) && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'') ADVANCE(50); + lookahead != '\'') ADVANCE(47); END_STATE(); default: return false; @@ -835,60 +763,52 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { static const TSLexerMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0, .external_lex_state = 1}, - [1] = {.lex_state = 11}, + [1] = {.lex_state = 9}, [2] = {.lex_state = 1, .external_lex_state = 1}, [3] = {.lex_state = 1, .external_lex_state = 1}, [4] = {.lex_state = 1, .external_lex_state = 1}, [5] = {.lex_state = 1, .external_lex_state = 1}, - [6] = {.lex_state = 11}, - [7] = {.lex_state = 2}, - [8] = {.lex_state = 11}, + [6] = {.lex_state = 9}, + [7] = {.lex_state = 9}, + [8] = {.lex_state = 2}, [9] = {.lex_state = 2}, [10] = {.lex_state = 2}, - [11] = {.lex_state = 11}, - [12] = {.lex_state = 11}, - [13] = {.lex_state = 11}, - [14] = {.lex_state = 11}, - [15] = {.lex_state = 11}, - [16] = {.lex_state = 11}, - [17] = {.lex_state = 11}, - [18] = {.lex_state = 11}, - [19] = {.lex_state = 0, .external_lex_state = 1}, - [20] = {.lex_state = 0, .external_lex_state = 1}, - [21] = {.lex_state = 0, .external_lex_state = 1}, - [22] = {.lex_state = 0, .external_lex_state = 1}, - [23] = {.lex_state = 11}, - [24] = {.lex_state = 6, .external_lex_state = 1}, - [25] = {.lex_state = 6, .external_lex_state = 1}, - [26] = {.lex_state = 2}, - [27] = {.lex_state = 2}, - [28] = {.lex_state = 2}, - [29] = {.lex_state = 3}, - [30] = {.lex_state = 11}, - [31] = {.lex_state = 11}, + [11] = {.lex_state = 9}, + [12] = {.lex_state = 9}, + [13] = {.lex_state = 9}, + [14] = {.lex_state = 9}, + [15] = {.lex_state = 9}, + [16] = {.lex_state = 9}, + [17] = {.lex_state = 9}, + [18] = {.lex_state = 9}, + [19] = {.lex_state = 9}, + [20] = {.lex_state = 2}, + [21] = {.lex_state = 2}, + [22] = {.lex_state = 9}, + [23] = {.lex_state = 9}, + [24] = {.lex_state = 3}, + [25] = {.lex_state = 0, .external_lex_state = 1}, + [26] = {.lex_state = 0}, + [27] = {.lex_state = 0, .external_lex_state = 1}, + [28] = {.lex_state = 0}, + [29] = {.lex_state = 0, .external_lex_state = 1}, + [30] = {.lex_state = 0, .external_lex_state = 1}, + [31] = {.lex_state = 0, .external_lex_state = 1}, [32] = {.lex_state = 0, .external_lex_state = 1}, - [33] = {.lex_state = 0}, + [33] = {.lex_state = 0, .external_lex_state = 1}, [34] = {.lex_state = 0}, - [35] = {.lex_state = 0, .external_lex_state = 1}, - [36] = {.lex_state = 0, .external_lex_state = 1}, + [35] = {.lex_state = 0}, + [36] = {.lex_state = 0}, [37] = {.lex_state = 0, .external_lex_state = 1}, [38] = {.lex_state = 0}, [39] = {.lex_state = 0, .external_lex_state = 1}, - [40] = {.lex_state = 0}, + [40] = {.lex_state = 0, .external_lex_state = 1}, [41] = {.lex_state = 0, .external_lex_state = 1}, - [42] = {.lex_state = 0}, + [42] = {.lex_state = 0, .external_lex_state = 1}, [43] = {.lex_state = 0, .external_lex_state = 1}, - [44] = {.lex_state = 0, .external_lex_state = 1}, + [44] = {.lex_state = 9}, [45] = {.lex_state = 0}, - [46] = {.lex_state = 0, .external_lex_state = 1}, - [47] = {.lex_state = 0, .external_lex_state = 1}, - [48] = {.lex_state = 0, .external_lex_state = 1}, - [49] = {.lex_state = 11}, - [50] = {.lex_state = 0}, - [51] = {.lex_state = 0, .external_lex_state = 1}, - [52] = {.lex_state = 0, .external_lex_state = 1}, - [53] = {.lex_state = 0}, - [54] = {.lex_state = 11}, + [46] = {.lex_state = 9}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { @@ -910,26 +830,25 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym__end_of_assignment] = ACTIONS(1), }, [STATE(1)] = { - [sym_document] = STATE(33), - [sym_assignment] = STATE(6), - [aux_sym_document_repeat1] = STATE(6), + [sym_document] = STATE(26), + [sym_assignment] = STATE(7), + [aux_sym_document_repeat1] = STATE(7), [ts_builtin_sym_end] = ACTIONS(3), [sym_identifier] = ACTIONS(5), [anon_sym_export] = ACTIONS(7), [sym_comment] = ACTIONS(9), }, [STATE(2)] = { - [sym_variable] = STATE(39), - [sym__braced_variable] = STATE(46), - [sym__value] = STATE(39), - [sym_string] = STATE(39), - [sym__unquoted_string] = STATE(36), - [sym__literal_string] = STATE(36), - [sym__string] = STATE(36), - [sym_number] = STATE(39), - [sym_integer] = STATE(37), + [sym_variable] = STATE(33), + [sym__value] = STATE(33), + [sym_string] = STATE(33), + [sym__unquoted_string] = STATE(32), + [sym__literal_string] = STATE(32), + [sym__string] = STATE(32), + [sym_number] = STATE(33), + [sym_integer] = STATE(30), [anon_sym_DOLLAR] = ACTIONS(11), - [sym__unquoted_content] = ACTIONS(13), + [aux_sym__unquoted_string_token1] = ACTIONS(13), [anon_sym_SQUOTE] = ACTIONS(15), [anon_sym_DQUOTE] = ACTIONS(17), [sym_decimal] = ACTIONS(19), @@ -940,336 +859,277 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym__end_of_assignment] = ACTIONS(25), }, [STATE(3)] = { - [sym_variable] = STATE(47), - [sym__braced_variable] = STATE(46), - [sym__value] = STATE(47), - [sym_string] = STATE(47), - [sym__unquoted_string] = STATE(36), - [sym__literal_string] = STATE(36), - [sym__string] = STATE(36), - [sym_number] = STATE(47), - [sym_integer] = STATE(37), + [sym_variable] = STATE(39), + [sym__value] = STATE(39), + [sym_string] = STATE(39), + [sym__unquoted_string] = STATE(32), + [sym__literal_string] = STATE(32), + [sym__string] = STATE(32), + [sym_number] = STATE(39), + [sym_integer] = STATE(30), [anon_sym_DOLLAR] = ACTIONS(11), - [sym__unquoted_content] = ACTIONS(13), + [aux_sym__unquoted_string_token1] = ACTIONS(13), [anon_sym_SQUOTE] = ACTIONS(15), [anon_sym_DQUOTE] = ACTIONS(17), [sym_decimal] = ACTIONS(19), [sym_hexadecimal] = ACTIONS(19), [sym_float] = ACTIONS(21), - [sym_boolean] = ACTIONS(23), - [sym_value] = ACTIONS(23), - [sym__end_of_assignment] = ACTIONS(27), - }, - [STATE(4)] = { - [sym_variable] = STATE(51), - [sym__braced_variable] = STATE(46), - [sym__value] = STATE(51), - [sym_string] = STATE(51), - [sym__unquoted_string] = STATE(36), - [sym__literal_string] = STATE(36), - [sym__string] = STATE(36), - [sym_number] = STATE(51), - [sym_integer] = STATE(37), - [anon_sym_DOLLAR] = ACTIONS(11), - [sym__unquoted_content] = ACTIONS(13), - [anon_sym_SQUOTE] = ACTIONS(15), - [anon_sym_DQUOTE] = ACTIONS(17), - [sym_decimal] = ACTIONS(19), - [sym_hexadecimal] = ACTIONS(19), - [sym_float] = ACTIONS(21), - [sym_boolean] = ACTIONS(23), - [sym_value] = ACTIONS(23), + [sym_boolean] = ACTIONS(27), + [sym_value] = ACTIONS(27), [sym__end_of_assignment] = ACTIONS(29), }, - [STATE(5)] = { - [sym_variable] = STATE(41), - [sym__braced_variable] = STATE(46), - [sym__value] = STATE(41), - [sym_string] = STATE(41), - [sym__unquoted_string] = STATE(36), - [sym__literal_string] = STATE(36), - [sym__string] = STATE(36), - [sym_number] = STATE(41), - [sym_integer] = STATE(37), + [STATE(4)] = { + [sym_variable] = STATE(42), + [sym__value] = STATE(42), + [sym_string] = STATE(42), + [sym__unquoted_string] = STATE(32), + [sym__literal_string] = STATE(32), + [sym__string] = STATE(32), + [sym_number] = STATE(42), + [sym_integer] = STATE(30), [anon_sym_DOLLAR] = ACTIONS(11), - [sym__unquoted_content] = ACTIONS(13), + [aux_sym__unquoted_string_token1] = ACTIONS(13), [anon_sym_SQUOTE] = ACTIONS(15), [anon_sym_DQUOTE] = ACTIONS(17), [sym_decimal] = ACTIONS(19), [sym_hexadecimal] = ACTIONS(19), [sym_float] = ACTIONS(21), - [sym_boolean] = ACTIONS(23), - [sym_value] = ACTIONS(23), - [sym__end_of_assignment] = ACTIONS(31), + [sym_boolean] = ACTIONS(31), + [sym_value] = ACTIONS(31), + [sym__end_of_assignment] = ACTIONS(33), + }, + [STATE(5)] = { + [sym_variable] = STATE(31), + [sym__value] = STATE(31), + [sym_string] = STATE(31), + [sym__unquoted_string] = STATE(32), + [sym__literal_string] = STATE(32), + [sym__string] = STATE(32), + [sym_number] = STATE(31), + [sym_integer] = STATE(30), + [anon_sym_DOLLAR] = ACTIONS(11), + [aux_sym__unquoted_string_token1] = ACTIONS(13), + [anon_sym_SQUOTE] = ACTIONS(15), + [anon_sym_DQUOTE] = ACTIONS(17), + [sym_decimal] = ACTIONS(19), + [sym_hexadecimal] = ACTIONS(19), + [sym_float] = ACTIONS(21), + [sym_boolean] = ACTIONS(35), + [sym_value] = ACTIONS(35), + [sym__end_of_assignment] = ACTIONS(37), }, }; static const uint16_t ts_small_parse_table[] = { [0] = 5, + ACTIONS(39), 1, + ts_builtin_sym_end, + ACTIONS(41), 1, + sym_identifier, + ACTIONS(44), 1, + anon_sym_export, + ACTIONS(47), 1, + sym_comment, + STATE(6), 2, + sym_assignment, + aux_sym_document_repeat1, + [17] = 5, ACTIONS(5), 1, sym_identifier, ACTIONS(7), 1, anon_sym_export, - ACTIONS(33), 1, + ACTIONS(50), 1, ts_builtin_sym_end, - ACTIONS(35), 1, + ACTIONS(52), 1, sym_comment, - STATE(8), 2, + STATE(6), 2, sym_assignment, aux_sym_document_repeat1, - [17] = 5, - ACTIONS(37), 1, + [34] = 4, + ACTIONS(54), 1, anon_sym_DOLLAR, - ACTIONS(39), 1, + ACTIONS(56), 1, anon_sym_DQUOTE, - ACTIONS(41), 1, + ACTIONS(58), 1, aux_sym__string_token1, - STATE(26), 1, - sym__braced_variable, STATE(9), 2, sym_variable, aux_sym__string_repeat1, - [34] = 5, - ACTIONS(43), 1, - ts_builtin_sym_end, - ACTIONS(45), 1, - sym_identifier, - ACTIONS(48), 1, - anon_sym_export, - ACTIONS(51), 1, - sym_comment, - STATE(8), 2, - sym_assignment, - aux_sym_document_repeat1, - [51] = 5, - ACTIONS(37), 1, - anon_sym_DOLLAR, + [48] = 4, ACTIONS(54), 1, - anon_sym_DQUOTE, - ACTIONS(56), 1, - aux_sym__string_token1, - STATE(26), 1, - sym__braced_variable, - STATE(10), 2, - sym_variable, - aux_sym__string_repeat1, - [68] = 5, - ACTIONS(58), 1, anon_sym_DOLLAR, - ACTIONS(61), 1, + ACTIONS(60), 1, anon_sym_DQUOTE, - ACTIONS(63), 1, + ACTIONS(62), 1, aux_sym__string_token1, - STATE(26), 1, - sym__braced_variable, STATE(10), 2, sym_variable, aux_sym__string_repeat1, - [85] = 2, - ACTIONS(66), 2, + [62] = 4, + ACTIONS(64), 1, + anon_sym_DOLLAR, + ACTIONS(67), 1, + anon_sym_DQUOTE, + ACTIONS(69), 1, + aux_sym__string_token1, + STATE(10), 2, + sym_variable, + aux_sym__string_repeat1, + [76] = 2, + ACTIONS(72), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(68), 2, + ACTIONS(74), 2, + anon_sym_export, + sym_identifier, + [85] = 2, + ACTIONS(76), 2, + ts_builtin_sym_end, + sym_comment, + ACTIONS(78), 2, anon_sym_export, sym_identifier, [94] = 2, - ACTIONS(70), 2, + ACTIONS(80), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(72), 2, + ACTIONS(82), 2, anon_sym_export, sym_identifier, [103] = 2, - ACTIONS(74), 2, + ACTIONS(84), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(76), 2, + ACTIONS(86), 2, anon_sym_export, sym_identifier, [112] = 2, - ACTIONS(78), 2, + ACTIONS(88), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(80), 2, + ACTIONS(90), 2, anon_sym_export, sym_identifier, [121] = 2, - ACTIONS(82), 2, + ACTIONS(92), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(84), 2, + ACTIONS(94), 2, anon_sym_export, sym_identifier, [130] = 2, - ACTIONS(86), 2, + ACTIONS(96), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(88), 2, + ACTIONS(98), 2, anon_sym_export, sym_identifier, [139] = 2, - ACTIONS(90), 2, + ACTIONS(100), 2, ts_builtin_sym_end, sym_comment, - ACTIONS(92), 2, + ACTIONS(102), 2, anon_sym_export, sym_identifier, - [148] = 2, - ACTIONS(94), 2, - ts_builtin_sym_end, - sym_comment, - ACTIONS(96), 2, - anon_sym_export, - sym_identifier, - [157] = 3, - ACTIONS(98), 1, - anon_sym_DOLLAR, - ACTIONS(100), 1, - sym__end_of_assignment, - STATE(24), 1, - sym__braced_variable, - [167] = 3, - ACTIONS(98), 1, - anon_sym_DOLLAR, - ACTIONS(102), 1, - sym__end_of_assignment, - STATE(24), 1, - sym__braced_variable, - [177] = 3, - ACTIONS(98), 1, - anon_sym_DOLLAR, + [148] = 3, ACTIONS(104), 1, - sym__end_of_assignment, - STATE(24), 1, - sym__braced_variable, - [187] = 3, - ACTIONS(98), 1, - anon_sym_DOLLAR, + sym_identifier, ACTIONS(106), 1, - sym__end_of_assignment, - STATE(24), 1, - sym__braced_variable, - [197] = 3, - ACTIONS(108), 1, - sym_identifier, - ACTIONS(110), 1, anon_sym_export, - ACTIONS(112), 1, + ACTIONS(108), 1, anon_sym_EQ, - [207] = 3, - ACTIONS(114), 1, - sym__unquoted_content, + [158] = 2, + ACTIONS(112), 1, + aux_sym__string_token1, + ACTIONS(110), 2, + anon_sym_DOLLAR, + anon_sym_DQUOTE, + [166] = 2, ACTIONS(116), 1, - sym_value, + aux_sym__string_token1, + ACTIONS(114), 2, + anon_sym_DOLLAR, + anon_sym_DQUOTE, + [174] = 2, ACTIONS(118), 1, - sym__end_of_assignment, - [217] = 2, - ACTIONS(122), 1, - sym_value, - ACTIONS(120), 2, - sym__end_of_assignment, - sym__unquoted_content, - [225] = 2, - ACTIONS(126), 1, - aux_sym__string_token1, - ACTIONS(124), 2, - anon_sym_DOLLAR, - anon_sym_DQUOTE, - [233] = 2, - ACTIONS(130), 1, - aux_sym__string_token1, - ACTIONS(128), 2, - anon_sym_DOLLAR, - anon_sym_DQUOTE, - [241] = 2, + sym_identifier, ACTIONS(120), 1, - aux_sym__string_token1, - ACTIONS(122), 2, - anon_sym_DOLLAR, - anon_sym_DQUOTE, - [249] = 2, - ACTIONS(132), 1, + anon_sym_LBRACE, + [181] = 2, + ACTIONS(122), 1, + sym_identifier, + ACTIONS(124), 1, + anon_sym_LBRACE, + [188] = 2, + ACTIONS(126), 1, anon_sym_SQUOTE, - ACTIONS(134), 1, + ACTIONS(128), 1, aux_sym__literal_string_token1, - [256] = 2, + [195] = 1, + ACTIONS(130), 1, + sym__end_of_assignment, + [199] = 1, + ACTIONS(132), 1, + ts_builtin_sym_end, + [203] = 1, + ACTIONS(134), 1, + sym__end_of_assignment, + [207] = 1, ACTIONS(136), 1, - sym_identifier, + anon_sym_SQUOTE, + [211] = 1, ACTIONS(138), 1, - anon_sym_LBRACE, - [263] = 2, + sym__end_of_assignment, + [215] = 1, ACTIONS(140), 1, - sym_identifier, + sym__end_of_assignment, + [219] = 1, ACTIONS(142), 1, - anon_sym_LBRACE, - [270] = 1, + sym__end_of_assignment, + [223] = 1, ACTIONS(144), 1, sym__end_of_assignment, - [274] = 1, + [227] = 1, ACTIONS(146), 1, - ts_builtin_sym_end, - [278] = 1, + sym__end_of_assignment, + [231] = 1, ACTIONS(148), 1, - anon_sym_SQUOTE, - [282] = 1, + anon_sym_EQ, + [235] = 1, ACTIONS(150), 1, - sym__end_of_assignment, - [286] = 1, + anon_sym_EQ, + [239] = 1, ACTIONS(152), 1, - sym__end_of_assignment, - [290] = 1, - ACTIONS(100), 1, - sym__end_of_assignment, - [294] = 1, + anon_sym_RBRACE, + [243] = 1, ACTIONS(154), 1, - anon_sym_EQ, - [298] = 1, - ACTIONS(156), 1, sym__end_of_assignment, - [302] = 1, - ACTIONS(158), 1, + [247] = 1, + ACTIONS(156), 1, anon_sym_EQ, - [306] = 1, + [251] = 1, + ACTIONS(158), 1, + sym__end_of_assignment, + [255] = 1, ACTIONS(160), 1, sym__end_of_assignment, - [310] = 1, + [259] = 1, + ACTIONS(116), 1, + sym__end_of_assignment, + [263] = 1, ACTIONS(162), 1, - anon_sym_RBRACE, - [314] = 1, + sym__end_of_assignment, + [267] = 1, + ACTIONS(112), 1, + sym__end_of_assignment, + [271] = 1, ACTIONS(164), 1, - sym__end_of_assignment, - [318] = 1, - ACTIONS(166), 1, - sym__end_of_assignment, - [322] = 1, - ACTIONS(168), 1, - anon_sym_EQ, - [326] = 1, - ACTIONS(126), 1, - sym__end_of_assignment, - [330] = 1, - ACTIONS(170), 1, - sym__end_of_assignment, - [334] = 1, - ACTIONS(130), 1, - sym__end_of_assignment, - [338] = 1, - ACTIONS(172), 1, sym_identifier, - [342] = 1, - ACTIONS(138), 1, - anon_sym_LBRACE, - [346] = 1, - ACTIONS(174), 1, - sym__end_of_assignment, - [350] = 1, - ACTIONS(176), 1, - sym__end_of_assignment, - [354] = 1, - ACTIONS(178), 1, + [275] = 1, + ACTIONS(166), 1, anon_sym_RBRACE, - [358] = 1, - ACTIONS(180), 1, + [279] = 1, + ACTIONS(168), 1, sym_identifier, }; @@ -1277,144 +1137,130 @@ static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(6)] = 0, [SMALL_STATE(7)] = 17, [SMALL_STATE(8)] = 34, - [SMALL_STATE(9)] = 51, - [SMALL_STATE(10)] = 68, - [SMALL_STATE(11)] = 85, - [SMALL_STATE(12)] = 94, - [SMALL_STATE(13)] = 103, - [SMALL_STATE(14)] = 112, - [SMALL_STATE(15)] = 121, - [SMALL_STATE(16)] = 130, - [SMALL_STATE(17)] = 139, - [SMALL_STATE(18)] = 148, - [SMALL_STATE(19)] = 157, - [SMALL_STATE(20)] = 167, - [SMALL_STATE(21)] = 177, - [SMALL_STATE(22)] = 187, - [SMALL_STATE(23)] = 197, - [SMALL_STATE(24)] = 207, - [SMALL_STATE(25)] = 217, - [SMALL_STATE(26)] = 225, - [SMALL_STATE(27)] = 233, - [SMALL_STATE(28)] = 241, - [SMALL_STATE(29)] = 249, - [SMALL_STATE(30)] = 256, - [SMALL_STATE(31)] = 263, - [SMALL_STATE(32)] = 270, - [SMALL_STATE(33)] = 274, - [SMALL_STATE(34)] = 278, - [SMALL_STATE(35)] = 282, - [SMALL_STATE(36)] = 286, - [SMALL_STATE(37)] = 290, - [SMALL_STATE(38)] = 294, - [SMALL_STATE(39)] = 298, - [SMALL_STATE(40)] = 302, - [SMALL_STATE(41)] = 306, - [SMALL_STATE(42)] = 310, - [SMALL_STATE(43)] = 314, - [SMALL_STATE(44)] = 318, - [SMALL_STATE(45)] = 322, - [SMALL_STATE(46)] = 326, - [SMALL_STATE(47)] = 330, - [SMALL_STATE(48)] = 334, - [SMALL_STATE(49)] = 338, - [SMALL_STATE(50)] = 342, - [SMALL_STATE(51)] = 346, - [SMALL_STATE(52)] = 350, - [SMALL_STATE(53)] = 354, - [SMALL_STATE(54)] = 358, + [SMALL_STATE(9)] = 48, + [SMALL_STATE(10)] = 62, + [SMALL_STATE(11)] = 76, + [SMALL_STATE(12)] = 85, + [SMALL_STATE(13)] = 94, + [SMALL_STATE(14)] = 103, + [SMALL_STATE(15)] = 112, + [SMALL_STATE(16)] = 121, + [SMALL_STATE(17)] = 130, + [SMALL_STATE(18)] = 139, + [SMALL_STATE(19)] = 148, + [SMALL_STATE(20)] = 158, + [SMALL_STATE(21)] = 166, + [SMALL_STATE(22)] = 174, + [SMALL_STATE(23)] = 181, + [SMALL_STATE(24)] = 188, + [SMALL_STATE(25)] = 195, + [SMALL_STATE(26)] = 199, + [SMALL_STATE(27)] = 203, + [SMALL_STATE(28)] = 207, + [SMALL_STATE(29)] = 211, + [SMALL_STATE(30)] = 215, + [SMALL_STATE(31)] = 219, + [SMALL_STATE(32)] = 223, + [SMALL_STATE(33)] = 227, + [SMALL_STATE(34)] = 231, + [SMALL_STATE(35)] = 235, + [SMALL_STATE(36)] = 239, + [SMALL_STATE(37)] = 243, + [SMALL_STATE(38)] = 247, + [SMALL_STATE(39)] = 251, + [SMALL_STATE(40)] = 255, + [SMALL_STATE(41)] = 259, + [SMALL_STATE(42)] = 263, + [SMALL_STATE(43)] = 267, + [SMALL_STATE(44)] = 271, + [SMALL_STATE(45)] = 275, + [SMALL_STATE(46)] = 279, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 0, 0, 0), - [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(45), - [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(23), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), - [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), - [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(20), - [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), - [23] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(38), + [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(40), + [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(30), + [23] = {.entry = {.count = 1, .reusable = false}}, SHIFT(33), [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [27] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [29] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [31] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [33] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1, 0, 0), - [35] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [37] = {.entry = {.count = 1, .reusable = false}}, SHIFT(31), - [39] = {.entry = {.count = 1, .reusable = false}}, SHIFT(35), - [41] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), - [43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), - [45] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(45), - [48] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(23), - [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(8), - [54] = {.entry = {.count = 1, .reusable = false}}, SHIFT(32), - [56] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), - [58] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__string_repeat1, 2, 0, 0), SHIFT_REPEAT(31), - [61] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__string_repeat1, 2, 0, 0), - [63] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__string_repeat1, 2, 0, 0), SHIFT_REPEAT(10), - [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, 0, 1), - [68] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 3, 0, 1), - [70] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, 0, 3), - [72] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 3, 0, 3), - [74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 8), - [76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 8), - [78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 7), - [80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 7), - [82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 6), - [84] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 6), - [86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 5, 0, 11), - [88] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 5, 0, 11), - [90] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 4), - [92] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 4), - [94] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 5, 0, 9), - [96] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 5, 0, 9), - [98] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), - [100] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_number, 1, 0, 0), - [102] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer, 1, 0, 0), - [104] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__unquoted_string, 1, 0, 2), - [106] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__value, 1, 0, 0), - [108] = {.entry = {.count = 1, .reusable = false}}, SHIFT(38), - [110] = {.entry = {.count = 1, .reusable = false}}, SHIFT(40), - [112] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [114] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), - [116] = {.entry = {.count = 1, .reusable = false}}, SHIFT(43), - [118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__unquoted_string, 2, 0, 5), - [120] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__braced_variable, 4, 0, 0), - [122] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__braced_variable, 4, 0, 0), - [124] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_variable, 1, 0, 0), - [126] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable, 1, 0, 0), - [128] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_variable, 2, 0, 0), - [130] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable, 2, 0, 0), - [132] = {.entry = {.count = 1, .reusable = false}}, SHIFT(52), - [134] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), - [136] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), - [138] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), - [140] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), - [142] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), - [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__string, 3, 0, 0), - [146] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [148] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), - [150] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__string, 2, 0, 0), - [152] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 1, 0, 0), - [154] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [156] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [158] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [160] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [164] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__unquoted_string, 3, 0, 10), - [166] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__literal_string, 3, 0, 0), - [168] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [170] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), - [172] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), - [174] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), - [176] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__literal_string, 2, 0, 0), - [178] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), - [180] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), + [27] = {.entry = {.count = 1, .reusable = false}}, SHIFT(39), + [29] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [31] = {.entry = {.count = 1, .reusable = false}}, SHIFT(42), + [33] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [35] = {.entry = {.count = 1, .reusable = false}}, SHIFT(31), + [37] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [39] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), + [41] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(38), + [44] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(19), + [47] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2, 0, 0), SHIFT_REPEAT(6), + [50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1, 0, 0), + [52] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [54] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), + [56] = {.entry = {.count = 1, .reusable = false}}, SHIFT(29), + [58] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [60] = {.entry = {.count = 1, .reusable = false}}, SHIFT(25), + [62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), + [64] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__string_repeat1, 2, 0, 0), SHIFT_REPEAT(22), + [67] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__string_repeat1, 2, 0, 0), + [69] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__string_repeat1, 2, 0, 0), SHIFT_REPEAT(10), + [72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, 0, 1), + [74] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 3, 0, 1), + [76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, 0, 2), + [78] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 3, 0, 2), + [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 4), + [82] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 4), + [84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 5), + [86] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 5), + [88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 6), + [90] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 6), + [92] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 5, 0, 7), + [94] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 5, 0, 7), + [96] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 4, 0, 3), + [98] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 4, 0, 3), + [100] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 5, 0, 8), + [102] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 5, 0, 8), + [104] = {.entry = {.count = 1, .reusable = false}}, SHIFT(34), + [106] = {.entry = {.count = 1, .reusable = false}}, SHIFT(35), + [108] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), + [110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_variable, 2, 0, 0), + [112] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable, 2, 0, 0), + [114] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_variable, 4, 0, 0), + [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variable, 4, 0, 0), + [118] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [120] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), + [122] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), + [124] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), + [126] = {.entry = {.count = 1, .reusable = false}}, SHIFT(27), + [128] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), + [130] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__string, 3, 0, 0), + [132] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [134] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__literal_string, 2, 0, 0), + [136] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__string, 2, 0, 0), + [140] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_number, 1, 0, 0), + [142] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 1, 0, 0), + [146] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), + [148] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [152] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), + [154] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__literal_string, 3, 0, 0), + [156] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [158] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [160] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_integer, 1, 0, 0), + [162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [164] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [168] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), }; enum ts_external_scanner_symbol_identifiers { @@ -1492,7 +1338,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_dotenv(void) { .metadata = { .major_version = 1, .minor_version = 1, - .patch_version = 3, + .patch_version = 2, }, }; return &language; diff --git a/src/tree_sitter/array.h b/src/tree_sitter/array.h index 56fc8cd..eba3da4 100644 --- a/src/tree_sitter/array.h +++ b/src/tree_sitter/array.h @@ -50,12 +50,18 @@ extern "C" { /// memory allocated for the array's contents. #define array_clear(self) ((self)->size = 0) +#ifdef __cplusplus +#define _array__cast(self, expr) (decltype((self)->contents))(expr) +#else +#define _array__cast(self, expr) (expr) +#endif + /// Reserve `new_capacity` elements of space in the array. If `new_capacity` is /// less than the array's current capacity, this function has no effect. -#define array_reserve(self, new_capacity) \ - ((self)->contents = _array__reserve( \ - (void *)(self)->contents, &(self)->capacity, \ - array_elem_size(self), new_capacity) \ +#define array_reserve(self, new_capacity) \ + ((self)->contents = _array__cast(self, _array__reserve( \ + (void *)(self)->contents, &(self)->capacity, \ + array_elem_size(self), new_capacity)) \ ) /// Free any memory allocated for this array. Note that this does not free any @@ -71,10 +77,10 @@ extern "C" { /// Push a new `element` onto the end of the array. #define array_push(self, element) \ do { \ - (self)->contents = _array__grow( \ + (self)->contents = _array__cast(self, _array__grow( \ (void *)(self)->contents, (self)->size, &(self)->capacity, \ 1, array_elem_size(self) \ - ); \ + )); \ (self)->contents[(self)->size++] = (element); \ } while(0) @@ -83,10 +89,10 @@ extern "C" { #define array_grow_by(self, count) \ do { \ if ((count) == 0) break; \ - (self)->contents = _array__grow( \ + (self)->contents = _array__cast(self, _array__grow( \ (self)->contents, (self)->size, &(self)->capacity, \ count, array_elem_size(self) \ - ); \ + )); \ memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ (self)->size += (count); \ } while (0) @@ -98,26 +104,26 @@ extern "C" { /// Append `count` elements to the end of the array, reading their values from the /// `contents` pointer. #define array_extend(self, count, other_contents) \ - (self)->contents = _array__splice( \ + ((self)->contents = _array__cast(self, _array__splice( \ (void*)(self)->contents, &(self)->size, &(self)->capacity, \ array_elem_size(self), (self)->size, 0, count, other_contents \ - ) + ))) /// Remove `old_count` elements from the array starting at the given `index`. At /// the same index, insert `new_count` new elements, reading their values from the /// `new_contents` pointer. #define array_splice(self, _index, old_count, new_count, new_contents) \ - (self)->contents = _array__splice( \ + ((self)->contents = _array__cast(self, _array__splice( \ (void *)(self)->contents, &(self)->size, &(self)->capacity, \ array_elem_size(self), _index, old_count, new_count, new_contents \ - ) + ))) /// Insert one `element` into the array at the given `index`. #define array_insert(self, _index, element) \ - (self)->contents = _array__splice( \ + ((self)->contents = _array__cast(self, _array__splice( \ (void *)(self)->contents, &(self)->size, &(self)->capacity, \ array_elem_size(self), _index, 0, 1, &(element) \ - ) + ))) /// Remove one element from the array at the given `index`. #define array_erase(self, _index) \ @@ -128,17 +134,17 @@ extern "C" { /// Assign the contents of one array to another, reallocating if necessary. #define array_assign(self, other) \ - (self)->contents = _array__assign( \ + ((self)->contents = _array__cast(self, _array__assign( \ (void *)(self)->contents, &(self)->size, &(self)->capacity, \ (const void *)(other)->contents, (other)->size, array_elem_size(self) \ - ) + ))) /// Swap one array with another #define array_swap(self, other) \ do { \ void *_array_swap_tmp = (void *)(self)->contents; \ (self)->contents = (other)->contents; \ - (other)->contents = _array_swap_tmp; \ + (other)->contents = _array__cast(other, _array_swap_tmp); \ _array__swap(&(self)->size, &(self)->capacity, \ &(other)->size, &(other)->capacity); \ } while (0) diff --git a/test/corpus/scalar_interpolation.txt b/test/corpus/scalar_interpolation.txt deleted file mode 100644 index 61a1dba..0000000 --- a/test/corpus/scalar_interpolation.txt +++ /dev/null @@ -1,161 +0,0 @@ -================================================================================ -Boolean prefixes become string content -================================================================================ - -PLAIN_TRUE=true -TRUE_PREFIX=true${APP_NAME} -PLAIN_FALSE=false -FALSE_PREFIX=false${APP_NAME} - --------------------------------------------------------------------------------- - -(document - (assignment - (identifier) - (boolean)) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)))) - (assignment - (identifier) - (boolean)) - (assignment - (identifier) - (string - (string_content) - (variable (identifier))))) - -================================================================================ -Numeric prefixes become string content -================================================================================ - -PLAIN_INTEGER=123 -INTEGER_PREFIX=123${APP_NAME} -PLAIN_NEGATIVE=-123 -NEGATIVE_PREFIX=-123${APP_NAME} -PLAIN_HEX=0xFF -HEX_PREFIX=0xFF${APP_NAME} -PLAIN_FLOAT=1.5 -FLOAT_PREFIX=1.5${APP_NAME} -PLAIN_NEGATIVE_FLOAT=-1.5 -NEGATIVE_FLOAT_PREFIX=-1.5${APP_NAME} - --------------------------------------------------------------------------------- - -(document - (assignment - (identifier) - (number (integer (decimal)))) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)))) - (assignment - (identifier) - (number (integer (decimal)))) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)))) - (assignment - (identifier) - (number (integer (hexadecimal)))) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)))) - (assignment - (identifier) - (number (float))) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)))) - (assignment - (identifier) - (number (float))) - (assignment - (identifier) - (string - (string_content) - (variable (identifier))))) - -================================================================================ -Scalar prefixes with suffixes and comments -================================================================================ - -BOOL=true${APP_NAME}-suffix # comment -NUMBER=123${APP_NAME} suffix words - --------------------------------------------------------------------------------- - -(document - (assignment - (identifier) - (string - (string_content) - (variable (identifier)) - (string_content))) - (comment) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)) - (string_content)))) - -================================================================================ -Bare boolean-prefixed references are literal strings -================================================================================ - -BOOL=true$APP_NAME -BOOL=false$APP_NAME - --------------------------------------------------------------------------------- - -(document - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content)))) - -================================================================================ -Bare decimal-prefixed references are literal strings -================================================================================ - -NUMBER=123$APP_NAME -NUMBER=-123$APP_NAME - --------------------------------------------------------------------------------- - -(document - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content)))) - -================================================================================ -Bare hexadecimal-prefixed references are literal strings -================================================================================ - -HEX=0xFF$APP_NAME - --------------------------------------------------------------------------------- - -(document - (assignment (identifier) (string (string_content)))) - -================================================================================ -Bare float-prefixed references are literal strings -================================================================================ - -FLOAT=1.5$APP_NAME -FLOAT=-1.5$APP_NAME - --------------------------------------------------------------------------------- - -(document - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content)))) diff --git a/test/corpus/variables.txt b/test/corpus/variables.txt index 5680bc3..9aa9511 100644 --- a/test/corpus/variables.txt +++ b/test/corpus/variables.txt @@ -42,85 +42,3 @@ MULTIPLE = "variable is: ${VARIABLE}, and $ANOTHER !!!" (variable (identifier)) (string_content)))) - -================================================================================ -Unquoted braced variables with prefixes -================================================================================ - -BASIC = prefix${VARIABLE} -VITE_APP_NAME=xxx${APP_NAME} -SUFFIX = prefix${VARIABLE}-suffix -MULTIWORD = prefix words${VARIABLE} suffix words # comment - --------------------------------------------------------------------------------- - -(document - (assignment - key: (identifier) - value: (string - (string_content) - (variable - (identifier)))) - (assignment - key: (identifier) - value: (string - (string_content) - (variable - (identifier)))) - (assignment - key: (identifier) - value: (string - (string_content) - (variable - (identifier)) - (string_content))) - (assignment - key: (identifier) - value: (string - (string_content) - (variable - (identifier)) - (string_content))) - (comment)) - -================================================================================ -Unquoted bare references with prefixes are literal strings -================================================================================ - -VITE_APP_NAME=xxx$APP_NAME -NAME=XXX$APP_NAME -SUFFIX=xxx$APP_NAME-suffix -MULTIPLE=xxx$APP_NAME$OTHER -MULTIWORD=prefix words$APP_NAME suffix words # comment - --------------------------------------------------------------------------------- - -(document - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content))) - (assignment (identifier) (string (string_content))) - (comment)) - -================================================================================ -Literal bare references alongside braced interpolation -================================================================================ - -PREFIX=xxx$LITERAL${APP_NAME} -SUFFIX=xxx${APP_NAME}suffix$LITERAL - --------------------------------------------------------------------------------- - -(document - (assignment - (identifier) - (string - (string_content) - (variable (identifier)))) - (assignment - (identifier) - (string - (string_content) - (variable (identifier)) - (string_content)))) diff --git a/tree-sitter.json b/tree-sitter.json index 17326fd..07640f1 100644 --- a/tree-sitter.json +++ b/tree-sitter.json @@ -15,7 +15,7 @@ } ], "metadata": { - "version": "1.1.3", + "version": "1.1.2", "license": "MIT", "description": "Dotenv grammar for tree-sitter", "authors": [