Compare commits
10 commits
060ea8a5ef
...
dd50817b9d
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | dd50817b9d | ||
Bruno BELANYI | 4a20da5c8f | ||
Bruno BELANYI | 05cec8d831 | ||
Bruno BELANYI | 8d917d11a0 | ||
Bruno BELANYI | b3f3b2f147 | ||
Bruno BELANYI | dea4120ece | ||
Bruno BELANYI | 64c29499e7 | ||
Bruno BELANYI | 03fa5fdf85 | ||
Bruno BELANYI | 37ee75c64d | ||
Bruno BELANYI | 3cb30584df |
121
grammar.js
121
grammar.js
|
@ -2,6 +2,10 @@ function commaSeparated(elem) {
|
||||||
return seq(elem, repeat(seq(",", elem)), optional(","))
|
return seq(elem, repeat(seq(",", elem)), optional(","))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trailingCommaSeparated(elem) {
|
||||||
|
return repeat(seq(elem, ","))
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = grammar({
|
module.exports = grammar({
|
||||||
name: "blueprint",
|
name: "blueprint",
|
||||||
|
|
||||||
|
@ -11,11 +15,11 @@ module.exports = grammar({
|
||||||
],
|
],
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
// TODO: add the actual grammar rules
|
|
||||||
source_file: ($) => repeat($._definition),
|
source_file: ($) => repeat($._definition),
|
||||||
|
|
||||||
_definition: ($) => choice(
|
_definition: ($) => choice(
|
||||||
$.assignment,
|
$.assignment,
|
||||||
|
$.module,
|
||||||
),
|
),
|
||||||
|
|
||||||
comment: (_) => seq("#", /.*/),
|
comment: (_) => seq("#", /.*/),
|
||||||
|
@ -28,21 +32,52 @@ module.exports = grammar({
|
||||||
field("right", $._expr),
|
field("right", $._expr),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
module: ($) => choice(
|
||||||
|
$._old_module,
|
||||||
|
$._new_module,
|
||||||
|
),
|
||||||
|
|
||||||
|
// This syntax is deprecated, but still accepted
|
||||||
|
_old_module: ($) => seq(
|
||||||
|
field("type", $.identifier),
|
||||||
|
"{",
|
||||||
|
optional(commaSeparated(
|
||||||
|
alias(field("property", $._colon_property), $.property)
|
||||||
|
)),
|
||||||
|
"}",
|
||||||
|
),
|
||||||
|
|
||||||
|
_new_module: ($) => seq(
|
||||||
|
$.identifier,
|
||||||
|
"(",
|
||||||
|
optional(commaSeparated(
|
||||||
|
alias(field("property", $._equal_property), $.property)
|
||||||
|
)),
|
||||||
|
")",
|
||||||
|
),
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// Expressions {{{
|
// Expressions {{{
|
||||||
|
|
||||||
_expr: ($) => choice(
|
_expr: ($) => choice(
|
||||||
|
// Literals
|
||||||
$.identifier,
|
$.identifier,
|
||||||
|
$.boolean_literal,
|
||||||
$.integer_literal,
|
$.integer_literal,
|
||||||
$._string_literal,
|
$._string_literal,
|
||||||
|
// Conditionals
|
||||||
|
$.select_expression,
|
||||||
// Composites
|
// Composites
|
||||||
$.list_expression,
|
$.list_expression,
|
||||||
|
$.map_expression,
|
||||||
),
|
),
|
||||||
|
|
||||||
// The Blueprint scanner makes use of Go's lexer, so copy their rule
|
// The Blueprint scanner makes use of Go's lexer, so copy their rule
|
||||||
identifier: (_) => /[_\p{XID_Start}][_\p{XID_Continue}]*/,
|
identifier: (_) => /[_\p{XID_Start}][_\p{XID_Continue}]*/,
|
||||||
|
|
||||||
|
boolean_literal: (_) => choice("true", "false"),
|
||||||
|
|
||||||
integer_literal: (_) => seq(optional("-"), /[0-9]+/),
|
integer_literal: (_) => seq(optional("-"), /[0-9]+/),
|
||||||
|
|
||||||
// The Blueprint scanner makes use of Go's lexer, so copy their rule
|
// The Blueprint scanner makes use of Go's lexer, so copy their rule
|
||||||
|
@ -78,12 +113,94 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
select_expression: ($) => seq(
|
||||||
|
"select",
|
||||||
|
"(",
|
||||||
|
choice($.select_value, $.soong_config_variable),
|
||||||
|
",",
|
||||||
|
$.select_cases,
|
||||||
|
")",
|
||||||
|
),
|
||||||
|
|
||||||
|
select_value: ($) => seq(
|
||||||
|
field("type", alias(
|
||||||
|
choice("product_variable", "release_variable", "variant"),
|
||||||
|
$.selection_type,
|
||||||
|
)),
|
||||||
|
"(",
|
||||||
|
field("condition", $._string_literal),
|
||||||
|
")",
|
||||||
|
),
|
||||||
|
|
||||||
|
soong_config_variable: ($) => seq(
|
||||||
|
field("type", alias("soong_config_variable", $.selection_type)),
|
||||||
|
"(",
|
||||||
|
field(
|
||||||
|
"condition",
|
||||||
|
seq(
|
||||||
|
field("namespace", $._string_literal),
|
||||||
|
",",
|
||||||
|
field("variable", $._string_literal),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
")",
|
||||||
|
),
|
||||||
|
|
||||||
|
select_cases: ($) => seq(
|
||||||
|
"{",
|
||||||
|
optional(trailingCommaSeparated($.select_case)),
|
||||||
|
// default *must* be the last one, enforced at parse-time...
|
||||||
|
optional(seq($.default_case, ",")),
|
||||||
|
"}",
|
||||||
|
),
|
||||||
|
|
||||||
|
select_case: ($) => seq(
|
||||||
|
field("pattern", $._string_literal),
|
||||||
|
":",
|
||||||
|
field("value", $._case_value)
|
||||||
|
),
|
||||||
|
|
||||||
|
default_case: ($) => seq(
|
||||||
|
field("pattern", "default"),
|
||||||
|
":",
|
||||||
|
field("value", $._case_value),
|
||||||
|
),
|
||||||
|
|
||||||
|
_case_value: ($) => choice(
|
||||||
|
alias("unset", $.unset),
|
||||||
|
$._expr,
|
||||||
|
),
|
||||||
|
|
||||||
list_expression: ($) => seq(
|
list_expression: ($) => seq(
|
||||||
"[",
|
"[",
|
||||||
optional(commaSeparated($._expr)),
|
optional(commaSeparated(field("element", $._expr))),
|
||||||
"]",
|
"]",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
map_expression: ($) => seq(
|
||||||
|
"{",
|
||||||
|
optional(commaSeparated(
|
||||||
|
alias(field("property", $._colon_property), $.property)
|
||||||
|
)),
|
||||||
|
"}",
|
||||||
|
),
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// Properties {{{
|
||||||
|
|
||||||
|
_colon_property: ($) => seq(
|
||||||
|
field("field", $.identifier),
|
||||||
|
":",
|
||||||
|
field("value", $._expr),
|
||||||
|
),
|
||||||
|
|
||||||
|
_equal_property: ($) => seq(
|
||||||
|
field("field", $.identifier),
|
||||||
|
"=",
|
||||||
|
field("value", $._expr),
|
||||||
|
),
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
614
src/grammar.json
generated
614
src/grammar.json
generated
|
@ -14,6 +14,10 @@
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "assignment"
|
"name": "assignment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "module"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -68,6 +72,183 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"module": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_old_module"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_new_module"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_old_module": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "type",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "property",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_colon_property"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "property"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "property",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_colon_property"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "property"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_new_module": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "("
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "property",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_equal_property"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "property"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "property",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_equal_property"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "property"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ")"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"_expr": {
|
"_expr": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -75,6 +256,10 @@
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "boolean_literal"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "integer_literal"
|
"name": "integer_literal"
|
||||||
|
@ -83,9 +268,17 @@
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_string_literal"
|
"name": "_string_literal"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "select_expression"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "list_expression"
|
"name": "list_expression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "map_expression"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -93,6 +286,19 @@
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[_\\p{XID_Start}][_\\p{XID_Continue}]*"
|
"value": "[_\\p{XID_Start}][_\\p{XID_Continue}]*"
|
||||||
},
|
},
|
||||||
|
"boolean_literal": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "false"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"integer_literal": {
|
"integer_literal": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -216,6 +422,272 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"select_expression": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "select"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "("
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "select_value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "soong_config_variable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "select_cases"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ")"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"select_value": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "type",
|
||||||
|
"content": {
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "product_variable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "release_variable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "variant"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "selection_type"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "("
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "condition",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_string_literal"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ")"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"soong_config_variable": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "type",
|
||||||
|
"content": {
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "soong_config_variable"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "selection_type"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "("
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "condition",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "namespace",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_string_literal"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "variable",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_string_literal"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ")"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"select_cases": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "select_case"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "default_case"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"select_case": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "pattern",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_string_literal"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ":"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "value",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_case_value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"default_case": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "pattern",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ":"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "value",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_case_value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_case_value": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "unset"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "unset"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"list_expression": {
|
"list_expression": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -230,8 +702,12 @@
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "FIELD",
|
||||||
"name": "_expr"
|
"name": "element",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expr"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "REPEAT",
|
"type": "REPEAT",
|
||||||
|
@ -243,8 +719,12 @@
|
||||||
"value": ","
|
"value": ","
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "FIELD",
|
||||||
"name": "_expr"
|
"name": "element",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expr"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -273,6 +753,132 @@
|
||||||
"value": "]"
|
"value": "]"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"map_expression": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "property",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_colon_property"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "property"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "property",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_colon_property"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "property"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_colon_property": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "field",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ":"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "value",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expr"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_equal_property": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "field",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "="
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "value",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expr"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extras": [
|
"extras": [
|
||||||
|
|
458
src/node-types.json
generated
458
src/node-types.json
generated
|
@ -31,6 +31,10 @@
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "boolean_literal",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
|
@ -47,19 +51,90 @@
|
||||||
"type": "list_expression",
|
"type": "list_expression",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "map_expression",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "raw_string_literal",
|
"type": "raw_string_literal",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select_expression",
|
||||||
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean_literal",
|
||||||
|
"named": true,
|
||||||
|
"fields": {}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "comment",
|
"type": "comment",
|
||||||
"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": "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,
|
||||||
|
@ -83,34 +158,341 @@
|
||||||
{
|
{
|
||||||
"type": "list_expression",
|
"type": "list_expression",
|
||||||
"named": true,
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"element": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"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": "map_expression",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"property": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "property",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "module",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"property": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "property",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "property",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"field": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"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": "select_case",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"pattern": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "interpreted_string_literal",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "raw_string_literal",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"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": "select_cases",
|
||||||
|
"named": true,
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "default_case",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "integer_literal",
|
"type": "select_case",
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "interpreted_string_literal",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "list_expression",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "raw_string_literal",
|
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "select_expression",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "select_cases",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select_value",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "soong_config_variable",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select_value",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"condition": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "interpreted_string_literal",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "raw_string_literal",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "selection_type",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "soong_config_variable",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"condition": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": ",",
|
||||||
|
"named": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"namespace": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "interpreted_string_literal",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "raw_string_literal",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "selection_type",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"variable": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "interpreted_string_literal",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "raw_string_literal",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "source_file",
|
"type": "source_file",
|
||||||
"named": true,
|
"named": true,
|
||||||
|
@ -122,6 +504,10 @@
|
||||||
{
|
{
|
||||||
"type": "assignment",
|
"type": "assignment",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "module",
|
||||||
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -134,6 +520,14 @@
|
||||||
"type": "#",
|
"type": "#",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "(",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": ")",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "+=",
|
"type": "+=",
|
||||||
"named": false
|
"named": false
|
||||||
|
@ -146,6 +540,10 @@
|
||||||
"type": "-",
|
"type": "-",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": ":",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "=",
|
"type": "=",
|
||||||
"named": false
|
"named": false
|
||||||
|
@ -158,10 +556,18 @@
|
||||||
"type": "]",
|
"type": "]",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "escape_sequence",
|
"type": "escape_sequence",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "false",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
|
@ -169,5 +575,29 @@
|
||||||
{
|
{
|
||||||
"type": "raw_string_literal",
|
"type": "raw_string_literal",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "selection_type",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "true",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "unset",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "{",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "}",
|
||||||
|
"named": false
|
||||||
}
|
}
|
||||||
]
|
]
|
5431
src/parser.c
generated
5431
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,37 @@
|
||||||
|
================================================================================
|
||||||
|
Boolean
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = false
|
||||||
|
foo = true
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(boolean_literal))
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(boolean_literal)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Boolean (identifier/literal)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
true = false
|
||||||
|
false = true
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(boolean_literal))
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(boolean_literal)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Integer
|
Integer
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -186,3 +220,127 @@ foo = [
|
||||||
(identifier)
|
(identifier)
|
||||||
(list_expression
|
(list_expression
|
||||||
(ERROR))))
|
(ERROR))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (empty)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (singleton)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {foo:42}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal)))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (singleton multiline)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {
|
||||||
|
foo: 42
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal)))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (singleton trailing comma)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {
|
||||||
|
foo: 42,
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal)))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (mixed values)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {
|
||||||
|
answer: 42,
|
||||||
|
value: "foobar",
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal))
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(interpreted_string_literal)))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (map of map)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {
|
||||||
|
the: {answer: 42},
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal)))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Map (rogue comma)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = {
|
||||||
|
,
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(map_expression
|
||||||
|
(ERROR))))
|
||||||
|
|
123
test/corpus/modules.txt
Normal file
123
test/corpus/modules.txt
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
================================================================================
|
||||||
|
Empty module
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo{}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Empty module (newlines)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo {
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Single property
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo {
|
||||||
|
bar: 42
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Single property (trailing comma)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo {
|
||||||
|
bar: 42,
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Mixed values
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo {
|
||||||
|
active: true,
|
||||||
|
value: "foo",
|
||||||
|
answer: 42,
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(boolean_literal))
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(integer_literal))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Complex value
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo {
|
||||||
|
some: [
|
||||||
|
{
|
||||||
|
complex: "value",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(list_expression
|
||||||
|
(map_expression
|
||||||
|
(property
|
||||||
|
(identifier)
|
||||||
|
(interpreted_string_literal)))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Rogue comma
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo {
|
||||||
|
,
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(module
|
||||||
|
(identifier)
|
||||||
|
(ERROR)))
|
187
test/corpus/select.txt
Normal file
187
test/corpus/select.txt
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
================================================================================
|
||||||
|
Select
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(release_variable("RELEASE_TEST"), {
|
||||||
|
"d": "d2",
|
||||||
|
default: unset,
|
||||||
|
})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(select_expression
|
||||||
|
(select_value
|
||||||
|
(selection_type)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_cases
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(default_case
|
||||||
|
(unset))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Select (soong config variable)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(soong_config_variable("my_namespace", "my_var"), {
|
||||||
|
"foo": unset,
|
||||||
|
"default": "bar",
|
||||||
|
})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(select_expression
|
||||||
|
(soong_config_variable
|
||||||
|
(selection_type)
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_cases
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(unset))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Select (no default)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(variant("arch"), {
|
||||||
|
"x86": "my_x86",
|
||||||
|
"x86_64": "my_x86_64",
|
||||||
|
"arm": "my_arm",
|
||||||
|
"arm64": "my_arm64",
|
||||||
|
})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(select_expression
|
||||||
|
(select_value
|
||||||
|
(selection_type)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_cases
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Select (no values)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(variant("VARIANT"), {})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(select_expression
|
||||||
|
(select_value
|
||||||
|
(selection_type)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_cases))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Select (default in wrong order)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(variant("VARIANT"), {
|
||||||
|
"x86": "my_x86",
|
||||||
|
"x86_64": "my_x86_64",
|
||||||
|
default: unset,
|
||||||
|
"arm": "my_arm",
|
||||||
|
"arm64": "my_arm64",
|
||||||
|
})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(select_expression
|
||||||
|
(select_value
|
||||||
|
(selection_type)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_cases
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(ERROR
|
||||||
|
(default_case
|
||||||
|
(unset)))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Select (no condition)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(variant(), {
|
||||||
|
"d": unset,
|
||||||
|
default: "f2",
|
||||||
|
})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(select_expression
|
||||||
|
(select_value
|
||||||
|
(selection_type)
|
||||||
|
(MISSING raw_string_literal))
|
||||||
|
(select_cases
|
||||||
|
(select_case
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(unset))
|
||||||
|
(default_case
|
||||||
|
(interpreted_string_literal))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Select (invalid type)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = select(some_unknown_type("CONDITION"), {
|
||||||
|
"d": "d2",
|
||||||
|
default: "f2",
|
||||||
|
})
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(ERROR
|
||||||
|
(identifier)
|
||||||
|
(identifier)
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(interpreted_string_literal))
|
||||||
|
(ERROR))
|
Loading…
Reference in a new issue