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:831–855  ·  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

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

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