1 Star 13 Fork 0

jianchiyiye/cylisp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
key-aux.scm 2.28 KB
一键复制 编辑 原始数据 按行查看 历史
jianchiyiye 提交于 2022-07-20 09:56 . adv-macro
(define-macro/err (handle-macro/key-aux cyl-key cyl-l str-l)
`(begin
(if (string? cyl-adverb-value)
(begin
(push cyl-adverb-value cyl-current-macro)
(let-set! (res-str loc res-cyl res-st deli-cyl) (run/err cyl-macro s (+ loc 1) cyl-adverb-value ,cyl-l ,str-l))
)
(begin
(push last-str cyl-current-macro)
(let-set! (res-str loc res-cyl res-st deli-cyl) (run/err cyl-macro s (+ loc 1) last-str))
))
(pop cyl-current-macro)
(set! res-deli-st (nth 3 deli-cyl))
;;(y-or-n "handle-macro/key-aux:macro-list=~a,deli-cyl=~S,res-str=~a\nmk-str=~S\n" cyl-current-macro deli-cyl res-str mk-str-l)
(cond
((or (eq? res-deli-st '结束分隔符)(eq? res-deli-st '语句结束分隔符))
(push res-cyl mk-cyl-l)
(push res-str mk-str-l)
;;(y-or-n "handle-macro/key-aux:loc=~a,status=~a,deli=~a\nmk-cyl-l=~a\n" loc cyl-define-status deli-cyl mk-cyl-l)
(exit-cyl-key (list (merge-str loc mk-str-l) loc (merge-cyl loc mk-cyl-l '系统关键字调用) '系统关键字调用 deli-cyl #f key-handle))
)
(else
(push res-cyl mk-cyl-l)
(push res-str mk-str-l)
))))
(define-macro/err (handle-key/key-aux cyl-key)
`(let* ((cur-key last-str)
(cur-coding-l (find-system-dict-key-coding-list cur-key))
(cur-coding (nth 1 cur-coding-l))
(cur-permit-l (nth 8 (nth 2 cur-coding-l)))
(cur-handle (nth 7 (nth 2 cur-coding-l)))
)
;;(y-or-n "handle-key/key-aux:loc=~a\n" loc )
(if (member key-str cur-permit-l)
(exit-cyl-key (list (merge-str loc mk-str-l) loc (merge-cyl loc mk-cyl-l '系统关键字调用) '系统关键字调用 deli-cyl cur-key cur-handle))
(exit-cyl-key (list 'err loc (string-length cur-key) '非法语法 (err-format 'cyl-key->handle-key loc "[~a]关键字不允许在[~a]后出现。~a" cur-key key-str cur-permit-l))))))
(define-macro/err (rewrite-cyl/ciyu->macro-var cyl-key)
`(if (eq? (nth 3 last-cyl) '词语)
(begin
(set-car! (list-tail last-cyl 3) '宏引导变量)
(set-car! (list-tail last-cyl 2) (append-new-coding last-str '宏引导变量 0)))))
(define-macro/err (pre-handle-key/key-aux cyl-key)
`(begin
(push (list key-str (string-length key-str) key-coding '系统关键字 (cyl-serial)) mk-cyl-l)
(push key-str mk-str-l)
))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Scheme
1
https://gitee.com/jianchiyiye/cylisp.git
git@gitee.com:jianchiyiye/cylisp.git
jianchiyiye
cylisp
cylisp
master

搜索帮助