diff options
Diffstat (limited to 'src/semantic_token.rs')
-rw-r--r-- | src/semantic_token.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/semantic_token.rs b/src/semantic_token.rs index 77ba892..265db91 100644 --- a/src/semantic_token.rs +++ b/src/semantic_token.rs @@ -21,6 +21,7 @@ pub struct SemanticToken { pub r#type: SemanticTokenType, pub source_location: SourceLocation, pub bytecode_location: BytecodeLocation, + pub parent_label: Option<String>, } impl SemanticToken { @@ -28,6 +29,7 @@ impl SemanticToken { pub fn print_error(&self, source_code: &str) -> bool { let mut is_error = false; macro_rules! red {()=>{eprint!("\x1b[31m")};} + macro_rules! dim {()=>{eprint!("\x1b[0;2m")};} macro_rules! normal {()=>{eprint!("\x1b[0m")};} if let SemanticTokenType::Error(token, error) = &self.r#type { @@ -60,6 +62,11 @@ impl SemanticToken { }; eprintln!("Invalid token in macro definition, macro definitions are not allowed to contain {name}") } } + + if let Some(label) = &self.parent_label { + eprint!(" ... "); red!(); eprint!("| "); dim!(); eprintln!("@{label} "); normal!(); + } + let line = source_code.split('\n').nth(self.source_location.start.line).unwrap(); eprint!("{:>5} ", self.source_location.start.line+1); red!(); eprint!("| "); normal!(); |