Convert scanning functions to methods on Scanner

This commit is contained in:
Simon Ask Ulsnes 2024-02-04 11:42:48 +01:00
parent 6d83c59100
commit a171e0013a
3 changed files with 1566 additions and 1622 deletions

View file

@ -42,7 +42,7 @@ pub use crate::emitter::*;
pub use crate::error::*;
pub use crate::event::*;
pub use crate::parser::*;
pub use crate::scanner::yaml_parser_scan;
pub use crate::scanner::*;
pub use crate::token::*;
pub use crate::writer::yaml_emitter_flush;

View file

@ -1,7 +1,7 @@
use alloc::string::String;
use alloc::{vec, vec::Vec};
use crate::scanner::{yaml_parser_fetch_more_tokens, Scanner};
use crate::scanner::Scanner;
use crate::{
Encoding, Event, EventData, MappingStyle, Mark, ParserError, ScalarStyle, SequenceStyle,
TagDirective, Token, TokenData, VersionDirective,
@ -117,7 +117,7 @@ fn PEEK_TOKEN<'a>(parser: &'a mut Parser) -> Result<&'a Token, ParserError> {
.front()
.expect("token_available is true, but token queue is empty"));
}
yaml_parser_fetch_more_tokens(&mut parser.scanner)?;
parser.scanner.fetch_more_tokens()?;
if !parser.scanner.token_available {
return Err(ParserError::UnexpectedEof);
}
@ -136,7 +136,7 @@ fn PEEK_TOKEN_MUT<'a>(parser: &'a mut Parser) -> Result<&'a mut Token, ParserErr
.front_mut()
.expect("token_available is true, but token queue is empty"));
}
yaml_parser_fetch_more_tokens(&mut parser.scanner)?;
parser.scanner.fetch_more_tokens()?;
if !parser.scanner.token_available {
return Err(ParserError::UnexpectedEof);
}

File diff suppressed because it is too large Load diff