(openKind ast.Kind, closeKind ast.Kind, openParsed bool, openPosition int)
| 973 | } |
| 974 | |
| 975 | func (p *Parser) parseExpectedMatchingBrackets(openKind ast.Kind, closeKind ast.Kind, openParsed bool, openPosition int) { |
| 976 | if p.token == closeKind { |
| 977 | p.nextToken() |
| 978 | return |
| 979 | } |
| 980 | lastError := p.parseErrorAtCurrentToken(diagnostics.X_0_expected, scanner.TokenToString(closeKind)) |
| 981 | if !openParsed { |
| 982 | return |
| 983 | } |
| 984 | if lastError != nil { |
| 985 | related := ast.NewDiagnostic(nil, core.NewTextRange(openPosition, openPosition), diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, scanner.TokenToString(openKind), scanner.TokenToString(closeKind)) |
| 986 | lastError.AddRelatedInfo(related) |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | func (p *Parser) parseOptional(token ast.Kind) bool { |
| 991 | if p.token == token { |
no test coverage detected