Git Product home page Git Product logo

tree-sitter-bitbake's Introduction

tree-sitter-bitbake's People

Contributors

amaanq avatar clason avatar fymyte avatar github-actions[bot] avatar idillon-sfl avatar wilsonziweiwang avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

tree-sitter-bitbake's Issues

Functions defined into an other function gives an error

A function defined into an other function gives an error

Here's a real-life example from meta-openembedded: https://github.com/openembedded/meta-openembedded/blob/4dbbef7a39ad18206ca6cebf7a1e08aebe5b5a65/meta-oe/recipes-support/opencv/opencv_4.8.0.bb#L46

Here's a minimal example:

func() {
    nestedfunc() {
        echo "test"
    }
}

output:

(recipe [0, 0] - [5, 0]
  (ERROR [0, 0] - [4, 1]
    (function_definition [0, 0] - [3, 5]
      (identifier [0, 0] - [0, 4])
      (ERROR [0, 7] - [1, 16]
        (ERROR [1, 4] - [1, 14]))
      (shell_content [2, 8] - [2, 19]))))

Thank you

Line continuation with backslashe generates error in some cases

I noticed the line continuation with backslashes generates errors in some cases. Unfortunately, I failed to understand exactly when it happens. Most of the time, it seems not to be an issue.

Here two real life examples taken from Poky:
https://git.yoctoproject.org/poky/tree/meta/classes/recipe_sanity.bbclass#n45
https://git.yoctoproject.org/poky/tree/meta/classes/copyleft_filter.bbclass#n76

Here an other example I made myself:

def example():
    print('test', \
        True
    )

Curiously, in this example, the parsing works properly if True is replaced by a string.

Thank you

Unused identifiers give weird errors when something comes after them

An unused identifier is invalid code and is expected to give errors. However, when some valid code come after it, the errors get weird and it make it difficult to provide something useful to the user.

This one is fine:

BAR='bar'
FOO
(recipe [0, 0] - [1, 3]
  (variable_assignment [0, 0] - [0, 9]
    (identifier [0, 0] - [0, 3])
    (literal [0, 4] - [0, 9]
      (string [0, 4] - [0, 9]
        (string_content [0, 5] - [0, 8]))))
  (ERROR [1, 0] - [1, 3]
    (identifier [1, 0] - [1, 3])))

These are not:
1.

FOO
BAR='bar'
(recipe [0, 0] - [1, 9]
  (variable_assignment [0, 0] - [1, 9]
    (identifier [0, 0] - [0, 3])
    (ERROR [1, 0] - [1, 3]
      (python_identifier [1, 0] - [1, 3]))
    (literal [1, 4] - [1, 9]
      (string [1, 4] - [1, 9]
        (string_content [1, 5] - [1, 8])))))
FOO
BAR() {
    
}
(recipe [0, 0] - [3, 1]
  (function_definition [0, 0] - [3, 1]
    (identifier [0, 0] - [0, 3])
    (ERROR [1, 0] - [1, 3]
      (python_identifier [1, 0] - [1, 3]))))
FOO
python bar() {

}
(recipe [0, 0] - [3, 1]
  (function_definition [0, 0] - [3, 1]
    (identifier [0, 0] - [0, 3])
    (ERROR [1, 0] - [1, 10]
      (python_identifier [1, 0] - [1, 6])
      (ERROR [1, 7] - [1, 10]))))

In each cases the FOO identifier is wrongly put inside a function_definition. A python_identifier also comes out of nowhere in 1. and 2.

Support for 3.x syntax

I was wondering if it'd be possible to support the 3.x syntax. For example, _append instead of :append.

Can we make the identifier optional for variable expansion syntax?

Version: 1.0.1
Currently, the ${} with an identifier will be treated as variable expansion:
variable_expansion: $ => seq('${', $.identifier, '}'),
when there is an empty ${}, the generated tree node is unrelated to variable expansion.
image

Can we make the identifier optional such that ${} alone can be treated as variable expansion?
The language extension will be able to provide the desired completion even with empty ${}

Can't handle period in inherited filename

In the line inherit update-rc.d, everything after (including) period is parsed as error. It should probably handle all characters valid in a unix filename?
It stopped working after I updated treesitter, but I think, it previously used only nvim's regex highlighting.

Can't handle override syntax in the last line of the file

Version:
1.0.1

Current behaviour:
The same overrides syntax in tree-sitter is treated differently as shown in these screenshots. When it is not in the last line in the file, it is treated as the override (even though it is still picking up the content following). When it is in the last line, it is treated as an identifier and nothing related to override anymore.
image
image

Expectation:
When it encounters MYVAR:a: in the last line of the file, it still treats it as overrides or partially. This is an override statement yet to be completed and it will benefit the completion in language extension.

Good to have:
When it encounters MYVAR:a: not in the last line of the file, the current one is enough to identify an override syntax to perform further actions. But it will be nice if it won't pick up the content following as part of the override syntax.

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.