diff options
Diffstat (limited to 'src/stages/semantic.rs')
| -rw-r--r-- | src/stages/semantic.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/stages/semantic.rs b/src/stages/semantic.rs index 96cf7af..f96a0c5 100644 --- a/src/stages/semantic.rs +++ b/src/stages/semantic.rs @@ -272,10 +272,16 @@ impl SemanticParser { self.errors.push(Tracked::from(error, token.source)); None } - MacroDefinitionBody::List(list) => { - let error = SemanticError::ExpectedInteger(location); - self.errors.push(Tracked::from(error, list.source)); - None + MacroDefinitionBody::List(list) => match list.value { + // Convert a one-element list to an integer. + ListToken::ListLiteral(mut integers) if integers.len() == 1 => { + Some(integers.pop().unwrap()) + } + _ => { + let error = SemanticError::ExpectedInteger(location); + self.errors.push(Tracked::from(error, list.source)); + None + } } } } |
