Skip to main content

oxilean_parse/command/
commandparser_parsing_3.rs

1//! # CommandParser - parsing Methods
2//!
3//! This module contains method implementations for `CommandParser`.
4//!
5//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
6
7use crate::{ParseError, TokenKind};
8
9use super::commandparser_type::CommandParser;
10
11impl CommandParser {
12    /// Parse a dotted name like `Foo.Bar.Baz` and return it as a single string.
13    pub(super) fn parse_dotted_name(&mut self) -> Result<String, ParseError> {
14        let first = self.parse_ident()?;
15        let mut result = first;
16        while self.consume(&TokenKind::Dot) {
17            let next = self.parse_ident()?;
18            result.push('.');
19            result.push_str(&next);
20        }
21        Ok(result)
22    }
23}