Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions PowerEditor/installer/functionList/asm65c02.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==========================================================================\
|
| Function-list parser for Assembly (65C02).
| Matches any label terminated by ':' (with optional leading whitespace)
| as a "subroutine". Heuristic only — 65C02 has no formal function
| construct; refine later.
|
| See: https://npp-user-manual.org/docs/function-list/
|
\=========================================================================== -->
<NotepadPlus>
<functionList>
<!-- =============================================== [ Assembly (65C02) ] -->

<parser
displayName="Assembly (65C02)"
id ="asm65c02_subroutine"
commentExpr="(?x) # inline-comments mode
(?m-s:;.*$) # ;-to-EOL line comment
"
>
<function
mainExpr="(?x) # inline-comments mode
(?m)^\h* # optional leading whitespace
\K # keep the text matched so far, out of the overall match
[A-Za-z_][\w]* # valid label characters (no $ since WDC uses $ as hex prefix)
(?=:) # up till the colon
"
/>
</parser>
</functionList>
</NotepadPlus>
1 change: 1 addition & 0 deletions PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG,\
L_TYPESCRIPT, L_JSON5, L_MSSQL, L_GDSCRIPT, L_HOLLYWOOD,\
L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, \
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};
Comment on lines +42 to 45
Expand Down
2 changes: 2 additions & 0 deletions PowerEditor/src/Notepad_plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4132,6 +4132,8 @@ LangType Notepad_plus::menuID2LangType(int cmdID)
return L_SAS;
case IDM_LANG_ERRORLIST:
return L_ERRORLIST;
case IDM_LANG_ASM_65C02:
return L_ASM_65C02;
case IDM_LANG_USER:
return L_USER;
default:
Expand Down
2 changes: 2 additions & 0 deletions PowerEditor/src/Notepad_plus.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@ BEGIN
MENUITEM "ASN.1", IDM_LANG_ASN1
MENUITEM "ASP", IDM_LANG_ASP
MENUITEM "Assembly", IDM_LANG_ASM
MENUITEM "Assembly (65C02)", IDM_LANG_ASM_65C02
MENUITEM "AutoIt", IDM_LANG_AU3
MENUITEM "AviSynth", IDM_LANG_AVS
MENUITEM "BaanC", IDM_LANG_BAANC
Expand Down Expand Up @@ -1105,6 +1106,7 @@ BEGIN
MENUITEM "ASN.1", IDM_LANG_ASN1
MENUITEM "ASP", IDM_LANG_ASP
MENUITEM "Assembly", IDM_LANG_ASM
MENUITEM "Assembly (65C02)", IDM_LANG_ASM_65C02
MENUITEM "AutoIt", IDM_LANG_AU3
MENUITEM "AviSynth", IDM_LANG_AVS
END
Expand Down
3 changes: 3 additions & 0 deletions PowerEditor/src/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8160,6 +8160,9 @@ int NppParameters::langTypeToCommandID(LangType lt) const
case L_ERRORLIST:
id = IDM_LANG_ERRORLIST; break;

case L_ASM_65C02:
id = IDM_LANG_ASM_65C02; break;

case L_SEARCHRESULT :
id = -1; break;

Expand Down
8 changes: 6 additions & 2 deletions PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ LanguageNameInfo ScintillaEditView::_langNameInfoArray[L_EXTERNAL + 1] = {
{L"toml", L"TOML", L"Tom's Obvious Minimal Language file", L_TOML, "toml"},
{L"sas", L"SAS", L"SAS file", L_SAS, "sas"},
{L"errorlist", L"ErrorList", L"ErrorList", L_ERRORLIST, "errorlist"},
{L"asm65c02", L"Assembly (65C02)", L"WDC 65C02 assembly source file", L_ASM_65C02, "asm"},
{L"ext", L"External", L"External", L_EXTERNAL, "null"}
};

