Skip to content

Commit

Permalink
Hiding useless rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tsoj committed Sep 4, 2024
1 parent 11fa2a7 commit a4c9b54
Show file tree
Hide file tree
Showing 18 changed files with 851,762 additions and 853,485 deletions.
16 changes: 8 additions & 8 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ module.exports = grammar(CPP1, {
[$.raw_string_literal, $.cpp2_raw_string_literal],

// Cpp2
[$.cpp2_no_namespace_identifier, $.cpp2_template_identifier],
[$._cpp2_no_namespace_identifier, $._cpp2_template_identifier],
[$.cpp2_unary_postfix_expression, $.cpp2_binary_expression],
[$.cpp2_unary_prefix_expression, $.cpp2_binary_expression],
[$.cpp2_block_loop, $.cpp2_do_while_statement],
[$._cpp2_declaration_left_side, $.cpp2_non_block_loop, $.cpp2_block_loop],
[$._cpp2_declaration_left_side, $.cpp2_block_loop],
[$.cpp2_type, $.cpp2_unary_postfix_expression, $.cpp2_binary_expression],
[$._cpp2_declaration_left_side, $.cpp2_no_namespace_identifier],
[$._cpp2_declaration_left_side, $._cpp2_no_namespace_identifier],
[$.cpp2_ordinary_identifier, $.cpp2_passing_style],
[$.cpp2_passing_style],
[$.cpp2_function_declaration_argument, $.cpp2_expression],
Expand Down Expand Up @@ -534,19 +534,19 @@ module.exports = grammar(CPP1, {
field(
"namespaces",
seq(
choice(seq($.cpp2_no_namespace_identifier, "::"), " ::"),
repeat(seq($.cpp2_no_namespace_identifier, "::")),
choice(seq($._cpp2_no_namespace_identifier, "::"), " ::"),
repeat(seq($._cpp2_no_namespace_identifier, "::")),
),
),
),
field("last", $.cpp2_no_namespace_identifier),
field("last", $._cpp2_no_namespace_identifier),
),
),

cpp2_no_namespace_identifier: ($) =>
choice($.cpp2_non_template_identifier, $.cpp2_template_identifier),
_cpp2_no_namespace_identifier: ($) =>
choice($.cpp2_non_template_identifier, $._cpp2_template_identifier),

cpp2_template_identifier: ($) =>
_cpp2_template_identifier: ($) =>
seq($.cpp2_non_template_identifier, $.cpp2_template_call_arguments),

cpp2_non_template_identifier: ($) =>
Expand Down
44 changes: 6 additions & 38 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@

(cpp2_function_declaration_argument
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_non_template_identifier) @emphasis)))
last: (cpp2_non_template_identifier) @emphasis))

(cpp2_function_declaration_argument
(cpp2_expression_declaration
Expand All @@ -109,40 +108,17 @@
(cpp2_no_definition_declaration
type: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_template_identifier
(cpp2_non_template_identifier) @type)))))

(cpp2_no_definition_declaration
type: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier) @type)))

(cpp2_left_side_of_definition
type: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_template_identifier
(cpp2_non_template_identifier) @type)))))
last: (cpp2_non_template_identifier) @type)))

(cpp2_left_side_of_definition
type: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_non_template_identifier) @type))))
last: (cpp2_non_template_identifier) @type)))

(cpp2_function_type
return: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_template_identifier
(cpp2_non_template_identifier) @type)))))

(cpp2_function_type
return: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_non_template_identifier) @type))))
last: (cpp2_non_template_identifier) @type)))

(cpp2_next) @keyword

Expand All @@ -157,16 +133,8 @@
(cpp2_function_call
function: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_non_template_identifier) @function))))

(cpp2_function_call
function: (cpp2_expression
(cpp2_any_identifier
last: (cpp2_no_namespace_identifier
(cpp2_template_identifier
(cpp2_non_template_identifier) @function)))))
last: (cpp2_non_template_identifier) @function)))

(cpp2_dot_access
field: (cpp2_any_identifier
last: (cpp2_no_namespace_identifier) @property))
last: (cpp2_non_template_identifier) @property))
18 changes: 9 additions & 9 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a4c9b54

Please sign in to comment.