Parcourir la source

Short-circuit `comment_scope` if there's an error

This makes debugging easier because you can see what parser the error
originated in more easily
Isaac Woods il y a 5 ans
Parent
commit
3697db1856
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      aml_parser/src/parser.rs

+ 3 - 2
aml_parser/src/parser.rs

@@ -127,9 +127,10 @@ where
 {
     move |input| {
         trace!("--> {}", scope_name);
-        let result = parser.parse(input);
+        // 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);
-        result
+        Ok((new_input, result))
     }
 }