Add Assembly (65C02) language with WDC W65C02S syntax highlighting - #109
Merged
Conversation
Spec and step-by-step plan for adding a first-class L_ASM_65C02 language that reuses Lexilla SCLEX_ASM with WDC W65C02S keyword lists. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LexAsm (used by Assembly (65C02), added in a follow-up commit) consumes eight keyword lists. Append a null-initialized keywordsExtra[] array to LangDef and forward each non-null entry via SCI_SETKEYWORDS in applyLanguageToView. Existing g_languages rows are untouched and continue to compile via aggregate zero-init. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add LANG_ASM_65C02 index, a g_languages row pointing at Lexilla's `asm` lexer with the full eight WDC W65C02S keyword classes (opcodes, registers, directives, fold pairs), and .asm/.a65/.s65 extension detection. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add s_asmStyles[] mapping SCE_ASM_* style IDs to BGR foreground colors (light + dark variants) and register the table under the "asm" lexer name in s_allLexerStyles[]. Color choices mirror the upstream stylers.model.xml defaults converted from RGB to BGR; dark variants align with the VS Code palette used by neighboring lexer entries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The descriptor row's 5th field is the Lexilla lexer ID; Lexilla only registers "asm" for SCLEX_ASM. Passing "asm65c02" made CreateLexer return null and disabled highlighting on Windows. Reuse the "asm" lexer name, matching how L_SCHEME shares "lisp". Also add .a65 and .s65 to the upstream langs.model.xml ext list so Windows routing matches the macOS port's guessLanguage(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new first-class Assembly (65C02) language to PaperWasp, reusing Lexilla’s SCLEX_ASM lexer with WDC W65C02S-oriented keyword sets, and wires it through both the Windows/Notepad++ plumbing and the macOS port’s language tables/styling.
Changes:
- Introduces
L_ASM_65C02/IDM_LANG_ASM_65C02, adds menu items, and maps language↔command IDs. - Adds
asm65c02keyword/styler models and a function-list parser (asm65c02.xml). - Extends macOS language definitions to support LexAsm’s additional word lists (sets 2–7) and adds an ASM style table.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| PowerEditor/src/stylers.model.xml | Adds asm65c02 lexer style definitions matching ASM style IDs. |
| PowerEditor/src/ScintillaComponent/ScintillaEditView.h | Adds setAsm65C02Lexer() wrapper to configure SCLEX_ASM with all 8 word lists. |
| PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp | Adds language descriptor row and routes L_ASM_65C02 through codepage handling + defineDocType. |
| PowerEditor/src/Parameters.cpp | Maps L_ASM_65C02 → IDM_LANG_ASM_65C02. |
| PowerEditor/src/Notepad_plus.rc | Adds “Assembly (65C02)” to language menus. |
| PowerEditor/src/Notepad_plus.cpp | Maps IDM_LANG_ASM_65C02 → L_ASM_65C02. |
| PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h | Appends L_ASM_65C02 to the LangType enum. |
| PowerEditor/src/menuCmdID.h | Defines IDM_LANG_ASM_65C02. |
| PowerEditor/src/langs.model.xml | Adds asm65c02 keyword lists and associates extensions (asm a65 s65). |
| PowerEditor/installer/functionList/asm65c02.xml | Adds function-list parser for 65C02 labels. |
| macos/platform/lexer_styles.mm | Adds ASM style mapping and applies keyword sets 2–7 via keywordsExtra. |
| macos/platform/language_defs.mm | Adds Assembly (65C02) language row and routes .asm/.a65/.s65 detection. |
| macos/platform/language_defs.h | Extends LangDef with keywordsExtra[6] and adds LANG_ASM_65C02. |
| docs/superpowers/specs/2026-05-11-asm-65c02-language-design.md | Design spec for the new language integration. |
| docs/superpowers/plans/2026-05-11-asm-65c02-language.md | Implementation plan / verification checklist. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {L"lisp", L"Lisp", L"List Processing language file", L_LISP, "lisp"}, | ||
| {L"scheme", L"Scheme", L"Scheme file", L_SCHEME, "lisp"}, | ||
| {L"asm", L"Assembly", L"Assembly language source file", L_ASM, "asm"}, | ||
| {L"asm65c02", L"Assembly (65C02)", L"WDC 65C02 assembly source file", L_ASM_65C02, "asm"}, |
Comment on lines
+42
to
45
| L_ASM_65C02, \ | ||
| // Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead | ||
| // The end of enumerated language type, so it should be always at the end | ||
| L_EXTERNAL}; |
| <!-- ==========================================================================\ | ||
| | | ||
| | Function-list parser for Assembly (65C02). | ||
| | Matches any column-0 label terminated by ':' as a "subroutine". |
The _langNameInfoArray is indexed by LangType enum value (lines 1588, 2327 read [langType]). The asm65c02 descriptor row was inserted after L_ASM=32, but L_ASM_65C02=95 — every row after L_ASM was therefore mapped to the wrong language. Move the row to its enum-ordered position between L_ERRORLIST and L_EXTERNAL. The vendored ComparePlus copy of Notepad_plus_msgs.h falls out of sync with the host whenever the LangType enum grows. Append L_ASM_65C02 there so the plugin sees the same enum values as the host. Tighten the asm65c02.xml header comment to match the regex behavior (labels may be indented; the parser is not column-0-only). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SCLEX_ASMlexer with WDC W65C02S keyword lists (NMOS 6502 + CMOS 65C02 + WDCWAI/STP+ RockwellSMB/RMB/BBR/BBS).langs.model.xml,stylers.model.xml, function-list parser) and the macOS port's runtime tables (g_languages,s_asmStyles, extension routing).LangDefstruct with a backward-compatiblekeywordsExtra[6]so LexAsm's 8 keyword classes (opcodes, math, registers, directives, directive-operands, ext, fold-open, fold-close) all flow throughapplyLanguageToView()— existing 34g_languagesrows continue to compile via aggregate zero-init..asm,.a65,.s65auto-detect as Assembly (65C02). x86 Assembly remains available via the Languages menu.Spec:
docs/superpowers/specs/2026-05-11-asm-65c02-language-design.mdPlan:
docs/superpowers/plans/2026-05-11-asm-65c02-language.mdArchitecture notes
L_ASM_65C02is appended immediately beforeL_EXTERNALinLangType, preserving every existing enum value (plugin ABI stable).IDM_LANG_ASM_65C02 = IDM_LANG + 94— collision-free.<LexerType name="asm">defaults for Windows; the macOSs_asmStyles[]mirrors them with BGR conversions and dark-mode variants from the VS Code palette already used in neighboring lexers.Out of scope (v1)
longa/longi/shorta/shorti), 24-bit operands..lkr) highlighting.Test plan
/tmp/claude/sample_65c02.asm(or any 65C02 source) in PaperWasp — language auto-detects as Assembly (65C02).🤖 Generated with Claude Code