From e8cff2c59095138b870db699122176cf90c73a1e Mon Sep 17 00:00:00 2001 From: A4-Tacks Date: Wed, 28 Aug 2024 02:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E4=BF=AE=E5=A4=8Dmdt?= =?UTF-8?q?=E4=BC=98=E5=85=88=E8=A7=A3=E6=9E=90=E7=9B=B4=E6=8E=A5=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E8=B7=B3=E8=BD=AC=E8=80=8C=E4=B8=8D=E6=98=AF=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- tools/tag_code/Cargo.toml | 2 +- tools/tag_code/src/logic_parser.rs | 9 ++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ce20d5..1c0217d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,7 +307,7 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "mindustry_logic_bang_lang" -version = "0.17.0" +version = "0.17.1" dependencies = [ "display_source", "logic_lint", @@ -580,7 +580,7 @@ dependencies = [ [[package]] name = "tag_code" -version = "0.2.0" +version = "0.2.1" dependencies = [ "either", "peg", diff --git a/Cargo.toml b/Cargo.toml index 442549b..90add1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mindustry_logic_bang_lang" -version = "0.17.0" +version = "0.17.1" edition = "2021" authors = ["A4-Tacks "] diff --git a/tools/tag_code/Cargo.toml b/tools/tag_code/Cargo.toml index 88aa9d5..6fbc154 100644 --- a/tools/tag_code/Cargo.toml +++ b/tools/tag_code/Cargo.toml @@ -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 diff --git a/tools/tag_code/src/logic_parser.rs b/tools/tag_code/src/logic_parser.rs index 6aae517..eec0e75 100644 --- a/tools/tag_code/src/logic_parser.rs +++ b/tools/tag_code/src/logic_parser.rs @@ -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(" ")? }