* Error recovery should skip tokens until it encounters a recovery point. * * The following are treated as unconditional recovery points: * - end of input * - ';' (parseChain() is always the root production, and it expects a ';') * - '|' (since pipes may be chained and each pipe
()
| 1865 | * and then decrements it just prior to checking if the token is in the input. |
| 1866 | */ |
| 1867 | private skip() { |
| 1868 | let n = this.next; |
| 1869 | while ( |
| 1870 | this.index < this.tokens.length && |
| 1871 | !n.isCharacter(chars.$SEMICOLON) && |
| 1872 | !n.isOperator('|') && |
| 1873 | (this.rparensExpected <= 0 || !n.isCharacter(chars.$RPAREN)) && |
| 1874 | (this.rbracesExpected <= 0 || !n.isCharacter(chars.$RBRACE)) && |
| 1875 | (this.rbracketsExpected <= 0 || !n.isCharacter(chars.$RBRACKET)) && |
| 1876 | (!(this.context & ParseContextFlags.Writable) || !this.isAssignmentOperator(n)) |
| 1877 | ) { |
| 1878 | if (this.next.isError()) { |
| 1879 | this.errors.push( |
| 1880 | getParseError( |
| 1881 | this.next.toString()!, |
| 1882 | this.input, |
| 1883 | this.getErrorLocationText(this.next.index), |
| 1884 | this.parseSourceSpan, |
| 1885 | ), |
| 1886 | ); |
| 1887 | } |
| 1888 | this.advance(); |
| 1889 | n = this.next; |
| 1890 | } |
| 1891 | } |
| 1892 | } |
| 1893 | |
| 1894 | function getParseError( |
no test coverage detected