I want to fold sections of the following Z80 assembly excerpt correctly, but I can't get it done:
.ORG $9D93
.DB t2ByteTok, tAsmCmp
Increase:
LD A, B
CP 255
JR Z, KeyLoop
INC B
JR Display
Decrease:
LD A, B
CP 0
JR Z, KeyLoop
DEC B
JR Display
.END
In this excerpt, three folding regions should be created:
Two problems with that:
Please understand that folding is designed to work with pair constructs. Construct
If (a)
|
| If (b)
| |
| | Print
| |
| End If
|
End If
will fold as expected but in your case the evaluation is:
.ORG $9D93
| .DB t2ByteTok, tAsmCmp
|
| Increase:
| | LD A, B
| | CP 255
| | JR Z, KeyLoop
| | INC B
| | JR Display
| |
| ? (NO MATCH)
|
| Decrease:
| | LD A, B
| | CP 0
| | JR Z, KeyLoop
| | DEC B
| | JR Display
| |
| ? (NO MATCH)
|
.END
Although this is not what you want to achieve, try adding .END this way and you will see all 3 foldings work as expected:
.ORG $9D93
| .DB t2ByteTok, tAsmCmp
|
| Increase:
| | LD A, B
| | CP 255
| | JR Z, KeyLoop
| | INC B
| | JR Display
| .END
|
| Decrease:
| | LD A, B
| | CP 0
| | JR Z, KeyLoop
| | DEC B
| | JR Display
| .END
|
.END
As far as I understand UDL in Notepad++, folding in style suggested in your question is not achievable via UDL. Perhaps it might work in built-in N++ languages which are not bound with simplified UDL logic. For your information UDL is kept simplified intentionally to keep UI and logic manageable for most of people. (I'm not going to search where I recently read it, so sorry for not linking to source of last sentence.)
Checking inner workings of N++, you might be able to add your own built-in language (not UDL) which will comply with your requirement.
EDIT: I've found this comment recently: Consider another text editor, SynWrite, which can have lexer of much more flexibility. Just read the lexer tutorials in Synw Readme. – Alextp Oct 25 '13 at 19:46