Syntax highlighter for pasm in Sublime Text 3

113 views
Skip to first unread message

Justin Pearson

unread,
Jan 20, 2017, 7:52:18 PM1/20/17
to BeagleBoard
I'm programming the BBB's PRU in pasm. Does anyone know how I can get Sublime Text to color the code (syntax highlight)?

I cross-posted here:


Thanks.
-Justin

TJF

unread,
Jan 21, 2017, 1:25:46 PM1/21/17
to BeagleBoard
Hi!

I don't know SublimeText and can't help on topic. But in addition to the TI configurations, I can provide pasm highlighting for Geany IDE, if you're interested.

Regards

William Hermans

unread,
Jan 21, 2017, 3:37:23 PM1/21/17
to beagl...@googlegroups.com
You can write your own syntax highlighter for Sublime Text3. I say this, because I've never seen any assembly language highlighting for Sublime text period. And yes, I do use Sublime text myself( for the last 4-5 years ). You might try using C highlighting, to see if the standard C highlighting also highlights inline assembly. But that's doubtful.

I was looking a while back for something similar, and the only thing I found was someone on parallax's forum's talking about having writen a syntax highlighter for Visual Studio Code( not to be confused with the Visual studio IDE ) and the p2asm language. Maybe It's possible to adapt that, or in a pinch just use it in code. I've been using VSC myself recently a lot for javascript, C, and C++. It's not a bad text editor at all.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/b9fad1cd-8d55-42d6-96b9-8bd0b48a4417%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Justin Pearson

unread,
Jan 23, 2017, 8:59:35 PM1/23/17
to beagl...@googlegroups.com
Thanks William & TJF. Following your advice I wrote my own syntax
highlighting file for pasm (for Sublime Text 3):

https://github.com/justinpearson/pasm-sublime-text-syntax-highlight

Best,
Justin

On Sat, Jan 21, 2017 at 12:37 PM, William Hermans <yyr...@gmail.com> wrote:
> You can write your own syntax highlighter for Sublime Text3. I say this,
> because I've never seen any assembly language highlighting for Sublime text
> period. And yes, I do use Sublime text myself( for the last 4-5 years ). You
> might try using C highlighting, to see if the standard C highlighting also
> highlights inline assembly. But that's doubtful.
>
> I was looking a while back for something similar, and the only thing I found
> was someone on parallax's forum's talking about having writen a syntax
> highlighter for Visual Studio Code( not to be confused with the Visual
> studio IDE ) and the p2asm language. Maybe It's possible to adapt that, or
> in a pinch just use it in code. I've been using VSC myself recently a lot
> for javascript, C, and C++. It's not a bad text editor at all.
>
> On Sat, Jan 21, 2017 at 11:25 AM, TJF <jeli.f...@gmail.com> wrote:
>>
>> Hi!
>>
>> I don't know SublimeText and can't help on topic. But in addition to the
>> TI configurations, I can provide pasm highlighting for Geany IDE, if you're
>> interested.
>>
>> Regards
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to beagleboard...@googlegroups.com.
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/n2DJLpMNcl0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> beagleboard...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/CALHSORoH7KRZYZOMz7OxpiwToprMevi-7%3D%3DJu%2BNdgmvqpbQuSA%40mail.gmail.com.

William Hermans

unread,
Jan 24, 2017, 4:35:39 AM1/24/17
to beagl...@googlegroups.com
On Mon, Jan 23, 2017 at 6:59 PM, Justin Pearson <justin....@gmail.com> wrote:
>
> Thanks William & TJF. Following your advice I wrote my own syntax
> highlighting file for pasm (for Sublime Text 3):
>
> https://github.com/justinpearson/pasm-sublime-text-syntax-highlight
>
> Best,
> Justin

Awesome !

Justin Pearson

unread,
Jan 24, 2017, 11:54:04 AM1/24/17
to BeagleBoard
On Saturday, January 21, 2017 at 10:25:46 AM UTC-8, TJF wrote:
I don't know SublimeText and can't help on topic. But in addition to the TI configurations, I can provide pasm highlighting for Geany IDE, if you're interested.

