⬆️ tree-sitter-cli

This commit is contained in:
Max Brunsfeld 2019-06-18 17:00:42 -07:00
parent fd6567ba3a
commit 2d081f4bb2
6 changed files with 74713 additions and 61094 deletions

View File

@ -1 +1,13 @@
try {
module.exports = require("./build/Release/tree_sitter_bash_binding"); module.exports = require("./build/Release/tree_sitter_bash_binding");
} catch (error) {
try {
module.exports = require("./build/Debug/tree_sitter_bash_binding");
} catch (_) {
throw error
}
}
try {
module.exports.nodeTypeInfo = require("./src/node-types.json");
} catch (_) {}

View File

@ -16,7 +16,7 @@
"devDependencies": { "devDependencies": {
"nodemon": "^1.18.3", "nodemon": "^1.18.3",
"prebuild": "^7.6.1", "prebuild": "^7.6.1",
"tree-sitter-cli": "^0.14.7" "tree-sitter-cli": "^0.15.3"
}, },
"scripts": { "scripts": {
"build": "tree-sitter generate && node-gyp build", "build": "tree-sitter generate && node-gyp build",

4
src/grammar.json vendored
View File

@ -2385,5 +2385,7 @@
"_primary_expression", "_primary_expression",
"_simple_variable_name", "_simple_variable_name",
"_special_variable_name" "_special_variable_name"
] ],
"supertypes": []
} }

2830
src/node-types.json vendored Normal file

File diff suppressed because it is too large Load Diff

132937
src/parser.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,21 @@ extern "C" {
#ifndef TREE_SITTER_API_H_ #ifndef TREE_SITTER_API_H_
typedef uint16_t TSSymbol; typedef uint16_t TSSymbol;
typedef uint16_t TSFieldId;
typedef struct TSLanguage TSLanguage; typedef struct TSLanguage TSLanguage;
#endif #endif
typedef struct {
TSFieldId field_id;
uint8_t child_index;
bool inherited;
} TSFieldMapEntry;
typedef struct {
uint16_t index;
uint16_t length;
} TSFieldMapSlice;
typedef uint16_t TSStateId; typedef uint16_t TSStateId;
typedef struct { typedef struct {
@ -54,7 +66,7 @@ typedef struct {
TSSymbol symbol; TSSymbol symbol;
int16_t dynamic_precedence; int16_t dynamic_precedence;
uint8_t child_count; uint8_t child_count;
uint8_t alias_sequence_id; uint8_t production_id;
}; };
} params; } params;
TSParseActionType type : 4; TSParseActionType type : 4;
@ -92,12 +104,16 @@ struct TSLanguage {
struct { struct {
const bool *states; const bool *states;
const TSSymbol *symbol_map; const TSSymbol *symbol_map;
void *(*create)(); void *(*create)(void);
void (*destroy)(void *); void (*destroy)(void *);
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
unsigned (*serialize)(void *, char *); unsigned (*serialize)(void *, char *);
void (*deserialize)(void *, const char *, unsigned); void (*deserialize)(void *, const char *, unsigned);
} external_scanner; } external_scanner;
uint32_t field_count;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const char **field_names;
}; };
/* /*