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

Method parse_dotted_name

crates/ruff_python_parser/src/parser/statement.rs:829–853  ·  view source on GitHub ↗

Parses a dotted name. A dotted name is a sequence of identifiers separated by a single dot.

(&mut self)

Source from the content-addressed store, hash-verified

827 ///
828 /// A dotted name is a sequence of identifiers separated by a single dot.
829 fn parse_dotted_name(&mut self) -> ast::Identifier {
830 let start = self.node_start();
831
832 let mut dotted_name: CompactString = self.parse_identifier().id.into();
833 let mut progress = ParserProgress::default();
834
835 while self.eat(TokenKind::Dot) {
836 progress.assert_progressing(self);
837
838 // test_err dotted_name_multiple_dots
839 // import a..b
840 // import a...b
841 dotted_name.push('.');
842 dotted_name.push_str(&self.parse_identifier());
843 }
844
845 // test_ok dotted_name_normalized_spaces
846 // import a.b.c
847 // import a . b . c
848 ast::Identifier {
849 id: Name::from(dotted_name),
850 range: self.node_range(start),
851 node_index: AtomicNodeIndex::NONE,
852 }
853 }
854
855 /// Parses a `pass` statement.
856 ///

Callers 2

parse_aliasMethod · 0.80

Calls 8

node_startMethod · 0.80
parse_identifierMethod · 0.80
assert_progressingMethod · 0.80
node_rangeMethod · 0.80
defaultFunction · 0.50
eatMethod · 0.45
pushMethod · 0.45
push_strMethod · 0.45

Tested by

no test coverage detected