Skip to content

Commit 5a2fa8f

Browse files
committed
删除多余的文件
1 parent 1f75313 commit 5a2fa8f

File tree

5 files changed

+199
-7
lines changed

5 files changed

+199
-7
lines changed

src/main/kotlin/top/mcfpp/antlr/McfppImVisitor.kt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,41 @@ open class McfppImVisitor: mcfppParserBaseVisitor<Any?>() {
442442
//if(),需要进行条件计算
443443
parent as mcfppParser.IfStatementContext
444444
val exp = McfppExprVisitor().visit(parent.expression())
445+
when(exp){
446+
is MCBoolConcrete -> {
447+
if (exp.value) {
448+
//函数调用的命令
449+
//给子函数开栈
450+
Function.addCommand("function " + f.namespaceID)
451+
LogProcessor.warn("The condition is always true. ")
452+
} else {
453+
Function.addComment("function " + f.namespaceID)
454+
LogProcessor.warn("The condition is always false. ")
455+
}
456+
}
457+
458+
is ReturnedMCBool -> {
459+
//给子函数开栈
460+
Function.addCommand(
461+
"execute " +
462+
"if function " + exp.parentFunction.namespaceID +
463+
"run return run function " + f.namespaceID
464+
)
465+
}
466+
467+
is MCBool -> {
468+
Function.addCommand(
469+
"execute " +
470+
"if score " + exp.name + " " + SbObject.MCFPP_boolean + " matches 1 " +
471+
"run return run function " + f.namespaceID
472+
)
473+
}
474+
475+
is CommandReturn -> {
476+
477+
}
478+
479+
}
445480
if(exp !is MCBool){
446481
throw TypeCastException()
447482
}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
package top.mcfpp.lang
2+
3+
import top.mcfpp.lang.type.MCFPPType
4+
import top.mcfpp.model.FieldContainer
5+
import top.mcfpp.model.Member
6+
import top.mcfpp.model.function.Function
7+
import java.util.*
8+
9+
class CommandReturn : Var<CommandReturn> {
10+
11+
/**
12+
* 创建一个string类型的变量。它的mc名和变量所在的域容器有关。
13+
*
14+
* @param identifier 标识符。默认为
15+
*/
16+
constructor(
17+
curr: FieldContainer,
18+
identifier: String = UUID.randomUUID().toString()
19+
) : this(curr.prefix + identifier) {
20+
this.identifier = identifier
21+
22+
}
23+
24+
/**
25+
* 创建一个string值。它的标识符和mc名相同。
26+
* @param identifier identifier
27+
*/
28+
constructor(identifier: String = UUID.randomUUID().toString()) : super(identifier)
29+
30+
/**
31+
* 复制一个string
32+
* @param b 被复制的string值
33+
*/
34+
constructor(b: MCString) : super(b)
35+
36+
override fun doAssign(b: Var<*>): CommandReturn {
37+
TODO("Not yet implemented")
38+
}
39+
40+
override fun clone(): CommandReturn {
41+
TODO("Not yet implemented")
42+
}
43+
44+
override fun getTempVar(): CommandReturn {
45+
TODO("Not yet implemented")
46+
}
47+
48+
override fun storeToStack() {
49+
TODO("Not yet implemented")
50+
}
51+
52+
override fun getFromStack() {
53+
TODO("Not yet implemented")
54+
}
55+
56+
override fun getMemberVar(key: String, accessModifier: Member.AccessModifier): Pair<Var<*>?, Boolean> {
57+
TODO("Not yet implemented")
58+
}
59+
60+
override fun getMemberFunction(
61+
key: String,
62+
readOnlyParams: List<MCFPPType>,
63+
normalParams: List<MCFPPType>,
64+
accessModifier: Member.AccessModifier
65+
): Pair<Function, Boolean> {
66+
TODO("Not yet implemented")
67+
}
68+
69+
companion object {
70+
71+
}
72+
73+
}
74+
75+
class CommandSuccess: Var<CommandSuccess>{
76+
77+
constructor(re: CommandReturn): super("success"){
78+
79+
}
80+
81+
override fun doAssign(b: Var<*>): CommandSuccess {
82+
TODO("Not yet implemented")
83+
}
84+
85+
override fun clone(): CommandSuccess {
86+
TODO("Not yet implemented")
87+
}
88+
89+
override fun getTempVar(): CommandSuccess {
90+
TODO("Not yet implemented")
91+
}
92+
93+
override fun storeToStack() {
94+
TODO("Not yet implemented")
95+
}
96+
97+
override fun getFromStack() {
98+
TODO("Not yet implemented")
99+
}
100+
101+
override fun getMemberVar(key: String, accessModifier: Member.AccessModifier): Pair<Var<*>?, Boolean> {
102+
TODO("Not yet implemented")
103+
}
104+
105+
override fun getMemberFunction(
106+
key: String,
107+
readOnlyParams: List<MCFPPType>,
108+
normalParams: List<MCFPPType>,
109+
accessModifier: Member.AccessModifier
110+
): Pair<Function, Boolean> {
111+
TODO("Not yet implemented")
112+
}
113+
114+
}
115+
116+
class CommandResult: Var<CommandResult>{
117+
118+
constructor(re: CommandReturn): super("result"){
119+
120+
}
121+
122+
override fun doAssign(b: Var<*>): CommandResult {
123+
TODO("Not yet implemented")
124+
}
125+
126+
override fun clone(): CommandResult {
127+
TODO("Not yet implemented")
128+
}
129+
130+
override fun getTempVar(): CommandResult {
131+
TODO("Not yet implemented")
132+
}
133+
134+
override fun storeToStack() {
135+
TODO("Not yet implemented")
136+
}
137+
138+
override fun getFromStack() {
139+
TODO("Not yet implemented")
140+
}
141+
142+
override fun getMemberVar(key: String, accessModifier: Member.AccessModifier): Pair<Var<*>?, Boolean> {
143+
TODO("Not yet implemented")
144+
}
145+
146+
override fun getMemberFunction(
147+
key: String,
148+
readOnlyParams: List<MCFPPType>,
149+
normalParams: List<MCFPPType>,
150+
accessModifier: Member.AccessModifier
151+
): Pair<Function, Boolean> {
152+
TODO("Not yet implemented")
153+
}
154+
155+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package top.mcfpp.minecraft
2+
3+
object BossBar {
4+
}

src/main/kotlin/top/mcfpp/model/function/Function.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ open class Function : Member, FieldContainer, Serializable {
136136
*/
137137
var normalParams: ArrayList<FunctionParam>
138138

139-
/**
140-
* 只读参数列表
141-
*/
142-
//var readOnlyParams: ArrayList<FunctionParam>
143-
144139
/**
145140
* 函数编译时的缓存
146141
*/

命令函数设计.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929

3030
`bossbar`命令
3131

32-
### class CommandValue
32+
### class CommandReturn
3333

34-
`CommandValue`是几乎所有命令函数的返回值类型。它有两个成员,`result``success`,对应命令是否执行成功,或者命令执行的返回值。
34+
`CommandReturn`是几乎所有命令函数的返回值类型。它有两个只读成员,`Return``success`,对应命令是否执行成功,或者命令执行的返回值。
35+
36+
* `Return``CommandResult`类型的数据。可以被储存为`int`
37+
* `success`: `CommandSuccess`类型。可以用于if语句的判断,也能被储存在if语句中。
3538

3639
### class Inventory
3740

0 commit comments

Comments
 (0)