mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Children, projection, & source rules are unambiguous.
This commit is contained in:
parent
e9c61048ec
commit
d5749545ce
@ -269,11 +269,11 @@ runAssignment toNode source = (\ assignment state -> go assignment state >>= req
|
|||||||
run assignment yield initialState = maybe (anywhere Nothing) (atNode . F.project) (listToMaybe (stateNodes state))
|
run assignment yield initialState = maybe (anywhere Nothing) (atNode . F.project) (listToMaybe (stateNodes state))
|
||||||
where atNode node = case assignment of
|
where atNode node = case assignment of
|
||||||
Location -> yield (nodeLocation (toNode node)) state
|
Location -> yield (nodeLocation (toNode node)) state
|
||||||
Project projection -> yield (projection node) state <> anywhere (Just node)
|
Project projection -> yield (projection node) state
|
||||||
Source -> yield (Source.sourceBytes (Source.slice (nodeByteRange (toNode node)) source)) (advance state) <> anywhere (Just node)
|
Source -> yield (Source.sourceBytes (Source.slice (nodeByteRange (toNode node)) source)) (advance state)
|
||||||
Children child -> (do
|
Children child -> do
|
||||||
(a, state') <- go child state { stateNodes = toList node } >>= requireExhaustive
|
(a, state') <- go child state { stateNodes = toList node } >>= requireExhaustive
|
||||||
yield a (advance state' { stateNodes = stateNodes state })) <> anywhere (Just node)
|
yield a (advance state' { stateNodes = stateNodes state })
|
||||||
Choose choices _ | Just choice <- IntMap.lookup (fromEnum (nodeSymbol (toNode node))) choices -> yield choice state
|
Choose choices _ | Just choice <- IntMap.lookup (fromEnum (nodeSymbol (toNode node))) choices -> yield choice state
|
||||||
_ -> anywhere (Just node)
|
_ -> anywhere (Just node)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user