Skip to content

Commit

Permalink
简单修复mdt优先解析直接索引跳转而不是查找标签
Browse files Browse the repository at this point in the history
  • Loading branch information
A4-Tacks committed Aug 27, 2024
1 parent 52256e1 commit e8cff2c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions 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.17.0"
version = "0.17.1"
edition = "2021"

authors = ["A4-Tacks <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion tools/tag_code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tag_code"
version = "0.2.0"
version = "0.2.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
9 changes: 8 additions & 1 deletion tools/tag_code/src/logic_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,19 @@ impl<'a> Display for ParseLine<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ParseLine::Label(lab) => {
if let Some('0'..='9') = lab.chars().next() {
f.write_str(":")?;
}
f.write_str(&*lab)?;
f.write_str(":")
},
ParseLine::Jump(target, args) => {
if f.alternate() { f.write_str(" ")? }
f.write_fmt(format_args!("jump {target} {args}"))
f.write_str("jump ")?;
if let Some('0'..='9') = target.chars().next() {
f.write_str(":")?;
}
f.write_fmt(format_args!("{target} {args}"))
},
ParseLine::Args(args) => {
if f.alternate() { f.write_str(" ")? }
Expand Down

0 comments on commit e8cff2c

Please sign in to comment.