You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mod.rs
    path of file: ./repos/boa/core/parser/src/parser/expression/left_hand_side/optional
    
    the code of the file until where you have to start completion: #[cfg(test)]
mod tests;

use crate::{
    lexer::{Token, TokenKind},
    parser::{
        cursor::Cursor, expression::left_hand_side::arguments::Arguments, expression::Expression,
        AllowAwait, AllowYield, OrAbrupt, ParseResult, TokenParser,
    },
    source::ReadChar,
    Er
    
    fn parse(self, cursor: &mut Cursor<R>, interner: &mut Interner) -> ParseResult<Self::Output> {
        fn parse_const_access(
            token: &Token,
            interner: &Interner,
        ) -> ParseResult<OptionalOperationKind> {
            let item = match token.kind() {
                TokenKind::IdentifierName((name, _)) => {
                    OptionalOperationKind::SimplePropertyAccess {
                        field: PropertyAccessField::Const(*name),
                    }
                }
                TokenKind::Keyword((kw, _)) => OptionalOperationKind::SimplePropertyAccess {
                    field: PropertyAccessField::Const(kw.to_sym()),
                },
                TokenKind::BooleanLiteral((true, _)) => {
                    OptionalOperationKind::SimplePropertyAccess {
                        field: PropertyAccessField::Const(Sym::TRUE),
                    }
                }
                TokenKind::BooleanLiteral((false, _)) => {
                    OptionalOperationKind::SimplePropertyAccess {
                        field: PropertyAccessField::Const(Sym::FALSE),
                    }
                }
                TokenKind::NullLiteral(_) => OptionalOperationKind::SimplePropertyAccess {
                    field: PropertyAccessField::Const(Sym::NULL),
                },
                TokenKind::PrivateIdentifier(name) => {
                    OptionalOperationKind::PrivatePropertyAccess {
                        field: PrivateName::new(*name),
                    }
                }
                _ => {
                    return Err(Error::expected(
                        ["identifier".to_owned()],
                        token.to_string(interner),
                        token.span(),
                        "optional chain",
                    ))
                }
            };
            Ok(item)
        }
        let _timer = Profiler::global().start_event("OptionalExpression", "Parsing");

        let mut items = Vec::new();

        while let Some(token) = cursor.peek(0, interner)? {
            let shorted = match token.kind() {
                TokenKind::Punctuator(Punctuator::Optional) => {
                    cursor.advance(interner);
                    true
                }
                TokenKind::Punctuator(Punctuator::OpenParen | Punctuator::OpenBracket) => false,
                TokenKind::Punctuator(Punctuator::Dot) => {
                    cursor.advance(interner);
                    let field = cursor.next(interner).or_abrupt()?;

                    let item = parse_const_access(&field, interner)?;

                    items.push(OptionalOperation::new(item, false));
                    continue;
                }
                TokenKind::TemplateMiddle(_) | TokenKind::TemplateNoSubstitution(_) => {
                    return Err(Error::general(
                        "Invalid tagged template on optional chain",
                        token.span().start(),
                    ))
                }
                _ => break,
            };

            let token = cursor.peek(0, interner).or_abrupt()?;

            let item = match token.kind() {
                TokenKind::Punctuator(Punctuator::OpenParen) => {
                    let args = Arguments::new(self.allow_yield, self.allow_await)
                        .parse(cursor, interner)?;
                    OptionalOperationKind::Call { args }
                }
                TokenKind::Punctuator(Punctuator::OpenBracket) => {
                    cursor
                        .next(interner)?
                        .expect("open bracket punctuator token disappeared"); // We move the parser forward.
                    let idx = Expression::new(None, true, self.allow_yield, self.allow_await)
                        .parse(cursor, interner)?;
                    cursor.expect(Punctuator::CloseBracket, "optional chain", interner)?;
                    OptionalOperationKind::SimplePropertyAccess {
                        field: PropertyAccessField::Expr(Box::new(idx)),
                    }
                }
                TokenKind::TemplateMiddle(_) | TokenKind::TemplateNoSubstitution(_) => {
                    return Err(Error::general(
                        "Invalid tagged template on optional chain",
                        token.span().start(),
                    ))
                }
                _ => {
                    let token = cursor.next(interner)?.expect("token disappeared");
                    parse_const_access(&token, interner)?
                }
            };

            items.push(OptionalOperation::new(item, shorted));
        }

        Ok(Optional::new(self.target, items.into()))
    }