Giter Site home page Giter Site logo

prestonknopp / tree-sitter-godot-resource Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 2.0 83 KB

Godot resource grammar for tree-sitter. Parses tscn, tres, and project.godot files.

Home Page: https://www.npmjs.com/package/tree-sitter-godot-resource

License: MIT License

Python 3.04% JavaScript 49.71% C++ 10.13% Rust 37.12%

tree-sitter-godot-resource's Introduction

tree-sitter-godot-resource

Godot resource grammar for tree-sitter.

Parses tscn and tres files.

tree-sitter-godot-resource's People

Contributors

pierpo avatar prestonknopp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pierpo boyquotes

tree-sitter-godot-resource's Issues

Error

I get this error when I try to add godot_resource to treesitter:

tree-sitter CLI not found: `tree-sitter` is not executable!

I have to remove godot_resource to not get this error at startup of Neovim.

Parsing mistake for arrays in resource files

The square brackets used for the array type incorrectly trigger a new section in the language tree.

Here's an example.
I defined a custom resource type containing an array:

class_name TestResource
extends Resource

@export var test_array: Array[int]

This is an example of what the resource file looks like:

[gd_resource type="Resource" script_class="TestResource" load_steps=2 format=3 uid="uid://8w1p11bcyooo"]

[ext_resource type="Script" path="res://test_resource.gd" id="1_rtd2s"]

[resource]
script = ExtResource("1_rtd2s")
test_array = Array[int]([42, 76])

This is what the tree looks like:

(section) ; [1:1 - 104]
 (identifier) ; [1:2 - 12]
 (attribute) ; [1:14 - 28]
  (identifier) ; [1:14 - 17]
  (string) ; [1:19 - 28]
 (attribute) ; [1:30 - 56]
  (identifier) ; [1:30 - 41]
  (string) ; [1:43 - 56]
 (attribute) ; [1:58 - 69]
  (identifier) ; [1:58 - 67]
  (integer) ; [1:69 - 69]
 (attribute) ; [1:71 - 78]
  (identifier) ; [1:71 - 76]
  (integer) ; [1:78 - 78]
 (attribute) ; [1:80 - 103]
  (identifier) ; [1:80 - 82]
  (string) ; [1:84 - 103]
(section) ; [3:1 - 71]
 (identifier) ; [3:2 - 13]
 (attribute) ; [3:15 - 27]
  (identifier) ; [3:15 - 18]
  (string) ; [3:20 - 27]
 (attribute) ; [3:29 - 57]
  (identifier) ; [3:29 - 32]
  (string) ; [3:34 - 57]
 (attribute) ; [3:59 - 70]
  (identifier) ; [3:59 - 60]
  (string) ; [3:62 - 70]
(section) ; [5:1 - 7:18]
 (identifier) ; [5:2 - 9]
 (property) ; [6:1 - 31]
  (path) ; [6:1 - 6]
  (constructor) ; [6:10 - 31]
   (identifier) ; [6:10 - 20]
   (arguments) ; [6:21 - 31]
    (string) ; [6:22 - 30]
 (property) ; [7:1 - 18]
  (path) ; [7:1 - 10]
  (identifier) ; [7:14 - 18]
(section) ; [7:19 - 23]
 (identifier) ; [7:20 - 22]
(ERROR) ; [7:24 - 33]
 (integer) ; [7:26 - 27]
 (integer) ; [7:30 - 31]

[int] is wrongly parsed as (section) ; [7:19 - 23]. Also, it results in an (ERROR) node for what follows after.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.