// Performing this transformation in Rust code rather than in grammar
// to deal with ambiguous grammar.
Performing this transformation in Rust code rather than in grammar
to deal with ambiguous grammar.
Performing this transformation in Rust code rather than in grammar to deal with ambiguous grammar .
pub(crate) fn from_expr(
        expr: AstExpr,
    ) -> Result<
        AstAugmentedAssignTargetExpr,
        lalrpop_util::ParseError<u64, lexer::Token, lexer::LexerError>,
    > {
        Ok(Spanned {
            span: expr.span,
            node: match expr.node {
                Expr::Identifier(ident) => AugmentedAssignTargetExpr::Identifier(ident),
                Expr::ArrayIndirection(array, index) => {
                    AugmentedAssignTargetExpr::ArrayIndirection(array, index)
                }
                Expr::Dot(object, field) => AugmentedAssignTargetExpr::Dot(object, field),
                _ => {
                    return Err(lalrpop_util::ParseError::User {
                        error: lexer::LexerError::WrappedError {
                            span: expr.span,
                            code: INCORRECT_AUGMENTED_ASSIGNMENT_TARGET_ERROR_CODE,
                            label: "incorrect augmented assignment target",
                        },
                    })
                }
            },
        })
    }
pub ( crate ) fn from_expr ( expr : AstExpr , ) -> Result < AstAugmentedAssignTargetExpr , lalrpop_util :: ParseError < u64 , lexer :: Token , lexer :: LexerError > , > { Ok ( Spanned { span : expr . span , node : match expr . node { Expr :: Identifier ( ident ) => AugmentedAssignTargetExpr :: Identifier ( ident ) , Expr :: ArrayIndirection ( array , index ) => { AugmentedAssignTargetExpr :: ArrayIndirection ( array , index ) } Expr :: Dot ( object , field ) => AugmentedAssignTargetExpr :: Dot ( object , field ) , _ => { return Err ( lalrpop_util :: ParseError :: User { error : lexer :: LexerError :: WrappedError { span : expr . span , code : INCORRECT_AUGMENTED_ASSIGNMENT_TARGET_ERROR_CODE , label : " " , } , } ) } } , } ) }
Performing this transformation in Rust code rather than in grammar
to deal with ambiguous grammar.
Performing this transformation in Rust code rather than in grammar to deal with ambiguous grammar .
expr
AstExpr