Compare commits
3 commits
d297f38e6a
...
6ece5d984a
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 6ece5d984a | ||
Bruno BELANYI | e6a2757c51 | ||
Bruno BELANYI | 8db7b053f5 |
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tree-sitter-bp"
|
name = "tree-sitter-bp"
|
||||||
description = "Blueprint grammar for the tree-sitter parsing library"
|
description = "Blueprint grammar for the tree-sitter parsing library"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
keywords = ["incremental", "parsing", "android", "blueprint"]
|
keywords = ["incremental", "parsing", "android", "blueprint"]
|
||||||
categories = ["parsing", "text-editors"]
|
categories = ["parsing", "text-editors"]
|
||||||
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-bp"
|
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-bp"
|
||||||
|
|
|
@ -155,7 +155,7 @@ module.exports = grammar({
|
||||||
"{",
|
"{",
|
||||||
optional(trailingCommaSeparated($.select_case)),
|
optional(trailingCommaSeparated($.select_case)),
|
||||||
// default *must* be the last one, enforced at parse-time...
|
// default *must* be the last one, enforced at parse-time...
|
||||||
optional(seq($.default_case, ",")),
|
optional(seq(alias($.default_case, $.select_case), ",")),
|
||||||
"}",
|
"}",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
default_case: ($) => seq(
|
default_case: ($) => seq(
|
||||||
field("pattern", "default"),
|
field("pattern", alias("default", $.default)),
|
||||||
":",
|
":",
|
||||||
field("value", $._case_value),
|
field("value", $._case_value),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tree-sitter-bp",
|
"name": "tree-sitter-bp",
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"description": "Blueprint grammar for tree-sitter",
|
"description": "Blueprint grammar for tree-sitter",
|
||||||
"main": "bindings/node",
|
"main": "bindings/node",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
; Built-ins {{{
|
; Built-ins {{{
|
||||||
[
|
[
|
||||||
(unset)
|
(unset)
|
||||||
"default"
|
(default)
|
||||||
] @variable.builtin
|
] @variable.builtin
|
||||||
(selection_type) @function.builtin
|
(selection_type) @function.builtin
|
||||||
; }}}
|
; }}}
|
||||||
|
|
16
src/grammar.json
generated
16
src/grammar.json
generated
|
@ -635,8 +635,13 @@
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "ALIAS",
|
||||||
"name": "default_case"
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "default_case"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "select_case"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
|
@ -687,7 +692,12 @@
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "pattern",
|
"name": "pattern",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "STRING",
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "default"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
"value": "default"
|
"value": "default"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
72
src/node-types.json
generated
72
src/node-types.json
generated
|
@ -177,68 +177,6 @@
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {}
|
"fields": {}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "default_case",
|
|
||||||
"named": true,
|
|
||||||
"fields": {
|
|
||||||
"pattern": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "default",
|
|
||||||
"named": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "binary_expression",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean_literal",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "integer_literal",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "interpreted_string_literal",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "list_expression",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "map_expression",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "raw_string_literal",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "select_expression",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "unset",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "integer_literal",
|
"type": "integer_literal",
|
||||||
"named": true,
|
"named": true,
|
||||||
|
@ -415,6 +353,10 @@
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "interpreted_string_literal",
|
"type": "interpreted_string_literal",
|
||||||
"named": true
|
"named": true
|
||||||
|
@ -481,10 +423,6 @@
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
|
||||||
"type": "default_case",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "select_case",
|
"type": "select_case",
|
||||||
"named": true
|
"named": true
|
||||||
|
@ -668,7 +606,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "default",
|
"type": "default",
|
||||||
"named": false
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "escape_sequence",
|
"type": "escape_sequence",
|
||||||
|
|
6
src/parser.c
generated
6
src/parser.c
generated
|
@ -134,7 +134,7 @@ static const char * const ts_symbol_names[] = {
|
||||||
[sym_soong_config_variable] = "soong_config_variable",
|
[sym_soong_config_variable] = "soong_config_variable",
|
||||||
[sym_select_cases] = "select_cases",
|
[sym_select_cases] = "select_cases",
|
||||||
[sym_select_case] = "select_case",
|
[sym_select_case] = "select_case",
|
||||||
[sym_default_case] = "default_case",
|
[sym_default_case] = "select_case",
|
||||||
[sym__case_value] = "_case_value",
|
[sym__case_value] = "_case_value",
|
||||||
[sym_list_expression] = "list_expression",
|
[sym_list_expression] = "list_expression",
|
||||||
[sym_map_expression] = "map_expression",
|
[sym_map_expression] = "map_expression",
|
||||||
|
@ -201,7 +201,7 @@ static const TSSymbol ts_symbol_map[] = {
|
||||||
[sym_soong_config_variable] = sym_soong_config_variable,
|
[sym_soong_config_variable] = sym_soong_config_variable,
|
||||||
[sym_select_cases] = sym_select_cases,
|
[sym_select_cases] = sym_select_cases,
|
||||||
[sym_select_case] = sym_select_case,
|
[sym_select_case] = sym_select_case,
|
||||||
[sym_default_case] = sym_default_case,
|
[sym_default_case] = sym_select_case,
|
||||||
[sym__case_value] = sym__case_value,
|
[sym__case_value] = sym__case_value,
|
||||||
[sym_list_expression] = sym_list_expression,
|
[sym_list_expression] = sym_list_expression,
|
||||||
[sym_map_expression] = sym_map_expression,
|
[sym_map_expression] = sym_map_expression,
|
||||||
|
@ -335,7 +335,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
||||||
},
|
},
|
||||||
[anon_sym_default] = {
|
[anon_sym_default] = {
|
||||||
.visible = true,
|
.visible = true,
|
||||||
.named = false,
|
.named = true,
|
||||||
},
|
},
|
||||||
[anon_sym_unset] = {
|
[anon_sym_unset] = {
|
||||||
.visible = true,
|
.visible = true,
|
||||||
|
|
|
@ -21,7 +21,8 @@ foo = select(release_variable("RELEASE_TEST"), {
|
||||||
(select_case
|
(select_case
|
||||||
(interpreted_string_literal)
|
(interpreted_string_literal)
|
||||||
(interpreted_string_literal))
|
(interpreted_string_literal))
|
||||||
(default_case
|
(select_case
|
||||||
|
(default)
|
||||||
(unset))))))
|
(unset))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -135,7 +136,8 @@ foo = select(variant("VARIANT"), {
|
||||||
(interpreted_string_literal)
|
(interpreted_string_literal)
|
||||||
(interpreted_string_literal))
|
(interpreted_string_literal))
|
||||||
(ERROR
|
(ERROR
|
||||||
(default_case
|
(select_case
|
||||||
|
(default)
|
||||||
(unset)))
|
(unset)))
|
||||||
(select_case
|
(select_case
|
||||||
(interpreted_string_literal)
|
(interpreted_string_literal)
|
||||||
|
@ -167,7 +169,8 @@ foo = select(variant(), {
|
||||||
(select_case
|
(select_case
|
||||||
(interpreted_string_literal)
|
(interpreted_string_literal)
|
||||||
(unset))
|
(unset))
|
||||||
(default_case
|
(select_case
|
||||||
|
(default)
|
||||||
(interpreted_string_literal))))))
|
(interpreted_string_literal))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -189,7 +192,8 @@ foo = select(some_unknown_type("CONDITION"), {
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(identifier)
|
||||||
(interpreted_string_literal)
|
(interpreted_string_literal)
|
||||||
(interpreted_string_literal))
|
(interpreted_string_literal)
|
||||||
|
(default))
|
||||||
(interpreted_string_literal))
|
(interpreted_string_literal))
|
||||||
(ERROR))
|
(ERROR))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue