aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r--src/makefile/input.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs
index beb517a..e8e2e95 100644
--- a/src/makefile/input.rs
+++ b/src/makefile/input.rs
@@ -327,8 +327,24 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
};
match line_type {
- LineType::Rule => self.read_rule(&line_tokens, line_number)?,
- LineType::Macro => self.read_macro(line_tokens, line_number)?,
+ LineType::Rule => {
+ self.read_rule(&line_tokens, line_number)
+ .wrap_err_with(|| {
+ format!(
+ "while parsing rule definition starting on line {}",
+ line_number
+ )
+ })?
+ }
+ LineType::Macro => {
+ self.read_macro(line_tokens, line_number)
+ .wrap_err_with(|| {
+ format!(
+ "while parsing macro definition starting on line {}",
+ line_number
+ )
+ })?
+ }
LineType::Unknown => {
if !line_tokens.is_empty() {
// TODO handle assignments here
@@ -772,7 +788,9 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
}
fn expand_macros(&self, text: &TokenString) -> Result<String> {
- self.macros.expand(text)
+ self.macros
+ .expand(text)
+ .wrap_err_with(|| format!("while expanding \"{}\"", text))
}
pub fn finish(self) -> FinishedMakefileReader {