(left, right token.Token)
| 82 | } |
| 83 | |
| 84 | func (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 |
no test coverage detected