Expand Down Expand Up @@ -1817,7 +1818,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
{
if (getCurrentBuffer()->getUnicodeMode() == uni8Bit)
{
if (typeDoc == L_CSS || typeDoc == L_CAML || typeDoc == L_ASM || typeDoc == L_MATLAB)
if (typeDoc == L_CSS || typeDoc == L_CAML || typeDoc == L_ASM || typeDoc == L_ASM_65C02 || typeDoc == L_MATLAB)
execute(SCI_SETCODEPAGE, CP_ACP);
else
execute(SCI_SETCODEPAGE, _codepage);
Expand Down Expand Up @@ -1974,6 +1975,9 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
case L_ASM :
setAsmLexer(); break;

case L_ASM_65C02 :
setAsm65C02Lexer(); break;

case L_DIFF :
setDiffLexer(); break;

Expand Down Expand Up @@ -2474,7 +2478,7 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask)
if (isCJK())
{
LangType typeDoc = buffer->getLangType();
if (typeDoc == L_CSS || typeDoc == L_CAML || typeDoc == L_ASM || typeDoc == L_MATLAB)
if (typeDoc == L_CSS || typeDoc == L_CAML || typeDoc == L_ASM || typeDoc == L_ASM_65C02 || typeDoc == L_MATLAB)
enc = CP_ACP; //you may also want to set charsets here, not yet implemented
else
enc = _codepage;
Expand Down
7 changes: 7 additions & 0 deletions PowerEditor/src/ScintillaComponent/ScintillaEditView.h
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,13 @@ friend class Finder;
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.asm.comment.explicit"), reinterpret_cast<LPARAM>("1"));
}

void setAsm65C02Lexer(){
setLexer(L_ASM_65C02, LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6 | LIST_7);
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.asm.syntax.based"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.asm.comment.multiline"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.asm.comment.explicit"), reinterpret_cast<LPARAM>("1"));
}

void setDiffLexer(){
setLexer(L_DIFF, LIST_NONE);
}
Expand Down
18 changes: 18 additions & 0 deletions PowerEditor/src/langs.model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@
<!-- name="DIRECTIVES, FOLD CLOSE" Keywords that close a fold region; these must *also* be in the DIRECTIVES category -->
<Keywords name="type6">.endif .endsw end endp</Keywords>
</Language>
<Language name="asm65c02" ext="asm a65 s65" commentLine=";" commentStart="" commentEnd="">
<!-- CPU INSTRUCTION: W65C02S = NMOS 6502 + CMOS additions + WDC (WAI/STP) + Rockwell (SMB/RMB/BBR/BBS). LexAsm matches case-insensitive by default. -->
<Keywords name="instre1">adc and asl bcc bcs beq bit bmi bne bpl brk bvc bvs clc cld cli clv cmp cpx cpy dec dex dey eor inc inx iny jmp jsr lda ldx ldy lsr nop ora pha php pla plp rol ror rti rts sbc sec sed sei sta stx sty tax tay tsx txa txs tya bra phx phy plx ply stz trb tsb wai stp smb0 smb1 smb2 smb3 smb4 smb5 smb6 smb7 rmb0 rmb1 rmb2 rmb3 rmb4 rmb5 rmb6 rmb7 bbr0 bbr1 bbr2 bbr3 bbr4 bbr5 bbr6 bbr7 bbs0 bbs1 bbs2 bbs3 bbs4 bbs5 bbs6 bbs7</Keywords>
<!-- MATH INSTRUCTION: unused (no FPU on 65C02) -->
<Keywords name="instre2"></Keywords>
<!-- REGISTER -->
<Keywords name="type1">a x y s sp p pc</Keywords>
<!-- DIRECTIVE: WDC Assembler/Linker directives -->
<Keywords name="type2">equ db dw dd ds fill org chip endasm end include import export extern global public record macro mend mexit mlist mnolist if ifdef ifndef else elseif endif list nolist title subttl page lf clrlst radix code data bss udata dpage ipage</Keywords>
<!-- DIRECTIVE OPERAND: unused in v1 -->
<Keywords name="type3"></Keywords>
<!-- EXT INSTRUCTION: unused in v1 -->
<Keywords name="type4"></Keywords>
<!-- FOLD OPEN: must also appear in type2 -->
<Keywords name="type5">macro if ifdef ifndef</Keywords>
<!-- FOLD CLOSE: must also appear in type2 -->
<Keywords name="type6">mend endif</Keywords>
</Language>
<Language name="asn1" ext="mib" commentLine="" commentStart="" commentEnd="">
<Keywords name="instre1">ACCESS AGENT AUGMENTS BEGIN BITS CAPABILITIES CHOICE COMPLIANCE CONTACT CONVENTION DEFINITIONS DEFVAL DESCRIPTION DISPLAY END ENTERPRISE EXPORTS FALSE FROM GROUP GROUPS HINT IDENTITY IMPLIED IMPORTS INCLUDES INDEX INFO LAST MANDATORY MAX MIN MODULE NOTATION NOTIFICATION NULL OBJECTS OBJECT-TYPE OF ORGANIZATION PRODUCT RELEASE REFERENCE REQUIRES REVISION SEQUENCE SIZE STATUS SUPPORTS SYNTAX TEXTUAL TRAP TYPE TRAP-TYPE UPDATED VALUE VARIABLES VARIATION WRITE</Keywords>
<Keywords name="instre2">accessible create current deprecated for mandatory not notify not-accessible obsolete only optional read read-only read-write write</Keywords>
Expand Down
1 change: 1 addition & 0 deletions PowerEditor/src/menuCmdID.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@
#define IDM_LANG_TOML (IDM_LANG + 91)
#define IDM_LANG_SAS (IDM_LANG + 92)
#define IDM_LANG_ERRORLIST (IDM_LANG + 93)
#define IDM_LANG_ASM_65C02 (IDM_LANG + 94)

#define IDM_LANG_EXTERNAL (IDM_LANG + 165)
#define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 179)
Expand Down
16 changes: 16 additions & 0 deletions PowerEditor/src/stylers.model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@
<WordsStyle name="CHARACTER" styleID="12" fgColor="808000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="EXT INSTRUCTION" styleID="14" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="type4" />
</LexerType>
<LexerType name="asm65c02" desc="Assembly (65C02)" ext="">
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="NUMBER" styleID="2" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="STRING" styleID="3" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="OPERATOR" styleID="4" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="IDENTIFIER" styleID="5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="CPU INSTRUCTION" styleID="6" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="instre1" />
<WordsStyle name="MATH INSTRUCTION" styleID="7" fgColor="0080C0" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="instre2" />
<WordsStyle name="REGISTER" styleID="8" fgColor="8080FF" bgColor="FFFFCC" fontName="" fontStyle="1" fontSize="" keywordClass="type1" />
<WordsStyle name="DIRECTIVE" styleID="9" fgColor="0080FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" keywordClass="type2" />
<WordsStyle name="DIRECTIVE OPERAND" styleID="10" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="type3" />
<WordsStyle name="COMMENT BLOCK" styleID="11" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="CHARACTER" styleID="12" fgColor="808000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="EXT INSTRUCTION" styleID="14" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="type4" />
</LexerType>
<LexerType name="autoit" desc="AutoIt" ext="">
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="COMMENT LINE" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
Expand Down
Loading
Loading