recoverOver seeks forward in the token stream until it finds a block starting with TokenType "start", then finds the corresponding end token, leaving the peeker pointed at the token after that end token. The given token type _must_ be a bracketer. For example, if the given start token is TokenOBrac
(start TokenType)
| 2121 | // the next brace-delimited block encountered, or at EOF if no such block |
| 2122 | // is found or it is unclosed. |
| 2123 | func (p *parser) recoverOver(start TokenType) { |
| 2124 | end := p.oppositeBracket(start) |
| 2125 | |
| 2126 | // find the opening bracket first |
| 2127 | Token: |
| 2128 | for { |
| 2129 | tok := p.Read() |
| 2130 | switch tok.Type { |
| 2131 | case start, TokenEOF: |
| 2132 | break Token |
| 2133 | } |
| 2134 | } |
| 2135 | |
| 2136 | // Now use our existing recover function to locate the _end_ of the |
| 2137 | // container we've found. |
| 2138 | p.recover(end) |
| 2139 | } |
| 2140 | |
| 2141 | func (p *parser) recoverAfterBodyItem() { |
| 2142 | p.recovery = true |
no test coverage detected