移植bot4cj
This commit is contained in:
1 parent
7803843155
commit
78ad3e6d57
76 files changed
+14468
No files matched your search
+16
@@ -0,0 +1,16 @@
|
||||
macro package bot4cj.hd.extern
|
||||
|
||||
import std.fs.*
|
||||
import std.io.*
|
||||
import std.ast.*
|
||||
|
||||
public macro ExternHardware(attrTokens: Tokens, inputTokens: Tokens): Tokens {
|
||||
let expr = LitConstExpr(attrTokens)
|
||||
let file = File(expr.literal.value, OpenMode.Read)
|
||||
let bytes = readToEnd(file)
|
||||
file.close()
|
||||
let sb = StringBuilder()
|
||||
sb.appendFromUtf8(bytes)
|
||||
let code = sb.toString()
|
||||
return cangjieLex(code)
|
||||
}
|
||||
Reference in new issue
Block a user