(kind ast.Kind, message *diagnostics.Message, shouldAdvance bool)
| 1004 | } |
| 1005 | |
| 1006 | func (p *Parser) parseExpectedWithDiagnostic(kind ast.Kind, message *diagnostics.Message, shouldAdvance bool) bool { |
| 1007 | if p.token == kind { |
| 1008 | if shouldAdvance { |
| 1009 | p.nextToken() |
| 1010 | } |
| 1011 | return true |
| 1012 | } |
| 1013 | // Report specific message if provided with one. Otherwise, report generic fallback message. |
| 1014 | if message != nil { |
| 1015 | p.parseErrorAtCurrentToken(message) |
| 1016 | } else { |
| 1017 | p.parseErrorAtCurrentToken(diagnostics.X_0_expected, scanner.TokenToString(kind)) |
| 1018 | } |
| 1019 | return false |
| 1020 | } |
| 1021 | |
| 1022 | func (p *Parser) parseTokenNode() *ast.Node { |
| 1023 | pos := p.nodePos() |
no test coverage detected