MCPcopy Create free account
hub / github.com/nsf/gocode / skip_to_left

Method skip_to_left

cursorcontext.go:84–101  ·  view source on GitHub ↗
(left, right token.Token)

Source from the content-addressed store, hash-verified

82}
83
84func (ti *token_iterator) skip_to_left(left, right token.Token) bool {
85 if ti.token().tok == left {
86 return true
87 }
88 balance := 1
89 for balance != 0 {
90 if !ti.go_back() {
91 return false
92 }
93 switch ti.token().tok {
94 case right:
95 balance++
96 case left:
97 balance--
98 }
99 }
100 return true
101}
102
103// when the cursor is at the ')' or ']' or '}', move the cursor to an opposite
104// bracket pair, this functions takes nested bracket pairs into account

Callers 2

skip_to_balanced_pairMethod · 0.95
skip_to_left_curlyMethod · 0.95

Calls 2

tokenMethod · 0.95
go_backMethod · 0.95

Tested by

no test coverage detected