【发布时间】:2018-04-30 16:34:38
【问题描述】:
我希望以 JSON 或 XML 等可读格式从 Swift REPL 中获取 Swift 编译器错误
我能做的最好的就是通过标准输入/输出管道将其作为字符串读入。我用swiftc 尝试了几乎所有参数/选项,但没有运气。
我读到我可以编写扩展 LLDB 的 Python 脚本,但我不知道从哪里开始。
目前格式为:
/Users/joeblow/Desktop/pre-compiled.swift:1:38: error: cannot convert value of type 'Int' to specified type 'String'
var age = 10; var name: String = 12;
^~
但我对这样的事情更感兴趣:
{
path: "/Users/joeblow/Desktop/compiled.swift",
line: 1,
position: 38,
error: "cannot convert value of type 'Int' to specified type 'String'"
}
我不想使用正则表达式/字符串操作。
【问题讨论】:
标签: swift clang lldb read-eval-print-loop