⬆️ tree-sitter-cli, add explicit word token

This commit is contained in:
Max Brunsfeld 2018-06-15 14:05:05 -07:00
parent 7b003599b3
commit 44b3de2594
5 changed files with 43747 additions and 56412 deletions

View File

@ -43,6 +43,8 @@ module.exports = grammar({
token(choice(/\s/, '\\\n')), token(choice(/\s/, '\\\n')),
], ],
word: $ => $.word,
rules: { rules: {
program: $ => repeat($._terminated_statement), program: $ => repeat($._terminated_statement),

View File

@ -13,7 +13,7 @@
"nan": "^2.10.0" "nan": "^2.10.0"
}, },
"devDependencies": { "devDependencies": {
"tree-sitter-cli": "^0.12.2" "tree-sitter-cli": "^0.12.6"
}, },
"scripts": { "scripts": {
"build": "tree-sitter generate && node-gyp build", "build": "tree-sitter generate && node-gyp build",

1
src/grammar.json vendored
View File

@ -1,5 +1,6 @@
{ {
"name": "bash", "name": "bash",
"word": "word",
"rules": { "rules": {
"program": { "program": {
"type": "REPEAT", "type": "REPEAT",

100147
src/parser.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,10 @@ extern "C" {
#define ts_builtin_sym_end 0 #define ts_builtin_sym_end 0
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
#ifndef TREE_SITTER_RUNTIME_H_
typedef uint16_t TSSymbol; typedef uint16_t TSSymbol;
typedef struct TSLanguage TSLanguage;
#endif
typedef uint16_t TSStateId; typedef uint16_t TSStateId;
@ -67,7 +70,7 @@ typedef union {
}; };
} TSParseActionEntry; } TSParseActionEntry;
typedef struct TSLanguage { struct TSLanguage {
uint32_t version; uint32_t version;
uint32_t symbol_count; uint32_t symbol_count;
uint32_t alias_count; uint32_t alias_count;
@ -92,7 +95,7 @@ typedef struct TSLanguage {
unsigned (*serialize)(void *, char *); unsigned (*serialize)(void *, char *);
void (*deserialize)(void *, const char *, unsigned); void (*deserialize)(void *, const char *, unsigned);
} external_scanner; } external_scanner;
} TSLanguage; };
/* /*
* Lexer Macros * Lexer Macros