parser: ident method docs for clarity

This commit is contained in:
Ryan Chandler 2022-07-28 00:48:31 +01:00
parent b4f8b1bf00
commit a502c21a7f
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -3,14 +3,17 @@ use trunk_lexer::TokenKind;
use super::{ParseResult, ParseError};
impl Parser {
/// Expect an unqualified identifier such as Foo or Bar.
pub(crate) fn ident(&mut self) -> ParseResult<String> {
Ok(expect!(self, TokenKind::Identifier(i), i, "expected identifier"))
}
/// Expect an unqualified or qualified identifier such as Foo, Bar or Foo\Bar.
pub(crate) fn name(&mut self) -> ParseResult<String> {
Ok(expect!(self, TokenKind::Identifier(i) | TokenKind::QualifiedIdentifier(i), i, "expected identifier"))
}
/// Expect an unqualified, qualified or fully qualified identifier such as Foo, Foo\Bar or \Foo\Bar.
pub(crate) fn full_name(&mut self) -> ParseResult<String> {
Ok(expect!(self, TokenKind::Identifier(i) | TokenKind::QualifiedIdentifier(i) | TokenKind::FullyQualifiedIdentifier(i), i, "expected identifier"))
}