Fix --features=parse_debug_trace

This commit is contained in:
Joshua Warner 2022-11-03 08:03:07 -07:00
parent d0fe108564
commit 469e1dc9e3
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
2 changed files with 5 additions and 3 deletions

View file

@ -737,6 +737,7 @@ pub trait Parser<'a, Output, Error> {
) -> ParseResult<'a, Output, Error>; ) -> ParseResult<'a, Output, Error>;
#[cfg(not(feature = "parse_debug_trace"))] #[cfg(not(feature = "parse_debug_trace"))]
#[inline(always)]
fn trace(self, _message: &'static str) -> Self fn trace(self, _message: &'static str) -> Self
where where
Self: Sized, Self: Sized,
@ -789,7 +790,7 @@ impl<'a, O: std::fmt::Debug, E: std::fmt::Debug, P: Parser<'a, O, E>> Parser<'a,
where where
E: 'a, E: 'a,
{ {
fn parse(&self, arena: &'a Bump, state: State<'a>) -> ParseResult<'a, O, E> { fn parse(&self, arena: &'a Bump, state: State<'a>, min_indent: u32) -> ParseResult<'a, O, E> {
use std::cell::RefCell; use std::cell::RefCell;
thread_local! { thread_local! {
@ -803,7 +804,7 @@ where
let cur_indent = INDENT.with(|i| *i.borrow()); let cur_indent = INDENT.with(|i| *i.borrow());
println!( println!(
"{:>5?}: {}{:<50}", "{:<5?}: {}{:<50}",
state.pos(), state.pos(),
&indent_text[..cur_indent * 2], &indent_text[..cur_indent * 2],
self.message self.message

View file

@ -133,7 +133,8 @@ impl Position {
impl Debug for Position { impl Debug for Position {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "@{}", self.offset) write!(f, "@")?;
self.offset.fmt(f)
} }
} }