mirror of
https://github.com/danog/parser.git
synced 2024-11-27 04:14:55 +01:00
parser: ident method docs for clarity
This commit is contained in:
parent
b4f8b1bf00
commit
a502c21a7f
@ -3,14 +3,17 @@ use trunk_lexer::TokenKind;
|
|||||||
use super::{ParseResult, ParseError};
|
use super::{ParseResult, ParseError};
|
||||||
|
|
||||||
impl Parser {
|
impl Parser {
|
||||||
|
/// Expect an unqualified identifier such as Foo or Bar.
|
||||||
pub(crate) fn ident(&mut self) -> ParseResult<String> {
|
pub(crate) fn ident(&mut self) -> ParseResult<String> {
|
||||||
Ok(expect!(self, TokenKind::Identifier(i), i, "expected identifier"))
|
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> {
|
pub(crate) fn name(&mut self) -> ParseResult<String> {
|
||||||
Ok(expect!(self, TokenKind::Identifier(i) | TokenKind::QualifiedIdentifier(i), i, "expected identifier"))
|
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> {
|
pub(crate) fn full_name(&mut self) -> ParseResult<String> {
|
||||||
Ok(expect!(self, TokenKind::Identifier(i) | TokenKind::QualifiedIdentifier(i) | TokenKind::FullyQualifiedIdentifier(i), i, "expected identifier"))
|
Ok(expect!(self, TokenKind::Identifier(i) | TokenKind::QualifiedIdentifier(i) | TokenKind::FullyQualifiedIdentifier(i), i, "expected identifier"))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user