Skip to content

Commit

Permalink
Require dot in front of debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Jan 24, 2024
1 parent 8c0c4b8 commit 7c88e28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ast/src/parsed/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ impl Display for DebugDirective {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
match self {
DebugDirective::File(nr, path, file) => {
write!(f, "debug file {nr} {} {};", quote(path), quote(file))
write!(f, ".debug file {nr} {} {};", quote(path), quote(file))
}
DebugDirective::Loc(file, line, col) => {
write!(f, "debug loc {file} {line} {col};")
write!(f, ".debug loc {file} {line} {col};")
}
DebugDirective::OriginalInstruction(insn) => {
write!(f, "debug insn \"{insn}\";")
write!(f, ".debug insn \"{insn}\";")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions parser/src/powdr.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ InstructionStatement: FunctionStatement<T> = {
}

DebugDirectiveStatement: FunctionStatement<T> = {
<start:@L> "debug" "file" <n:Integer> <d:StringLiteral> <f:StringLiteral> ";"
<start:@L> ".debug" "file" <n:Integer> <d:StringLiteral> <f:StringLiteral> ";"
=> FunctionStatement::DebugDirective(ctx.source_ref(start), DebugDirective::File(n.try_into().unwrap(), d, f)),
<start:@L> "debug" "loc" <f:Integer> <line:Integer> <col:Integer> ";"
<start:@L> ".debug" "loc" <f:Integer> <line:Integer> <col:Integer> ";"
=> FunctionStatement::DebugDirective(ctx.source_ref(start), DebugDirective::Loc(f.try_into().unwrap(), line.try_into().unwrap(), col.try_into().unwrap())),
<start:@L> "debug" "insn" <insn:StringLiteral> ";"
<start:@L> ".debug" "insn" <insn:StringLiteral> ";"
=> FunctionStatement::DebugDirective(ctx.source_ref(start), DebugDirective::OriginalInstruction(insn)),
}

Expand Down
4 changes: 2 additions & 2 deletions riscv/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub fn compile(

let program: Vec<String> = file_ids
.into_iter()
.map(|(id, dir, file)| format!("debug file {id} {} {};", quote(&dir), quote(&file)))
.map(|(id, dir, file)| format!(".debug file {id} {} {};", quote(&dir), quote(&file)))
.chain(bootloader_lines)
.chain(["call __data_init;".to_string()])
.chain([
Expand Down Expand Up @@ -814,7 +814,7 @@ fn process_statement(s: Statement, coprocessors: &CoProcessors) -> Vec<String> {
".loc",
[Argument::Expression(Expression::Number(file)), Argument::Expression(Expression::Number(line)), Argument::Expression(Expression::Number(column)), ..],
) => {
vec![format!(" debug loc {file} {line} {column};")]
vec![format!(" .debug loc {file} {line} {column};")]
}
(".file", _) => {
// We ignore ".file" directives because they have been extracted to the top.
Expand Down

0 comments on commit 7c88e28

Please sign in to comment.