mirror of
https://github.com/github/codeql.git
synced 2026-05-14 03:09:26 +02:00
unified: make compilation_condition named and add fields
This commit is contained in:
@@ -2027,46 +2027,46 @@ module.exports = grammar({
|
||||
prec.right(
|
||||
PRECS.comment,
|
||||
choice(
|
||||
seq(alias($._directive_if, "#if"), $._compilation_condition),
|
||||
seq(alias($._directive_elseif, "#elseif"), $._compilation_condition),
|
||||
seq(alias($._directive_if, "#if"), field("condition", $.compilation_condition)),
|
||||
seq(alias($._directive_elseif, "#elseif"), field("condition", $.compilation_condition)),
|
||||
seq(alias($._directive_else, "#else")),
|
||||
seq(alias($._directive_endif, "#endif"))
|
||||
)
|
||||
),
|
||||
_compilation_condition: ($) =>
|
||||
compilation_condition: ($) =>
|
||||
prec.right(
|
||||
choice(
|
||||
seq("os", "(", $.simple_identifier, ")"),
|
||||
seq("arch", "(", $.simple_identifier, ")"),
|
||||
seq("os", "(", field("name", $.simple_identifier), ")"),
|
||||
seq("arch", "(", field("name", $.simple_identifier), ")"),
|
||||
seq(
|
||||
"swift",
|
||||
"(",
|
||||
$._comparison_operator,
|
||||
sep1($.integer_literal, "."),
|
||||
sep1(field("version", $.integer_literal), "."),
|
||||
")"
|
||||
),
|
||||
seq(
|
||||
"compiler",
|
||||
"(",
|
||||
$._comparison_operator,
|
||||
sep1($.integer_literal, "."),
|
||||
sep1(field("version", $.integer_literal), "."),
|
||||
")"
|
||||
),
|
||||
seq("canImport", "(", sep1($.simple_identifier, "."), ")"),
|
||||
seq("targetEnvironment", "(", $.simple_identifier, ")"),
|
||||
$.boolean_literal,
|
||||
$.simple_identifier,
|
||||
seq("(", $._compilation_condition, ")"),
|
||||
seq("!", $._compilation_condition),
|
||||
seq("canImport", "(", sep1(field("name", $.simple_identifier), "."), ")"),
|
||||
seq("targetEnvironment", "(", field("name", $.simple_identifier), ")"),
|
||||
field("value", $.boolean_literal),
|
||||
field("name", $.simple_identifier),
|
||||
seq("(", field("inner", $.compilation_condition), ")"),
|
||||
seq("!", field("operand", $.compilation_condition)),
|
||||
seq(
|
||||
$._compilation_condition,
|
||||
field("lhs", $.compilation_condition),
|
||||
$._conjunction_operator,
|
||||
$._compilation_condition
|
||||
field("rhs", $.compilation_condition)
|
||||
),
|
||||
seq(
|
||||
$._compilation_condition,
|
||||
field("lhs", $.compilation_condition),
|
||||
$._disjunction_operator,
|
||||
$._compilation_condition
|
||||
field("rhs", $.compilation_condition)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -193,6 +193,14 @@ named:
|
||||
lhs: expression
|
||||
op: ["<", "<=", ">", ">="]
|
||||
rhs: expression
|
||||
compilation_condition:
|
||||
inner?: compilation_condition
|
||||
lhs?: compilation_condition
|
||||
name*: simple_identifier
|
||||
operand?: compilation_condition
|
||||
rhs?: compilation_condition
|
||||
value?: boolean_literal
|
||||
version*: integer_literal
|
||||
computed_getter:
|
||||
attribute*: attribute
|
||||
body?: statements
|
||||
@@ -242,7 +250,7 @@ named:
|
||||
modifiers?: modifiers
|
||||
parameter?: simple_identifier
|
||||
directive:
|
||||
$children*: [boolean_literal, integer_literal, simple_identifier]
|
||||
condition?: compilation_condition
|
||||
directly_assignable_expression:
|
||||
expr: expression
|
||||
disjunction_expression:
|
||||
|
||||
Reference in New Issue
Block a user