summaryrefslogtreecommitdiff
path: root/src/stages/syntactic_tokens.rs
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-10-13 13:26:10 +1300
committerBen Bridle <ben@derelict.engineering>2025-10-13 13:26:10 +1300
commit343a15b77ece1674ca49719f04b6189bb26d220e (patch)
treec4a8869ccbb9866b49a862c93175c966150e77f3 /src/stages/syntactic_tokens.rs
parente2a04d00ce7d989335cd678213d90134fefe0b0f (diff)
downloadtorque-asm-343a15b77ece1674ca49719f04b6189bb26d220e.zip
Add a specific error for nested macro definitions
This case was previously being reported with the message "The macro definition was not terminated, add a ';' character to terminate", which was not very helpful.
Diffstat (limited to 'src/stages/syntactic_tokens.rs')
-rw-r--r--src/stages/syntactic_tokens.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/stages/syntactic_tokens.rs b/src/stages/syntactic_tokens.rs
index 5a0ac9e..1f8db7f 100644
--- a/src/stages/syntactic_tokens.rs
+++ b/src/stages/syntactic_tokens.rs
@@ -57,6 +57,7 @@ pub enum SyntacticError {
UnterminatedCharacterLiteral,
UnterminatedStringLiteral,
UnterminatedMacroDefinition(String),
+ MacroDefinitionInMacroDefinition,
UnmatchedBlockTerminator,
UnmatchedExpressionTerminator,
@@ -96,6 +97,8 @@ fn report_syntactic_error(error: &Tracked<SyntacticError>, source_code: &str) {
"String was not terminated, add a '\"' character to terminate",
SyntacticError::UnterminatedMacroDefinition(name) =>
&format!("The '{name}' macro definition was not terminated, add a ';' character to terminate"),
+ SyntacticError::MacroDefinitionInMacroDefinition =>
+ &format!("Attempted to define a macro inside another macro definition"),
SyntacticError::UnmatchedBlockTerminator =>
"Attempted to terminate a block, but no block was in progress",