feat: update grammars

This commit is contained in:
maunzCache
2025-02-16 14:35:02 +01:00
committed by Michael Hoffmann
parent 6bc92930a7
commit f0a315ded3
16 changed files with 23297 additions and 23240 deletions

View File

@@ -26,10 +26,10 @@
}, },
"devDependencies": { "devDependencies": {
"prebuildify": "^6.0.0", "prebuildify": "^6.0.0",
"tree-sitter-cli": "^0.22.6" "tree-sitter-cli": "^0.24"
}, },
"peerDependencies": { "peerDependencies": {
"tree-sitter": "^0.21.0" "tree-sitter": "^0.24"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"tree-sitter": { "tree-sitter": {
@@ -39,15 +39,9 @@
"scripts": { "scripts": {
"install": "node-gyp-build", "install": "node-gyp-build",
"prebuildify": "prebuildify --napi --strip", "prebuildify": "prebuildify --napi --strip",
"build": "tree-sitter generate --no-bindings", "build": "tree-sitter generate",
"build-wasm": "tree-sitter build --wasm", "build-wasm": "tree-sitter build --wasm",
"test": "tree-sitter test", "test": "tree-sitter test",
"parse": "tree-sitter parse" "parse": "tree-sitter parse"
}, }
"tree-sitter": [
{
"scope": "source.terraform",
"injection-regex": "^terraform$"
}
]
} }

View File

@@ -1,4 +1,5 @@
{ {
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
"name": "terraform", "name": "terraform",
"rules": { "rules": {
"config_file": { "config_file": {

View File

@@ -194,6 +194,7 @@
{ {
"type": "config_file", "type": "config_file",
"named": true, "named": true,
"root": true,
"fields": {}, "fields": {},
"children": { "children": {
"multiple": false, "multiple": false,

File diff suppressed because it is too large Load Diff

View File

@@ -12,10 +12,10 @@ extern "C" {
// Allow clients to override allocation functions // Allow clients to override allocation functions
#ifdef TREE_SITTER_REUSE_ALLOCATOR #ifdef TREE_SITTER_REUSE_ALLOCATOR
extern void *(*ts_current_malloc)(size_t); extern void *(*ts_current_malloc)(size_t size);
extern void *(*ts_current_calloc)(size_t, size_t); extern void *(*ts_current_calloc)(size_t count, size_t size);
extern void *(*ts_current_realloc)(void *, size_t); extern void *(*ts_current_realloc)(void *ptr, size_t size);
extern void (*ts_current_free)(void *); extern void (*ts_current_free)(void *ptr);
#ifndef ts_malloc #ifndef ts_malloc
#define ts_malloc ts_current_malloc #define ts_malloc ts_current_malloc

View File

@@ -14,6 +14,7 @@ extern "C" {
#include <string.h> #include <string.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4101) #pragma warning(disable : 4101)
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
@@ -278,7 +279,7 @@ static inline void _array__splice(Array *self, size_t element_size,
#define _compare_int(a, b) ((int)*(a) - (int)(b)) #define _compare_int(a, b) ((int)*(a) - (int)(b))
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(default : 4101) #pragma warning(pop)
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View File

@@ -47,6 +47,7 @@ struct TSLexer {
uint32_t (*get_column)(TSLexer *); uint32_t (*get_column)(TSLexer *);
bool (*is_at_included_range_start)(const TSLexer *); bool (*is_at_included_range_start)(const TSLexer *);
bool (*eof)(const TSLexer *); bool (*eof)(const TSLexer *);
void (*log)(const TSLexer *, const char *, ...);
}; };
typedef enum { typedef enum {

View File

@@ -0,0 +1,28 @@
{
"grammars": [
{
"name": "terraform",
"camelcase": "Terraform",
"scope": "source.terraform",
"path": ".",
"file-types": null,
"injection-regex": "^terraform$"
}
],
"metadata": {
"version": "0.0.1",
"license": "MIT",
"description": "Terraform grammar for tree-sitter",
"links": {
"repository": "https://github.com/tree-sitter/tree-sitter-terraform"
}
},
"bindings": {
"c": true,
"go": true,
"node": true,
"python": true,
"rust": true,
"swift": true
}
}

View File

@@ -7,16 +7,6 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"nan": "^2.14.2", "nan": "^2.14.2",
"tree-sitter-cli": "^0.20.6" "tree-sitter-cli": "^0.24"
}, }
"tree-sitter": [
{
"scope": "source.hcl",
"file-types": [
"hcl",
"tf",
"tfvars"
]
}
]
} }

View File

@@ -1,4 +1,5 @@
{ {
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
"name": "hcl", "name": "hcl",
"rules": { "rules": {
"config_file": { "config_file": {

View File

@@ -194,6 +194,7 @@
{ {
"type": "config_file", "type": "config_file",
"named": true, "named": true,
"root": true,
"fields": {}, "fields": {},
"children": { "children": {
"multiple": false, "multiple": false,

23211
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@@ -12,10 +12,10 @@ extern "C" {
// Allow clients to override allocation functions // Allow clients to override allocation functions
#ifdef TREE_SITTER_REUSE_ALLOCATOR #ifdef TREE_SITTER_REUSE_ALLOCATOR
extern void *(*ts_current_malloc)(size_t); extern void *(*ts_current_malloc)(size_t size);
extern void *(*ts_current_calloc)(size_t, size_t); extern void *(*ts_current_calloc)(size_t count, size_t size);
extern void *(*ts_current_realloc)(void *, size_t); extern void *(*ts_current_realloc)(void *ptr, size_t size);
extern void (*ts_current_free)(void *); extern void (*ts_current_free)(void *ptr);
#ifndef ts_malloc #ifndef ts_malloc
#define ts_malloc ts_current_malloc #define ts_malloc ts_current_malloc

View File

@@ -14,6 +14,7 @@ extern "C" {
#include <string.h> #include <string.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4101) #pragma warning(disable : 4101)
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
@@ -278,7 +279,7 @@ static inline void _array__splice(Array *self, size_t element_size,
#define _compare_int(a, b) ((int)*(a) - (int)(b)) #define _compare_int(a, b) ((int)*(a) - (int)(b))
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(default : 4101) #pragma warning(pop)
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View File

@@ -47,6 +47,7 @@ struct TSLexer {
uint32_t (*get_column)(TSLexer *); uint32_t (*get_column)(TSLexer *);
bool (*is_at_included_range_start)(const TSLexer *); bool (*is_at_included_range_start)(const TSLexer *);
bool (*eof)(const TSLexer *); bool (*eof)(const TSLexer *);
void (*log)(const TSLexer *, const char *, ...);
}; };
typedef enum { typedef enum {

31
tree-sitter.json Normal file
View File

@@ -0,0 +1,31 @@
{
"grammars": [
{
"name": "hcl",
"camelcase": "Hcl",
"scope": "source.hcl",
"path": ".",
"file-types": [
"hcl",
"tf",
"tfvars"
]
}
],
"metadata": {
"version": "0.2.0-snapshot",
"license": "ISC",
"description": "",
"links": {
"repository": "https://github.com/tree-sitter/tree-sitter-hcl"
}
},
"bindings": {
"c": true,
"go": true,
"node": true,
"python": true,
"rust": true,
"swift": true
}
}