添加一个新的词法分析器到 scintilla/scite (...最终是 wxPython StyledTextCtrl)
你们有人成功地将词法分析器添加到 scintilla 中吗?
我一直在遵循 http://www.scintilla.org/SciTELexer.html - 甚至在 http://www.scintilla.org/ScintillaDoc 中发现了秘密的额外说明。 html#BuildingScintilla(更改词法分析器集)
一切都会编译,我可以将词法分析器添加到 SciTE 中,但我的 ColouriseMapfileDoc 方法不会被调用(printf 不会生成输出)。如果我将相同的代码添加到例如 ColouriseLuaDoc 词法分析器中,一切都很好(printf 确实 产生输出)。
具体来说,我
- 在
scintilla/include/Scintilla.iface
中添加了val SCLEX_MAPFILE=99
- 以及任何词汇类 ID
- 在 scintilla/include 目录中运行
HFacer.py< /code> 并确认
SciLexer.h
文件已更改。 - 使用
ColouriseMapfileDoc
函数创建LexMapfile.cxx
在文件末尾将词法分析器 ID 和名称与函数相关联:
LexerModule lmMapfile(SCLEX_MAPFILE, ColouriseMapfileDoc, "mapfile");
运行
LexGen.py
生成所有 makefile(按照秘密指令)- 通过克隆
scite/src/others.properties
创建了一个新的SciTE属性文件 - 设置了一些样式
- 在
scite/src/SciTEGlobal.properties
中添加了$( filter.conf)
到open.filter
的定义。 - 将此语言添加到 SciTE 的语言菜单中,
- 构建了 Scintilla 和 SciTE。
- 嘟囔着,咒骂着。
除了第 12 步之外,我做错了什么?
Has anyone of you successfully added a lexer to scintilla?
I have been following the short instructions at http://www.scintilla.org/SciTELexer.html - and even discovered the secret extra instructions at http://www.scintilla.org/ScintillaDoc.html#BuildingScintilla (Changing Set of Lexers)
Everything compiles, and I can add the lexer to SciTE just fine, but my ColouriseMapfileDoc method just does not get called (a printf does not produce output). If I add the same code to e.g. the ColouriseLuaDoc lexer, everything is fine (a printf does produce output).
Specifically I have
- In
scintilla/include/Scintilla.iface
, addedval SCLEX_MAPFILE=99
- And any lexical class IDs
- In the scintilla/include directory run
HFacer.py
and confirmed that theSciLexer.h
file has changed. - Created
LexMapfile.cxx
with aColouriseMapfileDoc
function At the end of the file associated the lexer ID and name with the function:
LexerModule lmMapfile(SCLEX_MAPFILE, ColouriseMapfileDoc, "mapfile");
Run
LexGen.py
to generate all the makefiles (as per the secret instructions)- Created a new SciTE properties file by cloning
scite/src/others.properties
- Set up some styles
- In
scite/src/SciTEGlobal.properties
added$(filter.conf)
to the definition ofopen.filter
. - Added this language to the Language menu of SciTE,
- Built both Scintilla and SciTE.
- Grumbled and cursed.
What am I doing wrong, except maybe step 12?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果将来有人读到这个问题 - 你还必须添加一行
在
SciTEGlobal.properties
中导入您的格式
。这是未记录的步骤 9b。In case someone reads this question in the future - you will also have to add a line
import yourformat
inSciTEGlobal.properties
. That's the undocumented step 9b.不再需要此步骤。我编译了 3.2.2,这是通过 import * 完成的。不过,其余步骤仍然完整且相关。
This step is no longer required. I compiled 3.2.2 and this was done with import *. The rest of the steps are still complete and relevant though.
我直接在
scintilla/lexer/LexOthers.cxx
中编写一个词法分析器,如 中所述http://www.scintilla.org/SciTELEXer.html。对于 scite 3.2.3,缺少步骤 5b 是您需要在
scintilla/src/Catalogue.cxx
中添加LINK_LEXER(lmYouLexerMod);
。I'm wring one lexer directly in
scintilla/lexer/LexOthers.cxx
as described in http://www.scintilla.org/SciTELexer.html.For scite 3.2.3 the lacking step 5b is that you need to add
LINK_LEXER(lmYouLexerMod);
inscintilla/src/Catalogue.cxx
.