瀏覽代碼

Log result of parse in end tail of comment_scope

Isaac Woods 5 年之前
父節點
當前提交
197554c6c0
共有 2 個文件被更改,包括 2 次插入4 次删除
  1. 0 3
      aml_parser/src/name_object.rs
  2. 2 1
      aml_parser/src/parser.rs

+ 0 - 3
aml_parser/src/name_object.rs

@@ -16,16 +16,13 @@ pub fn name_string<'a>() -> impl Parser<'a, String> {
 
     comment_scope("NameString", move |input: &'a [u8]| {
         let first_char = *input.first().ok_or((input, AmlError::UnexpectedEndOfStream))?;
-        log::trace!("First char: {}, {:#x}", first_char, first_char);
 
         match first_char {
             ROOT_CHAR => root_name_string.parse(input),
-
             PREFIX_CHAR => {
                 // TODO: parse <PrefixPath NamePath> where there are actually PrefixChars
                 unimplemented!();
             }
-
             _ => name_path().parse(input),
         }
     })

+ 2 - 1
aml_parser/src/parser.rs

@@ -158,13 +158,14 @@ where
 
 pub fn comment_scope<'a, P, R>(scope_name: &'a str, parser: P) -> impl Parser<'a, R>
 where
+    R: core::fmt::Debug,
     P: Parser<'a, R>,
 {
     move |input| {
         trace!("--> {}", scope_name);
         // Return if the parse fails, so we don't print the tail. Makes it easier to debug.
         let (new_input, result) = parser.parse(input)?;
-        trace!("<-- {}", scope_name);
+        trace!("<-- {}({:?})", scope_name, result);
         Ok((new_input, result))
     }
 }