Compare commits

...

2 commits

Author SHA1 Message Date
aeb1fc2bb5 Allow optional trailing comma in 'select'
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-12-23 22:59:05 -05:00
fd92a31674 Fix typos 2024-12-23 22:55:38 -05:00
5 changed files with 1348 additions and 1216 deletions

View file

@ -6,7 +6,7 @@
//! ```
//! let code = "";
//! let mut parser = tree_sitter::Parser::new();
//! parser.set_language(tree_sitter_bp::language()).expect("Error loading txtpb grammar");
//! parser.set_language(tree_sitter_bp::language()).expect("Error loading bp grammar");
//! let tree = parser.parse(code, None).unwrap();
//! ```
//!

View file

@ -145,7 +145,7 @@ module.exports = grammar({
select_cases: ($) => seq(
"{",
optional(commaSeparatedTrailing($.select_case)),
optional(commaSeparatedOptTrailing($.select_case)),
"}",
),

47
src/grammar.json generated
View file

@ -614,20 +614,41 @@
"type": "CHOICE",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "select_case"
},
{
"type": "STRING",
"value": ","
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "select_case"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "select_case"
}
]
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"

2488
src/parser.c generated

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,31 @@ foo = select(release_variable("RELEASE_TEST"), {
(default))
(unset))))))
================================================================================
Select (no trailing comma)
================================================================================
foo = select(release_variable("RELEASE_TEST"), {
default: unset
})
--------------------------------------------------------------------------------
(source_file
(assignment
(identifier)
(operator)
(select_expression
(select_value
(condition
(identifier)
(interpreted_string_literal)))
(select_cases
(select_case
(select_pattern
(default))
(unset))))))
================================================================================
Select (soong config variable)
================================================================================