Update to tree-sitter-cli 0.15.3

This commit is contained in:
Max Brunsfeld 2019-06-07 14:48:48 -07:00
parent 126f926a8f
commit dbaea0c5de
6 changed files with 782 additions and 655 deletions

View File

@ -7,3 +7,7 @@ try {
throw error
}
}
try {
module.exports.nodeTypeInfo = require("./src/node-types.json");
} catch (_) {}

View File

@ -16,7 +16,7 @@
"nan": "^2.10.0"
},
"devDependencies": {
"tree-sitter-cli": "^0.14.4"
"tree-sitter-cli": "^0.15.3"
},
"scripts": {
"build": "tree-sitter generate && node-gyp build",
@ -26,7 +26,9 @@
"tree-sitter": [
{
"scope": "text.html.basic",
"file-types": ["html"],
"file-types": [
"html"
],
"highlights": "src/highlights.json",
"injection-regex": "html"
}

View File

@ -486,5 +486,7 @@
"name": "comment"
}
],
"inline": []
"inline": [],
"supertypes": []
}

101
src/node-types.json Normal file
View File

@ -0,0 +1,101 @@
[
{
"type": "attribute",
"named": true,
"fields": {}
},
{
"type": "doctype",
"named": true,
"fields": {}
},
{
"type": "element",
"named": true,
"fields": {}
},
{
"type": "end_tag",
"named": true,
"fields": {}
},
{
"type": "erroneous_end_tag",
"named": true,
"fields": {}
},
{
"type": "fragment",
"named": true,
"fields": {}
},
{
"type": "quoted_attribute_value",
"named": true,
"fields": {}
},
{
"type": "script_element",
"named": true,
"fields": {}
},
{
"type": "self_closing_tag",
"named": true,
"fields": {}
},
{
"type": "start_tag",
"named": true,
"fields": {}
},
{
"type": "style_element",
"named": true,
"fields": {}
},
{
"type": "<!",
"named": false
},
{
"type": ">",
"named": false
},
{
"type": "<",
"named": false
},
{
"type": "/>",
"named": false
},
{
"type": "</",
"named": false
},
{
"type": "=",
"named": false
},
{
"type": "attribute_name",
"named": true
},
{
"type": "attribute_value",
"named": true
},
{
"type": "'",
"named": false
},
{
"type": "\"",
"named": false
},
{
"type": "text",
"named": true
}
]

1302
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_
typedef uint16_t TSSymbol;
typedef uint16_t TSFieldId;
typedef struct TSLanguage TSLanguage;
#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 struct {
@ -54,7 +66,7 @@ typedef struct {
TSSymbol symbol;
int16_t dynamic_precedence;
uint8_t child_count;
uint8_t alias_sequence_id;
uint8_t production_id;
};
} params;
TSParseActionType type : 4;
@ -92,12 +104,16 @@ struct TSLanguage {
struct {
const bool *states;
const TSSymbol *symbol_map;
void *(*create)();
void *(*create)(void);
void (*destroy)(void *);
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
unsigned (*serialize)(void *, char *);
void (*deserialize)(void *, const char *, unsigned);
} external_scanner;
uint32_t field_count;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const char **field_names;
};
/*