diff --git a/package-lock.json b/package-lock.json index ec78d22..2964274 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tree-sitter-dotenv", - "version": "1.0.0", + "version": "0.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tree-sitter-dotenv", - "version": "1.0.0", + "version": "0.0.8", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -15,7 +15,7 @@ }, "devDependencies": { "prebuildify": "^6.0.1", - "tree-sitter-cli": "^0.26.11" + "tree-sitter-cli": "^0.26.10" }, "peerDependencies": { "tree-sitter": "^0.21.1" @@ -338,9 +338,9 @@ } }, "node_modules/tree-sitter-cli": { - "version": "0.26.11", - "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.26.11.tgz", - "integrity": "sha512-/hRCA0Ehkgk6B5WTYSiENk1R2Zv3LJcfvL3wjofzx+EYaKySZDu0agGRQcccay9Lg7wxJWsDa9cTRS92wsM5gQ==", + "version": "0.26.10", + "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.26.10.tgz", + "integrity": "sha512-RTse32x5YWOrEtH7wos8ODt3yyB7SKgmGN70jC7R+WcnDA64vrpYU98+LnwrwdXMlxgr0LGQdezZz85DN8Wv0w==", "dev": true, "hasInstallScript": true, "license": "MIT", diff --git a/package.json b/package.json index ec6fff8..c926ec6 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ }, "devDependencies": { "prebuildify": "^6.0.1", - "tree-sitter-cli": "^0.26.11" + "tree-sitter-cli": "^0.26.10" }, "peerDependencies": { "tree-sitter": "^0.21.1" diff --git a/src/parser.c b/src/parser.c index c6a64aa..1aac70b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -331,26 +331,20 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == ' ') SKIP(1); if (('1' <= lookahead && lookahead <= '9')) ADVANCE(29); if (lookahead != 0 && - (lookahead < '"' || '$' < lookahead) && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + (lookahead < '"' || '$' < lookahead)) ADVANCE(45); END_STATE(); case 2: if (lookahead == '"') ADVANCE(25); if (lookahead == '$') ADVANCE(19); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(26); - if (lookahead != 0 && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(27); + if (lookahead != 0) ADVANCE(27); END_STATE(); case 3: if (lookahead == '\'') ADVANCE(22); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(23); - if (lookahead != 0 && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(24); + if (lookahead != 0) ADVANCE(24); END_STATE(); case 4: if (lookahead == 'X' || @@ -386,9 +380,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { case 11: ACCEPT_TOKEN(sym_comment); if (lookahead != 0 && - lookahead != '\n' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(11); + lookahead != '\n') ADVANCE(11); END_STATE(); case 12: ACCEPT_TOKEN(sym_identifier); @@ -462,16 +454,12 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(23); if (lookahead != 0 && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(24); + lookahead != '\'') ADVANCE(24); END_STATE(); case 24: ACCEPT_TOKEN(aux_sym__literal_string_token1); if (lookahead != 0 && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(24); + lookahead != '\'') ADVANCE(24); END_STATE(); case 25: ACCEPT_TOKEN(anon_sym_DQUOTE); @@ -482,17 +470,13 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == ' ') ADVANCE(26); if (lookahead != 0 && lookahead != '"' && - lookahead != '$' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(27); + lookahead != '$') ADVANCE(27); END_STATE(); case 27: ACCEPT_TOKEN(aux_sym__string_token1); if (lookahead != 0 && lookahead != '"' && - lookahead != '$' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(27); + lookahead != '$') ADVANCE(27); END_STATE(); case 28: ACCEPT_TOKEN(sym_decimal); @@ -507,9 +491,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 30: ACCEPT_TOKEN(sym_hexadecimal); @@ -526,9 +508,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 32: ACCEPT_TOKEN(sym_float); @@ -541,9 +521,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 34: ACCEPT_TOKEN(sym_boolean); @@ -551,9 +529,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 35: ACCEPT_TOKEN(sym_value); @@ -562,9 +538,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 36: ACCEPT_TOKEN(sym_value); @@ -573,9 +547,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 37: ACCEPT_TOKEN(sym_value); @@ -584,9 +556,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 38: ACCEPT_TOKEN(sym_value); @@ -595,9 +565,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 39: ACCEPT_TOKEN(sym_value); @@ -606,9 +574,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 40: ACCEPT_TOKEN(sym_value); @@ -617,9 +583,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 41: ACCEPT_TOKEN(sym_value); @@ -629,9 +593,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 42: ACCEPT_TOKEN(sym_value); @@ -640,9 +602,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 43: ACCEPT_TOKEN(sym_value); @@ -651,9 +611,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 44: ACCEPT_TOKEN(sym_value); @@ -664,9 +622,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); case 45: ACCEPT_TOKEN(sym_value); @@ -674,9 +630,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { (lookahead < '\t' || '\r' < lookahead) && lookahead != ' ' && (lookahead < '"' || '$' < lookahead) && - lookahead != '\'' && - lookahead != 0x17f && - lookahead != 0x212a) ADVANCE(45); + lookahead != '\'') ADVANCE(45); END_STATE(); default: return false; diff --git a/src/tree_sitter/array.h b/src/tree_sitter/array.h index eba3da4..56fc8cd 100644 --- a/src/tree_sitter/array.h +++ b/src/tree_sitter/array.h @@ -50,18 +50,12 @@ 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__cast(self, _array__reserve( \ - (void *)(self)->contents, &(self)->capacity, \ - array_elem_size(self), new_capacity)) \ +#define array_reserve(self, new_capacity) \ + ((self)->contents = _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 @@ -77,10 +71,10 @@ extern "C" { /// Push a new `element` onto the end of the array. #define array_push(self, element) \ do { \ - (self)->contents = _array__cast(self, _array__grow( \ + (self)->contents = _array__grow( \ (void *)(self)->contents, (self)->size, &(self)->capacity, \ 1, array_elem_size(self) \ - )); \ + ); \ (self)->contents[(self)->size++] = (element); \ } while(0) @@ -89,10 +83,10 @@ extern "C" { #define array_grow_by(self, count) \ do { \ if ((count) == 0) break; \ - (self)->contents = _array__cast(self, _array__grow( \ + (self)->contents = _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) @@ -104,26 +98,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__cast(self, _array__splice( \ + (self)->contents = _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__cast(self, _array__splice( \ + (self)->contents = _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__cast(self, _array__splice( \ + (self)->contents = _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) \ @@ -134,17 +128,17 @@ extern "C" { /// Assign the contents of one array to another, reallocating if necessary. #define array_assign(self, other) \ - ((self)->contents = _array__cast(self, _array__assign( \ + (self)->contents = _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__cast(other, _array_swap_tmp); \ + (other)->contents = _array_swap_tmp; \ _array__swap(&(self)->size, &(self)->capacity, \ &(other)->size, &(other)->capacity); \ } while (0)