我想使用 elisp 来标记以下内容:
variable := "The symbol \" delimits strings"; (* Comments go here *)
作为:
<variable> <:=> <The symbol \" delimits strings> <;>
基于来自缓冲区的信息syntax-table
。
我已经进行了symbol-table
适当的设置,并且目前正在使用以下函数,该函数除了字符串常量之外正常运行(如果点不在标识符或正则表达式中的运算符之一处,则返回令牌或 nil)。
(defun forward-token ()
(forward-comment (point-max))
(cond
((looking-at (regexp-opt '("=" ":=" "," ";")))
(goto-char (match-end 0))
(match-string-no-properties 0))
(t (buffer-substring-no-properties
(point)
(progn (skip-syntax-forward "w_")
(point))))))
我是一个elisp新手,所以任何指针都表示赞赏。