Pattern-variable names appearing in a rule LHS (excluding the variable).
( lhs: Json, variable: string, out = new Set<string>() )
| 167 | expr.symbol.startsWith(OPT) |
| 168 | ); |
| 169 | if (!expr.ops) return false; |
| 170 | return expr.ops.some(hasPlaceholder); |
| 171 | } |
| 172 | |
| 173 | /** Pattern-variable names appearing in a rule LHS (excluding the variable). */ |
| 174 | function lhsNames( |
| 175 | lhs: Json, |
| 176 | variable: string, |
| 177 | out = new Set<string>() |
| 178 | ): Set<string> { |
| 179 | if ( |
| 180 | (isCall(lhs, 'Blank') || isCall(lhs, 'BlankOptional')) && |
| 181 | typeof lhs[1] === 'string' |
| 182 | ) { |
| 183 | if (lhs[1] !== variable) out.add(lhs[1]); |
| 184 | } else if (Array.isArray(lhs)) |
| 185 | for (const a of lhs.slice(1)) lhsNames(a, variable, out); |
no test coverage detected