jEdit Community - Resources for users of the jEdit Text Editor
partially case-sensitive mode file?
Submitted by SpiceWare on Saturday, 4 October, 2014 - 18:22

When writing code for the Atari 2600 I use the compiler dasm.

With dasm, the opcodes are case-insensitive so LDA can be written as LDA, lda, Lda, etc. As such, I've set the mode file to use <RULES IGNORE_CASE="TRUE">.

I've configured the mode file so the 2600's registers such as GRP0, which holds sprite0's shape for the current scanline*, get syntax highlighted. However, dasm is case-sensitive when it comes to variable names. As such, if I type grp0 into my source code the compile will fail.

As such, I'd like to be able to make some of the keywords case-sensitive even though most of them are not. Can this be done with jEdit? My current mode file, assembly-6502, can be found here. I'm planning to do an update soon and will be renaming it Atari 2600 Assembly as the mode file's not really for generic 6502 assembly language.

* Yep, just the current scanline. When the Atari 2600 was developed memory was extremely expensive, so much so that the 2600 only contains 128 bytes of RAM. So TIA, the video chip, was designed to be scanline based. This means the registers in TIA only contain enough information to draw a single scanline, so your code must update TIA's registers on each and every scanline in order to draw the screen the player sees.

Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
delegate
by Robert Schwenn on Sun, 05/10/2014 - 11:52
Not sure. Maybe an approach could be to recognize the keywords case-insensitive and DELEGATE it to another rule set. For example see java.xml.
 
I've used a delegate to color
by SpiceWare on Sun, 05/10/2014 - 17:54

I've used a delegate to colorize binary numbers, it makes the graphic data stored in byte statements really stand out - see the third screen shot in this post at AtariAge.

        <SPAN_REGEXP
            TYPE="OPERATOR"
            HASH_CHAR="%"
            AT_WORD_START="TRUE"
            DELEGATE="COLORIZE_BINARY">
                <BEGIN>%</BEGIN>
                <END REGEXP="TRUE">\B</END>
        </SPAN_REGEXP>
...

    <RULES SET="COLORIZE_BINARY">
        <SEQ TYPE="INVALID">1</SEQ>
        <SEQ TYPE="DIGIT">0</SEQ>
    </RULES>

I'd tried to use a delegate for case-sensitive keywords, but as far as I can tell, you need to key in on a "starting value", such as the % prefix for binary numbers, but that value does not get delegated.

 
First, I'm not sure that HASH
by Robert Schwenn on Sun, 05/10/2014 - 19:26
First, I'm not sure that HASH_CHAR is really always needed or only for improving performance.

Secend, I'm using SPAN_REGEXP with HASH_CHAR (without DELEGATE) and the whole span inclusive hash character is highlited as one token.
So, maybe it would be worth to give a try the DELEGATE, too. I would expect to be the whole token to be delegated.
 
Tried a bunch of things but n
by SpiceWare on Tue, 07/10/2014 - 15:45
Tried a bunch of things but no luck. The token, that was identified by the rule which defers to the delegate, does not get passed on to the delegate.

I need to work up a presentation on Atari Homebrew development that I'm giving next month, so I'm going to put my jEdit research on the back burner for now.

Thanks for the help!
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293