BitBake grammar for tree-sitter
tree-sitter-grammars / tree-sitter-bitbake Goto Github PK
View Code? Open in Web Editor NEWBitBake grammar for tree-sitter
License: MIT License
BitBake grammar for tree-sitter
License: MIT License
BitBake grammar for tree-sitter
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
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
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.
I was wondering if it'd be possible to support the 3.x syntax. For example, _append
instead of :append
.
A bracket inside a string inside a function gives an error
d() {
t = '{'
}
A bracket inside a comment gives an error
do() {
# {
}
It does work inside python functions, though
Thank you
Hello!
I noticed inline_python won't be detected when inside a shell function
Here's a somewhat minimal example:
foo() {
echo ${@"bar"}
}
Here a real-life example from poky: https://git.yoctoproject.org/poky/tree/meta/recipes-support/icu/icu_73-2.bb#n126
Thank you, we love this library
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.
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 ${}
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.
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.
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.
It seems fakeroot is not supported on python functions and gives an error:
fakeroot python() {
pass
}
Here's a real life example: https://git.yoctoproject.org/poky/tree/meta/recipes-core/meta/uninative-tarball.bb#n45
However, it does work on bash functions
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.