Skip to content

The redundant punctuation in "expected()" #1433

@Fischer0522

Description

@Fischer0522

The expected() function will format the message in accordance with format!("Expected: {expected}, found: {found}"). However, when expected() is called by parse_prefix() at line 1254 in mod.rs, the parameter is "an expression:". Consequently, the formatted message is "Expected: an expression:, found: EOF". The ":," appears redundant.

Related code:

    /// Report `found` was encountered instead of `expected`
    pub fn expected<T>(&self, expected: &str, found: TokenWithLocation) -> Result<T, ParserError> {
        parser_err!(
            format!("Expected: {expected}, found: {found}"),
            found.location
        )
    }

// in parse_prefix()
            _ => self.expected("an expression:", next_token),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions