Compare commits

..

No commits in common. "4e60cf3c2e613625c06f6f85540b3631e2d06cd3" and "2326d709fb9cf73cf124fdbc803c267f851721a4" have entirely different histories.

12 changed files with 1450 additions and 1710 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-bp"
description = "Blueprint grammar for the tree-sitter parsing library"
version = "0.5.0"
version = "0.4.0"
keywords = ["incremental", "parsing", "android", "blueprint"]
categories = ["parsing", "text-editors"]
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-bp"

View file

@ -163,17 +163,9 @@ module.exports = grammar({
_select_pattern: ($) => choice(
$._string_literal,
$.boolean_literal,
alias("any", $.any),
$.pattern_binding,
alias("default", $.default),
),
pattern_binding: ($) => seq(
field("value", alias("any", $.any)),
field("operator", alias("@", $.operator)),
field("binding", $.identifier),
),
_case_value: ($) => choice(
alias("unset", $.unset),
$._expr,

View file

@ -1,6 +1,6 @@
{
"name": "tree-sitter-bp",
"version": "0.5.0",
"version": "0.4.0",
"description": "Blueprint grammar for tree-sitter",
"main": "bindings/node",
"types": "bindings/node",

View file

@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "tree-sitter-bp"
description = "Bp grammar for tree-sitter"
version = "0.5.0"
version = "0.4.0"
keywords = ["incremental", "parsing", "tree-sitter", "bp"]
classifiers = [
"Intended Audience :: Developers",

View file

@ -50,7 +50,6 @@
[
(unset)
(default)
(any)
] @variable.builtin
(condition
name: (identifier) @function.builtin)

View file

@ -9,9 +9,6 @@
(assignment
left: (identifier) @local.definition.var)
(pattern_binding
binding: (identifier) @local.definition.var)
(identifier) @local.reference
; vim: sw=2 foldmethod=marker

52
src/grammar.json generated
View file

@ -735,19 +735,6 @@
"type": "SYMBOL",
"name": "boolean_literal"
},
{
"type": "ALIAS",
"content": {
"type": "STRING",
"value": "any"
},
"named": true,
"value": "any"
},
{
"type": "SYMBOL",
"name": "pattern_binding"
},
{
"type": "ALIAS",
"content": {
@ -759,45 +746,6 @@
}
]
},
"pattern_binding": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "value",
"content": {
"type": "ALIAS",
"content": {
"type": "STRING",
"value": "any"
},
"named": true,
"value": "any"
}
},
{
"type": "FIELD",
"name": "operator",
"content": {
"type": "ALIAS",
"content": {
"type": "STRING",
"value": "@"
},
"named": true,
"value": "operator"
}
},
{
"type": "FIELD",
"name": "binding",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
}
]
},
"_case_value": {
"type": "CHOICE",
"members": [

48
src/node-types.json generated
View file

@ -321,42 +321,6 @@
}
}
},
{
"type": "pattern_binding",
"named": true,
"fields": {
"binding": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
},
"operator": {
"multiple": false,
"required": true,
"types": [
{
"type": "operator",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "any",
"named": true
}
]
}
}
},
{
"type": "property",
"named": true,
@ -519,10 +483,6 @@
"multiple": true,
"required": true,
"types": [
{
"type": "any",
"named": true
},
{
"type": "boolean_literal",
"named": true
@ -535,10 +495,6 @@
"type": "interpreted_string_literal",
"named": true
},
{
"type": "pattern_binding",
"named": true
},
{
"type": "raw_string_literal",
"named": true
@ -628,10 +584,6 @@
"type": "]",
"named": false
},
{
"type": "any",
"named": true
},
{
"type": "default",
"named": true

3022
src/parser.c generated

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,6 @@ Select
foo = select(release_variable("RELEASE_TEST"), {
"d": "d2",
any: unset,
default: unset,
})
@ -24,10 +23,6 @@ foo = select(release_variable("RELEASE_TEST"), {
(select_pattern
(interpreted_string_literal))
(interpreted_string_literal))
(select_case
(select_pattern
(any))
(unset))
(select_case
(select_pattern
(default))
@ -40,7 +35,6 @@ Select (soong config variable)
foo = select(soong_config_variable("my_namespace", "my_var"), {
"foo": unset,
"default": "bar",
any @ foo: unset,
})
--------------------------------------------------------------------------------
@ -63,14 +57,7 @@ foo = select(soong_config_variable("my_namespace", "my_var"), {
(select_case
(select_pattern
(interpreted_string_literal))
(interpreted_string_literal))
(select_case
(select_pattern
(pattern_binding
(any)
(operator)
(identifier)))
(unset))))))
(interpreted_string_literal))))))
================================================================================
Select (no default)

View file

@ -2,8 +2,6 @@ foo = select(soong_config_variable("my_namespace", "my_var"), {
// ^ function.builtin
"foo": unset,
// ^ variable.builtin
any: unset,
// <- variable.builtin
default: select(variant("VARIANT"), {}),
// <- variable.builtin
// ^ function.builtin

View file

@ -1,9 +1,6 @@
foo = select(soong_config_variable("my_namespace", "my_var"), {
// ^ keyword.conditional
"foo": unset,
any @ foo: unset,
// ^ operator
// ^ variable
default: "bar",
})