Module: languages/ternaryBranchMatcher
Functions
ternaryBranchMatcher
▸ ternaryBranchMatcher(ternaryTypename
, acceptableNamedChildIndices
): NodeMatcher
Constructs a matcher for matching ternary branches. Branches are expected to be named children at particular indices of a ternary node.
NB: We can't just use the "foo[0]" syntax of our pattern language because
that just uses foo
for the finder; the [0]
is just part of the extractor,
so if we had foo[0]
and foo[1]
, they would both match for either branch.
Parameters
Name | Type | Description |
---|---|---|
ternaryTypename | string | The type name for ternary expressions |
acceptableNamedChildIndices | number [] | Which named children, by index, of the ternary node correspond to branches |
Returns
A matcher that can match ternary branches
Defined in
languages/ternaryBranchMatcher.ts:17