[TxMt] Assembly language patterns

Edward K. Chew ekchew at gmail.com
Sat Apr 5 17:03:47 UTC 2008


On 5-Apr-08, at 10:24 AM, Gerd Knops wrote:
>
> On Apr 5, 2008, at 8:36 AM, Edward K. Chew wrote:
>> On 5-Apr-08, at 9:08 AM, Luke Daley wrote:
>>>
>>> Hi Ted,
>>>
>>> There is a page in the manual on this.
>>>
>>> http://macromates.com/textmate/manual/language_grammars#naming_conventions
>>>
>>> LD.
>>
>> Thanks, Luke.  I have looked at that page, and the existing  
>> conventions seem to cater mostly to compiled or scripted  
>> languages.  Assembly languages are certainly varied, but do tend to  
>> share some common elements that could use their own naming scheme.
>>
> I had the same experience when adding a language definition for SX  
> uC assembler. And if you make up your own, downside is that you will  
> also need to add syntax highlighting to all themes you use.
>
> Since I am not intending of making mine public, I kind of went  
> backwards: In the preferences I looked how the various scopes were  
> highlighted, and picked based on that, adding ".assembler" to all. I  
> still had to make up a few to get the highlighting balanced. I am  
> sure the language police would object strongly, but it works fine  
> for my purposes.

Okay, well it sounds like there is no real consensus on assembly.  I  
guess I'll stick with what I've got, then, which currently looks like  
this:

meta.preprocessor.directive.assembly.Asm96002: assembler directives  
(e.g. dcb: define byte-level storage)
meta.preprocessor.function.assembly.Asm96002: functions evaluated at  
assemble-time (e.g. @cvs: convert memory space)
keyword.other.opcode.assembly.Asm96002: processor instructions (e.g.  
bclr: test and clear one bit)
variable.language.register.assembly.Asm96002: internal registers and  
their sub-fields
constant.numeric.assembly.Asm96002
string.quoted.single.assembly.Asm96002
comment.line.assembly.Asm96002

Here is an example of how it looks in the Mac Classic theme:



(Aside: I couldn't find any way to copy or save text with the  
formatting preserved and had to resort to a screen dump.  I guess I'll  
have to add rtf export to my wish list, along with multi-window  
projects, split views, and print selection.)

I have yet to decide what (if anything) to do with user-defined  
symbols. Should I try to distinguish between equates (constants),  
functions, and storage variables? That could be difficult. Maybe I'll  
cop out and come up with something generic like "label" that covers  
everything.

-Ted

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20080405/51300845/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asmsnapshot.png
Type: image/png
Size: 42056 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20080405/51300845/attachment.png>


More information about the textmate mailing list