Skip to content

Commit

Permalink
将Ignore的源码显示改为空块, 优化空块和内联块的显示
Browse files Browse the repository at this point in the history
  • Loading branch information
A4-Tacks committed Dec 12, 2023
1 parent cdff044 commit 75b10f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mindustry_logic_bang_lang"
version = "0.13.3"
version = "0.13.4"
edition = "2021"

authors = ["A4-Tacks <[email protected]>"]
Expand Down
22 changes: 13 additions & 9 deletions src/syntax/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2271,23 +2271,27 @@ impl DisplaySource for LogicLine {
match self {
Self::Expand(expand) => {
meta.push("{");
meta.add_lf();
meta.do_block(|meta| {
expand.display_source(meta);
});
if !expand.is_empty() {
meta.add_lf();
meta.do_block(|meta| {
expand.display_source(meta);
});
}
meta.push("}");
},
Self::InlineBlock(block) => {
meta.push("inline");
meta.add_space();
meta.push("{");
meta.add_lf();
meta.do_block(|meta| {
block.display_source(meta);
});
if !block.is_empty() {
meta.add_lf();
meta.do_block(|meta| {
block.display_source(meta);
});
}
meta.push("}");
},
Self::Ignore => meta.push("# ignore line"),
Self::Ignore => meta.push("{} # ignore line"),
Self::NoOp => meta.push("noop;"),
Self::Label(lab) => {
meta.push(":");
Expand Down

0 comments on commit 75b10f6

Please sign in to comment.