Emacs Lisp代码(s表达式)格式化程序
jSIMLIB检查器打印出本质上是lisp代码的s表达式代码Emacs Lisp代码(s表达式)格式化程序,emacs,formatting,lisp,textmate,Emacs,Formatting,Lisp,Textmate,jSIMLIB检查器打印出本质上是lisp代码的s表达式代码 (设置选项:打印成功错误) (设置逻辑QF_LIA) (声明乐趣返回()Int) (声明乐趣参考文献1) (声明有趣的标志) (assert+(和(或)(和(/=flags_2_SYMINT 0)(和(=RETURN flags_2_SYMINT)))(和(/=refs_1_SYMINT 0)(和(=flags_2_SYMINT 0))(和(=refs_1_SYMINT 0))(和(=flags_2_SYMINT 0))(和(=RET
(设置选项:打印成功错误)
(设置逻辑QF_LIA)
(声明乐趣返回()Int)
(声明乐趣参考文献1)
(声明有趣的标志)
(assert+(和(或)(和(/=flags_2_SYMINT 0)(和(=RETURN flags_2_SYMINT)))(和(/=refs_1_SYMINT 0)(和(=flags_2_SYMINT 0))(和(=refs_1_SYMINT 0))(和(=flags_2_SYMINT 0))(和(=RETURN 100))(不(和(=refs_2_2_SYMINT 0)))(和(=RETURN flags_2_SYMINT))和(=(/=refs_1_SYMINT 0)(和(=flags_2_SYMINT 0))(和(=RETURN refs_1_SYMINT))(和(=refs_1_SYMINT 0))(和(=flags_2_SYMINT 0))(和(=RETURN 10)))
(支票)
(出口)
如何格式化代码,最好使用emacs或TextMate?例如:
(设置选项:打印成功错误)
(设置逻辑QF_LIA)
(声明乐趣返回()Int)
(声明乐趣参考文献1)
(声明有趣的标志)
(断言
(及
(及
(及
(不同的标志\u 2\u符号0)
(=返回标志_2_SYMINT))
(=参考1参考1参考1参考1参考1参考)
(=flags_2_SYMINT flags1_2_SYMINT))
(不是
(及
(不同的标志\u 2\u符号0)
(=返回标志_2_SYMINT()()))
(检查sat)
pp函数可以很好地打印出来,但可能与您想要的格式不完全匹配
以下是你问题中的一句话:
(pp '(assert+ ( and ( or ( and (/= flags_2_SYMINT 0) (and (= RETURN flags_2_SYMINT)) ) ( and (/= refs_1_SYMINT 0) (and (= flags_2_SYMINT 0)) (and (= RETURN refs_1_SYMINT)) ) ( and (and (= refs_1_SYMINT 0)) (and (= flags_2_SYMINT 0)) (and (= RETURN 100)) ) ) ( not ( or ( and (/= flags_2_SYMINT 0) (and (= RETURN flags_2_SYMINT)) ) ( and (/= refs_1_SYMINT 0) (and (= flags_2_SYMINT 0)) (and (= RETURN refs_1_SYMINT)) ) ( and (and (= refs_1_SYMINT 0)) (and (= flags_2_SYMINT 0)) (and (= RETURN 10)) ) ) ) ) ))
输出为:
(assert+
(and
(or
(and
(/= flags_2_SYMINT 0)
(and
(= RETURN flags_2_SYMINT)))
(and
(/= refs_1_SYMINT 0)
(and
(= flags_2_SYMINT 0))
(and
(= RETURN refs_1_SYMINT)))
(and
(and
(= refs_1_SYMINT 0))
(and
(= flags_2_SYMINT 0))
(and
(= RETURN 100))))
(not
(or
(and
(/= flags_2_SYMINT 0)
(and
(= RETURN flags_2_SYMINT)))
(and
(/= refs_1_SYMINT 0)
(and
(= flags_2_SYMINT 0))
(and
(= RETURN refs_1_SYMINT)))
(and
(and
(= refs_1_SYMINT 0))
(and
(= flags_2_SYMINT 0))
(and
(= RETURN 10)))))))
在GNU Emacs中,您可以使用
缩进pp sexp
将s表达式前面的光标设置为“漂亮打印”,然后键入c-u m-x缩进pp sexp