[Geany] filedefs.asm for mips isa

Jason Oster parasytic at xxxxx
Thu Oct 9 17:56:30 UTC 2008


Enrico Tröger wrote:
> On Tue, 7 Oct 2008 12:44:53 +0100, Nick Treleaven
> <nick.treleaven at btinternet.com> wrote:
> 
>> On Sun, 5 Oct 2008 16:02:57 -0700
>> Jason Oster <parasytic at gmail.com> wrote:
>>
>>> Unfortunately, the ASM lexer in Scintilla does not support  
>>> customizable comments. But you can make a modification to add # as
>>> a comment char. It's in LexASM.cxx
>> line 150, scintilla/LexASM.cxx:
>> if (sc.ch == ';'){
>>
>> change to:
>> if (sc.ch == '#'){
>>
>> Really the Scintilla ASM lexer could be improved to have a
>> customizable comment char property and also a label style.
> 
> Maybe 
> if (sc.ch == '#' || sc.ch == ';'){
> 
> would be enough for now?
> I don't know any ASM very well, but are there many more comment
> characters used besides route and semicolon?
> If it would be enough, we sould send a patch to Scintilla.
> No idea about the label style.

It's a good idea to patch the ASM lexer, since it is not generic enough 
to support all ASM dialects. (Which I think was the original intent?)

# and ; characters are widely used for ASM comments, but also C/C++ 
style // and /*...*/ comments are common, too. I have seen cases where @ 
characters are used as comments, but also cases where @ characters are 
used for special pseudo-operands! Obviously, not all comment characters 
should be hard-coded into the lexer, but maybe they should be made 
customizable.

This would be easy for single comment characters and C++-style // 
comments by adding a new keywords field. For C-style /*...*/ comments, I 
think a lexer pref to enable/disable multi-line comments is the way to go.

I'm sure I could hack these features in when I get home today. Oh, and 
label styles, too. (If I can remember to do it!)

> Jason now has some experience in adding properties to Scintilla lexers,
> don't you?   :-)

Yep. ;)


A few other things to think about with ASM syntaxes, which may or may 
not be within the scope of this discussion:

Number styling could use some work I think, since there are many ways to 
specify numbers among languages. For example, MOS 6502/65816 uses $... 
to specify hex numbers, where most others use 0x... or even ...h

BUT, MIPS ASM (which is where this discussion comes from) can use $... 
to specify registers! Common MIPS register syntaxes include:

$0, r0, zero, $zero ...
$1, a0, $a0 ...

etc.

So is $a0 a register (MIPS) or a hex number (MOS 6502/6581)? I think 
these need to be made more generic, too. ;)

Jay



More information about the Users mailing list