Skip to content

Commit 4dfadc2

Browse files
committed
完成条件表达式(与或非)的编写,
并且修复构建过程中申请的临时标记与编译过程中申请的临时标记重复
1 parent e413fc7 commit 4dfadc2

File tree

5 files changed

+462
-56
lines changed

5 files changed

+462
-56
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.2"
3+
version = "0.7.0"
44
edition = "2021"
55

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

examples/cmps.mdtlbl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#* 这里是介绍0.7.0版本加入的重要语法
2+
cmps, 这个语法内部依照以前的命名JumpCmp, 然后被连接到CmpTree,
3+
是可以通过短路与, 短路或, 单目非将多个条件(JumpCmpBody)组织起来的语法
4+
这可以使得我们写多条件运算变得很容易,
5+
无需像以前一样插入DExp并且不满足条件跳走来实现
6+
短路与的符号为`&&`, 短路或的符号为`||`, 单目非的符号为`!`
7+
注意, 优先级严格递增为`||` < `&&` < `!`
8+
也就是说`a && b || !c && d`被加上等价的括号后为`(a && b) || ((!c) && d)`
9+
*#
10+
11+
do {
12+
op i i + 1;
13+
} while i < 10 && (read $ cell1 i;) != 0;
14+
end;
15+
16+
#* >>>
17+
op add i i 1
18+
jump 4 greaterThanEq i 10
19+
read __0 cell1 i
20+
jump 0 notEqual __0 0
21+
end
22+
*#
23+
# 可以看到, 我们的多条件正确的生成了.
24+
# 我们可以在while skip goto do_while 等地方编写它

0 commit comments

Comments
 (0)