|
25 | 25 | ;; Conditionals
|
26 | 26 | ;;
|
27 | 27 |
|
28 |
| -;;!! |
| 28 | +(if_statement) @ifStatement @branch.iteration |
| 29 | + |
| 30 | +;; Branch |
| 31 | +( |
| 32 | + (if_statement |
| 33 | + "if" @branch.start.startOf @branch.domain.start.startOf |
| 34 | + (_) |
| 35 | + "then" |
| 36 | + (_) @branch.interior @dummy |
| 37 | + "fi" @branch.end.startOf @branch.domain.end.startOf |
| 38 | + ) |
| 39 | + (#not-type? @dummy elif_clause else_clause) |
| 40 | +) |
| 41 | + |
| 42 | +;; Conditional |
| 43 | + |
| 44 | +;;!! if [ $value -le 0 ]; then |
| 45 | +;;!! fi |
29 | 46 | (if_statement
|
30 |
| - (_)* |
31 |
| - "then" |
32 |
| - (_)* |
| 47 | + "if" @condition.domain.start.startOf |
| 48 | + (_) @condition |
| 49 | + "then" @condition.domain.end.endOf |
| 50 | + . |
33 | 51 | "fi"
|
34 |
| -) @ifStatement @branch |
| 52 | +) |
35 | 53 |
|
| 54 | +;;!! if [ $value -le 0 ]; then |
| 55 | +;;!! else |
36 | 56 | (if_statement
|
37 |
| - "if" @branch.start.startOf |
38 |
| - (_) |
39 |
| - "then" |
40 |
| - (_)* @branch.interior |
| 57 | + "if" @condition.domain.start.startOf |
| 58 | + (_) @condition |
| 59 | + "then" @condition.domain.end.endOf |
41 | 60 | .
|
42 |
| - [ |
43 |
| - (elif_clause) |
44 |
| - (else_clause) |
45 |
| - ] @branch.end.startOf |
46 |
| -) @ifStatement @branch.iteration @_.domain |
| 61 | + (else_clause) |
| 62 | +) |
| 63 | + |
| 64 | +;;!! if [ $value -le 0 ]; then |
| 65 | +;;!! elif |
| 66 | +(if_statement |
| 67 | + "if" @condition.domain.start.startOf |
| 68 | + (_) @condition |
| 69 | + "then" @condition.domain.end.endOf |
| 70 | + . |
| 71 | + (elif_clause) |
| 72 | +) |
| 73 | + |
| 74 | +;;!! if [ $value -le 0 ]; then |
| 75 | +;;!! echo foo |
| 76 | +;;!! fi |
| 77 | +( |
| 78 | + (if_statement |
| 79 | + "if" @condition.domain.start.startOf |
| 80 | + (_) @condition |
| 81 | + "then" |
| 82 | + (_) @dummy |
| 83 | + . |
| 84 | + "fi" @condition.domain.end.startOf |
| 85 | + ) |
| 86 | + (#not-type? @dummy else_clause elif_clause) |
| 87 | +) |
| 88 | + |
| 89 | +;;!! if [ $value -le 0 ]; then |
| 90 | +;;!! echo foo |
| 91 | +;;!! elif [ $value -le 0 ]; then |
| 92 | +;;!! fi |
| 93 | +( |
| 94 | + (if_statement |
| 95 | + "if" @condition.domain.start.startOf |
| 96 | + (_) @condition |
| 97 | + "then" |
| 98 | + (_) |
| 99 | + (elif_clause) @condition.domain.end.startOf |
| 100 | + ) |
| 101 | +) |
| 102 | + |
| 103 | +;;!! if [ $value -le 0 ]; then |
| 104 | +;;!! echo foo |
| 105 | +;;!! else [ $value -le 0 ]; then |
| 106 | +;;!! fi |
| 107 | +( |
| 108 | + (if_statement |
| 109 | + "if" @condition.domain.start.startOf |
| 110 | + (_) @condition |
| 111 | + "then" |
| 112 | + (_) @dummy |
| 113 | + . |
| 114 | + (else_clause) @condition.domain.end.startOf |
| 115 | + ) |
| 116 | + (#not-type? @dummy elif_clause) |
| 117 | +) |
47 | 118 |
|
48 | 119 | (elif_clause
|
49 |
| - (_)* @condition |
| 120 | + (_) @condition |
50 | 121 | "then"
|
51 |
| - (_)* @branch.interior |
52 |
| -) @branch |
| 122 | + (_) @branch.interior |
| 123 | +) @branch @_.domain |
53 | 124 |
|
54 | 125 | (else_clause
|
55 | 126 | "else" @branch.interior.start.endOf
|
|
58 | 129 |
|
59 | 130 | (_
|
60 | 131 | condition: (_) @condition
|
61 |
| -) @_.domain |
| 132 | +) |
62 | 133 |
|
63 |
| -;; |
64 | 134 | ;; Lists and maps
|
65 | 135 | ;;
|
66 | 136 |
|
|
0 commit comments