lexilla
使用 Lexilla 为 Scintilla 集成、构建、发现和扩展语言 lexer。
- License 许可
- MIT
- 所属仓库
- luestr/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 94
- Forks
- 1
01 前言 Front Matter
- name
- lexilla
- metadata
- { "version": "5.5.1", "language": "zh-CN" }
- description
- 使用 Lexilla 为 Scintilla 集成、构建、发现和扩展语言 lexer。
02 资源文件 4
- 参考文档references/lexilla-build-test.md1.5 KB
- 参考文档references/lexilla-integration.md2.8 KB
- 参考文档references/lexilla-overview.md2.4 KB
- 参考文档references/lexilla-protocol.md2.7 KB
03 SKILL.md 正文
Lexilla 技能索引
本技能面向需要在 C/C++、Qt 或其他宿主应用中集成 Lexilla v5.5.1 的开发者。Lexilla 是用于 Scintilla 的语言 lexer 库,可作为静态库链接,也可作为共享库在运行时加载。
官方资料索引
- 项目概览:定位、发布历史、版本、平台、许可证和官方链接。
- 协议与 API:共享库导出函数、
CreateLexer、lexer 发现和库属性。 - 构建与测试:Scintilla peer 目录、
make、nmake、Visual C++ 和测试命令。 - 集成与扩展:C/C++、Qt 集成,以及编写自定义 lexer 的边界。
官方项目资源
- 下载 Lexilla
- Lexilla 历史与贡献
- GitHub issues
- 构建检查 CI、Win32 CI、macOS CI
- SciTE 与 相关项目
- scintilla-interest 邮件列表:用于问题、缺陷和新版本讨论。
快速工作流
- 准备 Lexilla v5.5.1 与 Scintilla 5+ 源码;构建时让名为
scintilla的目录与lexilla同级。 - 选择静态链接或运行时加载共享库;Windows 通常使用
.DLL,Linux 使用.so,macOS 使用.dylib。 - 通过
CreateLexer("cpp")等名称创建 lexer,并用 Scintilla 的SCI_SETILEXER设置当前 lexer。 - 在加载库后按需调用
GetLexerCount/GetLexerName枚举 lexer;不要在新代码中依赖已弃用的 numeric ID 转换。 - 修改 lexer 后运行
TestLexers,确认示例输入与期望结果一致。
关键注意事项
- 基础库要求支持 C++17 的近期编译器;测试框架使用部分 C++20 特性。
- 32 位和 64 位应用必须匹配对应架构的 Lexilla 库。
CreateLexer返回的对象应直接交给 Scintilla;C++ 使用ILexer5 *,C 使用void *。SetLibraryProperty是可选接口,可能用于库初始化;GetLibraryPropertyNames是可选的属性名声明接口。调用顺序应满足具体库的初始化要求。LexerNameFromID是迁移兼容接口,已弃用,未来会移除;优先使用 lexer name。
资料来源
04 同仓库更多 Skills
write-ublock-origin-filters
完整的 uBlock Origin (uBO) 静态过滤语法参考。编写 uBlock Origin 自定义过滤规则时使用此技能,涵盖广告拦截、隐私保护或内容过滤。包含基础网络过滤模式(||、*、^、|)、所有网络过滤选项($domain、$third-party、$important、$redirect、$removeparam、$csp、$replace、$header、$method、$denyallow、$badfilter、$all 等)、内容类型选项($script、$image、$stylesheet、$font、$media、$xhr、$popup、$document、$frame 等)、元素隐藏规则(## 选择器、实体匹配、主机名正则)、过程式元素隐藏过滤器(:has、:has-text、:matches-css、:upward、:xpath、:matches-path、:watch-attr 等)、动作操作符(:remove、:style、:remove-attr、:remove-class)、HTML 过滤器(##^)、响应头过滤(##^responseheader)、脚本注入(##+js())以及预处理指令(!#include、!#if)。当用户提到 uBlock Origin 过滤规则、uBO 语法、广告拦截规则、元素隐藏规则、过程式选择器、脚本注入或希望编写/调试任何 uBO 兼容过滤列表时触发。即使用户只是在编写或调试 uBlock Origin 过滤规则、创建自定义过滤列表或从 AdBlock Plus/AdGuard 迁移过滤规则到 uBO,也应使用此技能。
write-ublock-origin-filters
Complete uBlock Origin (uBO) static filter reference. Use this skill when writing or debugging uBO custom filters or filter lists for ad blocking, privacy or content filtering, or when migrating filters from AdBlock Plus/AdGuard. Covers network patterns (||, *, ^, |) and options ($domain, $third-party, $important, $redirect, $removeparam, $csp, $replace, $header, $method, $badfilter, $all), content-type options ($script, $image, $stylesheet, $font, $media, $xhr, $popup, $document, $frame), cosmetic filters (##, CSS selectors, entity matching), procedural filters (:has, :has-text, :matches-css, :upward, :xpath, :matches-path, :watch-attr), action operators (:remove, :style, :remove-attr), HTML filters (##^), response-header filtering (##^responseheader), scriptlet injection (##+js()), and pre-parsing directives (!#include, !#if). Trigger whenever the user mentions uBO syntax, ad blocking rules, element hiding, procedural selectors, scriptlet injection, or a uBO-compatible filter list.
write-tampermonkey-scripts
引导 AI 代理规划、编写、调试、测试和维护 Tampermonkey 用户脚本。当用户请求用户脚本、浏览器页面自动化、DOM 增强、Tampermonkey 元数据、GM_* API、@match、@grant、@run-at、@connect、跨源请求、SPA 页面集成或脚本注入任务时使用此技能,即使用户没有明确提及 Tampermonkey。
write-tampermonkey-scripts
Guide an AI agent through planning, writing, debugging, testing, and maintaining Tampermonkey userscripts. Use this skill whenever a user asks for a userscript, browser-page automation, DOM enhancement, Tampermonkey metadata, GM_* API, @match, @grant, @run-at, @connect, cross-origin request, SPA page integration, or script injection task, even when Tampermonkey is not named explicitly.
write-adguard-filters
编写 AdGuard 自定义过滤规则时使用此技能。涵盖基本规则语法、所有修饰符($domain/$third-party/$important/$redirect/$replace/$removeparam/$cookie/$csp 等)、外观规则(元素隐藏/CSS/Extended CSS 选择器)、HTML 过滤、JavaScript/脚本片段规则、非基本规则修饰符、预处理器指令和调试技巧。当用户提及 AdGuard 过滤规则、广告拦截规则语法、过滤器列表编写、ABP 语法兼容、元素隐藏规则、Extended CSS 选择器(:has/:contains/:matches-css 等)时触发。即使用户只是在编写或调试任何类型的广告过滤规则,也应使用此技能。
write-adguard-filters
Complete AdGuard filtering rules syntax reference. Use this skill when writing AdGuard custom filters. Covers basic rule syntax, all modifiers ($domain/$third-party/$important/$redirect/$replace/$removeparam/$cookie/$csp etc.), cosmetic rules (element hiding/CSS/Extended CSS selectors), HTML filtering, JavaScript/scriptlet rules, non-basic rule modifiers, preprocessor directives, and debugging. Trigger when user mentions AdGuard filtering rules, ad blocking rule syntax, filter list authoring, ABP syntax compatibility, element hiding rules, Extended CSS selectors (:has/:contains/:matches-css etc.). Use this skill even when the user is just writing or debugging any type of ad filtering rules.