我知道关于皮格门斯 API http://pygments.org/docs/api/和词法分析器开发页面 http://pygments.org/docs/lexerdevelopment/但说实话,对于像我这样对 Python 知识非常有限的人来说,这些还不够。
到目前为止,我的策略是寻找例子。我已经发现, e.g. Puppet https://github.com/rodjek/puppet-pygments-lexer/blob/master/puppet_lexer/__init__.py, Sass https://github.com/chriseppstein/pygments-sass-lexer/blob/master/sass_lexer/__init__.py, Scala https://github.com/iamjwc/pygments-scala-lexer/blob/master/scala_lexer.py, Ada https://github.com/jschaf/Ada-Pygments-Lexer/blob/master/ada_lexer/__init__.py。他们的帮助也仅限于此。欢迎任何有关如何开始使用我的 Stata 关键字的帮助。