From f50704fe0b19ae150e272372d24e0051e03378f8 Mon Sep 17 00:00:00 2001 From: Martin Jambon Date: Thu, 12 Sep 2024 20:36:00 -0700 Subject: [PATCH] Undo PR https://github.com/semgrep/ocaml-tree-sitter-semgrep/pull/488 because the corresponding changes weren't made in semgrep --- .../semgrep-typescript/common/semgrep-ext.js | 14 ++++-- .../tsx/corpus/semgrep-ext.txt | 49 ------------------- 2 files changed, 11 insertions(+), 52 deletions(-) delete mode 100644 lang/semgrep-grammars/src/semgrep-typescript/tsx/corpus/semgrep-ext.txt diff --git a/lang/semgrep-grammars/src/semgrep-typescript/common/semgrep-ext.js b/lang/semgrep-grammars/src/semgrep-typescript/common/semgrep-ext.js index 9972b89b..9f289042 100644 --- a/lang/semgrep-grammars/src/semgrep-typescript/common/semgrep-ext.js +++ b/lang/semgrep-grammars/src/semgrep-typescript/common/semgrep-ext.js @@ -28,8 +28,16 @@ module.exports = { */ semgrep_ellipsis: $ => '...', - semgrep_metavar_ellipsis: $ => /\$\.\.\.[A-Z_][A-Z_0-9]*/, +/* TODO: restore this when the changes are made in semgrep. + Remove the XXXXXXX when uncommenting. + You also need to restore the test file: + lang/semgrep-grammars/src/semgrep-typescript/tsx/corpus/semgrep-ext.txt + See the original PR: + https://github.com/semgrep/ocaml-tree-sitter-semgrep/pull/488 + + semgrep_metavar_ellipsis: $ => /\$\.\.\.[A-Z_][A-Z_0-9]*XXXXXXX/, +/* /* In the expression context, there are LR(1) conflicts with spread and * rest. I (nmote) don't think that these are true ambiguities, but just in * case we'll declare conflicts and set this to low dynamic precedence so as @@ -40,13 +48,13 @@ module.exports = { previous, $.semgrep_expression_ellipsis, ), - +/* TODO: restore this when the changes are made in semgrep. _jsx_attribute: ($, previous) => choice( previous, $.semgrep_ellipsis, $.semgrep_metavar_ellipsis ), - +*/ // TODO Remove this when we update tree-sitter-typescript past // https://github.com/tree-sitter/tree-sitter-typescript/pull/239. I (nmote) // ran into unrelated issues updating it, documented in diff --git a/lang/semgrep-grammars/src/semgrep-typescript/tsx/corpus/semgrep-ext.txt b/lang/semgrep-grammars/src/semgrep-typescript/tsx/corpus/semgrep-ext.txt deleted file mode 100644 index e7ebac8c..00000000 --- a/lang/semgrep-grammars/src/semgrep-typescript/tsx/corpus/semgrep-ext.txt +++ /dev/null @@ -1,49 +0,0 @@ -================================== -JSX with ellipsis -================================== - - - ---- - -(program - (expression_statement - (jsx_self_closing_element - (identifier) - (semgrep_ellipsis)))) - -================================== -JSX with ellipsis and other props -================================== - - - ---- - -(program - (expression_statement - (jsx_self_closing_element - (identifier) - (jsx_attribute - (property_identifier) - (string - (string_fragment))) - (semgrep_ellipsis) - (jsx_attribute - (property_identifier) - (jsx_expression - (identifier)))))) - -================================== -JSX with metavariable ellipsis -================================== - - - ---- - -(program - (expression_statement - (jsx_self_closing_element - (identifier) - (semgrep_metavar_ellipsis))))