TJF, would you post your pasm highlighter for Geany?

Thanks,
Justin

Justin Pearson

unread,
Jan 24, 2017, 12:29:59 PM1/24/17
to BeagleBoard
On Tuesday, January 24, 2017 at 1:35:39 AM UTC-8, William Hermans wrote:
> syntax highlighting file for pasm (for Sublime Text 3):
>
> https://github.com/justinpearson/pasm-sublime-text-syntax-highlight

Awesome ! 

BTW, I tried to add a link to this pasm syntax highlighter to the official TI pasm wiki page:


... but I got an "Access Denied" error.

-Justin 

TJF

unread,
Jan 24, 2017, 5:02:33 PM1/24/17
to BeagleBoard


Am Dienstag, 24. Januar 2017 17:54:04 UTC+1 schrieb Justin Pearson:
TJF, would you post your pasm highlighter for Geany?

Here you are:

# For complete documentation of this file, please see Geany's main documentation

[styling]
# foreground;background;bold;italic
default=0x900000;0xffffff;false;false
comment
=0x808080;0xffffff;false;false
number
=0x007f00;0xffffff;false;false
string=0xff901e;0xffffff;false;false
operator=0x000000;0xffffff;false;false
identifier
=0x880000;0xffffff;false;false
cpuinstruction
=0x111199;0xffffff;false;false
mathinstruction
=0x7f0000;0xffffff;false;false
register=0x000000;0xffffff;false;false
directive
=0x3d670f;0xffffff;false;false
directiveoperand
=0xff901e;0xffffff;false;false
commentblock
=0x808080;0xffffff;false;false
character
=0xff901e;0xffffff;false;false
stringeol
=0x000000;0xe0c0e0;false;false
extinstruction
=0x007f7f;0xffffff;false;false

[keywords]
# all items must be in one line
instructions
=add adc sub suc rsb rsc lsl lsr and or xor not min max clr set scan lmbd mov ldi mvi lbbo sbbo lbco sbco lfc stc zero jmp jal call ret qbgt qbge qblt qble qbeq qbne qba qbbs qbbc wbs wbc halt slp loop fill
registers
=c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31
directives
=.origin .entrypoint .setcallreg .struct .ends .u32 .u16 .u8 .assign .enter .leave .using .macro .mparam .endm
Extended instructions=#define #else #endif #if #ifdef #ifndef #include #elseif #error #note #warn

[settings]
# default extension used when saving files
extension
=p

# single comments, like # in this file
comment_single
=//

# This setting works only for single line comments
comment_use_indent
=true

lexer_filetype
=ASM

# context action command (please see Geany's main documentation for details)
context_action_cmd
=

[indentation]
width
=2
# 0 is spaces, 1 is tabs, 2 is tab & spaces
type
=0

[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler
=pasm_2 -b -y "%f"

File lives in geany/filedefs/filetypes.pasm.conf.

Regards

 

Justin Pearson

unread,
Jan 25, 2017, 1:01:50 PM1/25/17
to beagl...@googlegroups.com
Thanks TJF. Geany does syntax-highlighting a lot more simply than Sublime Text. In ST you don't pick the colors for keywords; instead, you use regexps to assign semantic meaning to certain strings, like a string matching "\b[0-9]+\b" (a number) is assigned type "constant.numeric" whereas a string matching "\b[rR]\d\d?\b" (a register) is assigned type "storage". Depending on the ST "theme" you're using, those types get colored differently. 

What a complicated world!

-Justin

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/n2DJLpMNcl0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/30ada836-4ba3-4e62-9174-ab489e592698%40googlegroups.com.

TJF

unread,
Jan 25, 2017, 1:42:03 PM1/25/17
to BeagleBoard
This file does more than highlighting definitions. Ie. you can configure compiler commands or set some default custom commands for the specified file type.

For color declaration there's a similar system in Geany. You can define named colors in the file filetypes.common and then use those names instead of a fixed setting (I'm not sure why I used the fixed setting here).

One reason why I use Geany is that it scrolls much faster than editors based on regex lexers.

Regards
Reply all
Reply to author
Forward
0 new messages