fn read_ident(lexer: &mut Lexer) -> crate::Result<String> {
    let mut output = String::new();
    loop {
        let Token { kind, .. } = lexer.peek();
        match kind {
            TokenKind::Atom(c) => {
                let _ = lexer.next();
                output.push(c);
            }
            TokenKind::Escaped(seq) => {
                let _ = lexer.next();
                output.extend(seq);
            }
            TokenKind::Semi => break,
            TokenKind::Eq => break,
            TokenKind::Newline => {
                let _ = lexer.next();
                continue; // NOTE(yosh): unsure if this is the correct behavior
            }
            TokenKind::Whitespace => {
                let _ = lexer.next();
                match output.len() {
                    0 => continue, // ignore leading whitespace
                    _ => output.push(' '),
                }
            }
            TokenKind::Eof => break,
        }
    }
    output = output.trim_end().to_owned(); // remove trailing whitespace
    Ok(output)
}
/// Read either a valid key or value from the lexer.
Read either a valid key or value from the lexer.
Read either a valid key or value from the lexer .
fn read_ident(lexer: &mut Lexer) -> crate::Result<String> {
    let mut output = String::new();
    loop {
        let Token { kind, .. } = lexer.peek();
        match kind {
            TokenKind::Atom(c) => {
                let _ = lexer.next();
                output.push(c);
            }
            TokenKind::Escaped(seq) => {
                let _ = lexer.next();
                output.extend(seq);
            }
            TokenKind::Semi => break,
            TokenKind::Eq => break,
            TokenKind::Newline => {
                let _ = lexer.next();
                continue; // NOTE(yosh): unsure if this is the correct behavior
            }
            TokenKind::Whitespace => {
                let _ = lexer.next();
                match output.len() {
                    0 => continue, // ignore leading whitespace
                    _ => output.push(' '),
                }
            }
            TokenKind::Eof => break,
        }
    }
    output = output.trim_end().to_owned(); // remove trailing whitespace
    Ok(output)
}
fn read_ident ( lexer : & mut Lexer ) -> crate :: Result < String > { let mut output = String :: new ( ) ; loop { let Token { kind , .. } = lexer . peek ( ) ; match kind { TokenKind :: Atom ( c ) => { let _ = lexer . next ( ) ; output . push ( c ) ; } TokenKind :: Escaped ( seq ) => { let _ = lexer . next ( ) ; output . extend ( seq ) ; } TokenKind :: Semi => break , TokenKind :: Eq => break , TokenKind :: Newline => { let _ = lexer . next ( ) ; continue ; // NOTE(yosh): unsure if this is the correct behavior } TokenKind :: Whitespace => { let _ = lexer . next ( ) ; match output . len ( ) { 0 => continue , // ignore leading whitespace _ => output . push ( ' ' ) , } } TokenKind :: Eof => break , } } output = output . trim_end ( ) . to_owned ( ) ; // remove trailing whitespace Ok ( output ) }
Read either a valid key or value from the lexer.
Read either a valid key or value from the lexer .
lexer
&mut Lexer
lexer
&mut Lexer