[parser] Minor documentation fixes.

This commit is contained in:
Alessandro Coglio 2022-02-23 15:12:58 -08:00
parent 2e08e1bb47
commit b3505b6d32
2 changed files with 8 additions and 9 deletions

View File

@ -386,10 +386,10 @@ impl ParserContext<'_> {
}
///
/// Returns a [`SpreadOrExpression`] AST node if the next tokens represent an
/// Returns a [`SpreadOrExpression`] AST node if the next tokens represent a
/// spread or expression.
///
/// This method should only be called in the context of an array access expression.
/// This method should only be called in the context of an array construction expression.
///
pub fn parse_spread_or_expression(&mut self) -> Result<SpreadOrExpression> {
Ok(if self.eat(Token::DotDotDot).is_some() {
@ -416,8 +416,8 @@ impl ParserContext<'_> {
}
///
/// Returns an [`Expression`] AST node if the next tokens represent an
/// tuple initialization expression.
/// Returns an [`Expression`] AST node if the next tokens represent a
/// tuple initialization expression or an affine group literal.
///
pub fn parse_tuple_expression(&mut self, span: &Span) -> Result<Expression> {
if let Some((left, right, span)) = self.eat_group_partial().transpose()? {

View File

@ -162,7 +162,7 @@ impl ParserContext<'_> {
/// Returns an [`ImportTree`] AST node if the next tokens represent a valid package import
/// with accesses.
// Public soely foro writing import parsing tests.
// Public solely for writing import parsing tests.
pub fn parse_import_tree(&mut self) -> Result<ImportTree> {
// Parse the first part of the path.
let first_name = self.parse_package_name()?;
@ -216,7 +216,7 @@ impl ParserContext<'_> {
}
/// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable
/// or circuit member function.
/// or circuit member function or circuit member constant.
pub fn parse_circuit_declaration(&mut self) -> Result<Vec<CircuitMember>> {
let mut members = Vec::new();
@ -462,7 +462,7 @@ impl ParserContext<'_> {
///
/// Returns an [`(String, DefinitionStatement)`] AST node if the next tokens represent a global
/// const definition statement and assignment.
/// constant declaration.
///
pub fn parse_global_const_declaration(&mut self) -> Result<(Vec<Identifier>, DefinitionStatement)> {
let statement = self.parse_definition_statement()?;
@ -476,8 +476,7 @@ impl ParserContext<'_> {
}
///
/// Returns an [`(String, Alias)`] AST node if the next tokens represent a global
/// const definition statement and assignment.
/// Returns a [`(String, Alias)`] AST node if the next tokens represent a type alias declaration.
///
pub fn parse_type_alias(&mut self) -> Result<(Identifier, Alias)> {
let start = self.expect(Token::Type)?;