Skip to content

Commit e413fc7

Browse files
committed
添加对条件多次取反的功能
1 parent 861699a commit e413fc7

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mindustry_logic_bang_lang"
3-
version = "0.6.1"
3+
version = "0.6.2"
44
edition = "2021"
55

66
authors = ["A4-Tacks <wdsjxhno1001@163.com>"]

src/syntax.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,15 @@ mod tests {
13651365
[r#"goto :a ! x;"#, r#"goto :a x == false;"#],
13661366
[r#"goto :a ! _;"#, r#"goto :a 0 != 0;"#],
13671367
[r#"goto :a lnot _;"#, r#"goto :a 0 != 0;"#],
1368+
// 多次取反
1369+
[r#"goto :a !!! x == y;"#, r#"goto :a x != y;"#],
1370+
[r#"goto :a !!! x != y;"#, r#"goto :a x == y;"#],
1371+
[r#"goto :a !!! x < y;"#, r#"goto :a x >= y;"#],
1372+
[r#"goto :a !!! x > y;"#, r#"goto :a x <= y;"#],
1373+
[r#"goto :a !!! x <= y;"#, r#"goto :a x > y;"#],
1374+
[r#"goto :a !!! x >= y;"#, r#"goto :a x < y;"#],
1375+
[r#"goto :a !!! x;"#, r#"goto :a x == false;"#],
1376+
[r#"goto :a !!! _;"#, r#"goto :a 0 != 0;"#],
13681377
];
13691378
for [src, dst] in datas {
13701379
assert_eq!(

src/syntax_def.lalrpop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ JumpCmpBody: JumpCmp = {
112112

113113
pub JumpCmp: JumpCmp = {
114114
JumpCmpBody,
115-
Or<"lnot", "!"> <JumpCmpBody> => <>.reverse(),
115+
Or<"lnot", "!"> <JumpCmp> => <>.reverse(),
116116
}
117117

118118
pub Op: Op = {

0 commit comments

Comments
 (0)