|
1 | | -import { |
2 | | - ancestorChainNodeMatcher, |
3 | | - cascadingMatcher, |
4 | | - createPatternMatchers, |
5 | | - matcher, |
6 | | - patternMatcher, |
7 | | -} from "../util/nodeMatchers"; |
| 1 | +import { createPatternMatchers, matcher } from "../util/nodeMatchers"; |
8 | 2 | import { NodeMatcherAlternative, SelectionWithEditor } from "../typings/Types"; |
9 | 3 | import { SimpleScopeTypeType } from "@cursorless/common"; |
10 | 4 | import { SyntaxNode } from "web-tree-sitter"; |
11 | 5 | import { getNodeRange, unwrapSelectionExtractor } from "../util/nodeSelectors"; |
12 | 6 | import { patternFinder } from "../util/nodeFinders"; |
13 | 7 |
|
14 | | -// Generated by the following command: |
15 | | -// curl https://raw.githubusercontent.com/ganezdragon/tree-sitter-perl/ee1001210af5f32ba14d2ced834636548e1b6485/src/node-types.json \ |
16 | | -// | jq '[.[] | select(.type|match("_statement")) | .type ]' |
17 | | -const STATEMENT_TYPES = [ |
18 | | - "ellipsis_statement", |
19 | | - "for_simple_statement", |
20 | | - "for_statement_1", |
21 | | - "for_statement_2", |
22 | | - "foreach_simple_statement", |
23 | | - "foreach_statement", |
24 | | - "if_simple_statement", |
25 | | - "if_statement", |
26 | | - "loop_control_statement", |
27 | | - "loop_control_statement", |
28 | | - "named_block_statement", |
29 | | - "package_statement", |
30 | | - "pod_statement", |
31 | | - "require_statement", |
32 | | - "single_line_statement", |
33 | | - "unless_simple_statement", |
34 | | - "unless_statement", |
35 | | - "until_simple_statement", |
36 | | - "until_statement", |
37 | | - "use_constant_statement", |
38 | | - "use_no_feature_statement", |
39 | | - "use_no_if_statement", |
40 | | - "use_no_statement", |
41 | | - "use_no_subs_statement", |
42 | | - "use_parent_statement", |
43 | | - "when_simple_statement", |
44 | | - "while_simple_statement", |
45 | | - "while_statement", |
46 | | -]; |
47 | | - |
48 | | -const EXPRESSION_TYPES = [ |
49 | | - "array", |
50 | | - "assignment", |
51 | | - "begin", |
52 | | - // MANY MORE TODO ... |
53 | | -]; |
54 | | - |
55 | | -const EXPRESSION_STATEMENT_PARENT_TYPES = [ |
56 | | - "begin", |
57 | | - "block", |
58 | | - "do", |
59 | | - "do_block", |
60 | | - "else", |
61 | | - "lambda", |
62 | | - "method", |
63 | | - "then", |
64 | | -]; |
65 | | - |
66 | | -const assignmentOperators = [ |
67 | | - "=", |
68 | | - "+=", |
69 | | - "-=", |
70 | | - "*=", |
71 | | - "/=", |
72 | | - "||=", |
73 | | - "//=", |
74 | | - "|=", |
75 | | - "&&=", |
76 | | - "&=", |
77 | | - "%=", |
78 | | - ">>=", |
79 | | - "<<=", |
80 | | - "^=", |
81 | | -]; |
82 | | - |
83 | | -const mapKeyValueSeparators = [",", "=>"]; |
84 | | - |
85 | 8 | const nodeMatchers: Partial< |
86 | 9 | Record<SimpleScopeTypeType, NodeMatcherAlternative> |
87 | 10 | > = { |
|
0 commit comments