MCPcopy Index your code
hub / github.com/microsoft/typescript-go / parseExpectedMatchingBrackets

Method parseExpectedMatchingBrackets

internal/parser/parser.go:975–988  ·  view source on GitHub ↗
(openKind ast.Kind, closeKind ast.Kind, openParsed bool, openPosition int)

Source from the content-addressed store, hash-verified

973}
974
975func (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
990func (p *Parser) parseOptional(token ast.Kind) bool {
991 if p.token == token {

Callers 7

parseBlockMethod · 0.95
parseIfStatementMethod · 0.95
parseDoStatementMethod · 0.95
parseWhileStatementMethod · 0.95
parseWithStatementMethod · 0.95

Calls 6

nextTokenMethod · 0.95
TokenToStringFunction · 0.92
NewDiagnosticFunction · 0.92
NewTextRangeFunction · 0.92
AddRelatedInfoMethod · 0.80

Tested by

no test coverage detected