MCPcopy Create free account
hub / github.com/astral-sh/ruff / add_unsupported_syntax_error

Method add_unsupported_syntax_error

crates/ruff_python_parser/src/parser/mod.rs:684–692  ·  view source on GitHub ↗

Add an [`UnsupportedSyntaxError`] with the given [`UnsupportedSyntaxErrorKind`] and [`TextRange`] if its minimum version is less than [`Parser::target_version`].

(&mut self, kind: UnsupportedSyntaxErrorKind, range: TextRange)

Source from the content-addressed store, hash-verified

682 /// Add an [`UnsupportedSyntaxError`] with the given [`UnsupportedSyntaxErrorKind`] and
683 /// [`TextRange`] if its minimum version is less than [`Parser::target_version`].
684 fn add_unsupported_syntax_error(&mut self, kind: UnsupportedSyntaxErrorKind, range: TextRange) {
685 if kind.is_unsupported(self.options.target_version) {
686 self.unsupported_syntax_errors.push(UnsupportedSyntaxError {
687 kind,
688 range,
689 target_version: self.options.target_version,
690 });
691 }
692 }
693
694 /// Returns `true` if the current token is of the given kind.
695 fn at(&self, kind: TokenKind) -> bool {

Callers 15

parse_argumentsMethod · 0.80
parse_sliceMethod · 0.80
parse_stringMethod · 0.80
parse_set_expressionMethod · 0.80
check_tuple_unpackingMethod · 0.80

Calls 2

is_unsupportedMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected