pub fn parse_code_body(mut cursor: ParseCursor) -> ParseRes<CodeBodyParselet> {
    if let Lexeme::Colon(_) = cursor.take()? {
        cursor.skip_while(|lexeme| lexeme.is_newline());
        if let Lexeme::StartBlock(_) = cursor.take()? {
            let start_cursor = cursor.fork();
            let mut level = 1;
            while level > 0 {
                match cursor.take() {
                    Ok(Lexeme::StartBlock(_)) => level += 1,
                    Ok(Lexeme::EndBlock(_)) => level -= 1,
                    Ok(_) => {}
                    Err(_) => break,
                }
            }
            let mut lexemes = start_cursor.slice_upto(&cursor);
            if !lexemes.is_empty() {
                lexemes = &lexemes[0..lexemes.len() - 1];
            }
            let entrypoint = CodeBodyParselet::new(lexemes);
            return Ok((cursor, entrypoint));
        }
    };
    Err(NoMatch)
}
/// Process from (incl) colon to end of the block, leaving body at lexeme stage.
Process from (incl) colon to end of the block, leaving body at lexeme stage.
Process from ( incl ) colon to end of the block leaving body at lexeme stage .
pub fn parse_code_body(mut cursor: ParseCursor) -> ParseRes<CodeBodyParselet> {
    if let Lexeme::Colon(_) = cursor.take()? {
        cursor.skip_while(|lexeme| lexeme.is_newline());
        if let Lexeme::StartBlock(_) = cursor.take()? {
            let start_cursor = cursor.fork();
            let mut level = 1;
            while level > 0 {
                match cursor.take() {
                    Ok(Lexeme::StartBlock(_)) => level += 1,
                    Ok(Lexeme::EndBlock(_)) => level -= 1,
                    Ok(_) => {}
                    Err(_) => break,
                }
            }
            let mut lexemes = start_cursor.slice_upto(&cursor);
            if !lexemes.is_empty() {
                lexemes = &lexemes[0..lexemes.len() - 1];
            }
            let entrypoint = CodeBodyParselet::new(lexemes);
            return Ok((cursor, entrypoint));
        }
    };
    Err(NoMatch)
}
pub fn parse_code_body ( mut cursor : ParseCursor ) -> ParseRes < CodeBodyParselet > { if let Lexeme :: Colon ( _ ) = cursor . take ( ) ? { cursor . skip_while ( | lexeme | lexeme . is_newline ( ) ) ; if let Lexeme :: StartBlock ( _ ) = cursor . take ( ) ? { let start_cursor = cursor . fork ( ) ; let mut level = 1 ; while level > 0 { match cursor . take ( ) { Ok ( Lexeme :: StartBlock ( _ ) ) => level += 1 , Ok ( Lexeme :: EndBlock ( _ ) ) => level -= 1 , Ok ( _ ) => { } Err ( _ ) => break , } } let mut lexemes = start_cursor . slice_upto ( & cursor ) ; if ! lexemes . is_empty ( ) { lexemes = & lexemes [ 0 .. lexemes . len ( ) - 1 ] ; } let entrypoint = CodeBodyParselet :: new ( lexemes ) ; return Ok ( ( cursor , entrypoint ) ) ; } } ; Err ( NoMatch ) }
Process from (incl) colon to end of the block, leaving body at lexeme stage.
Process from ( incl ) colon to end of the block leaving body at lexeme stage .
cursor
ParseCursor
cursor
ParseCursor