Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
enorris
Visitor

Syntax highlighting plugins? Standalone parser?

I haven't been able to find Eclipse or IntelliJ plugins for BrightScript syntax highlighting or parsing. Visual Studio can do syntax highlighting (Tools | Options | Text Editor | File Extension | then assign brs to Visual Basic) but not validation as far as I can tell.

Alternately, is there another way to check program correctness (syntax, behavior, whatever) short of downloading it to the device and running it?
0 Kudos
9 REPLIES 9
MarkRoddy
Visitor

Re: Syntax highlighting plugins? Standalone parser?

"enorris" wrote:
I haven't been able to find Eclipse or IntelliJ plugins for BrightScript syntax highlighting or parsing. Visual Studio can do syntax highlighting (Tools | Options | Text Editor | File Extension | then assign brs to Visual Basic) but not validation as far as I can tell.

Alternately, is there another way to check program correctness (syntax, behavior, whatever) short of downloading it to the device and running it?


It may not be of interest to you, but I have a basic emacs major mode that does syntax highlighting.

-Mark
0 Kudos
calicommando
Visitor

Re: Syntax highlighting plugins? Standalone parser?

"MarkRoddy" wrote:
"enorris" wrote:
I haven't been able to find Eclipse or IntelliJ plugins for BrightScript syntax highlighting or parsing. Visual Studio can do syntax highlighting (Tools | Options | Text Editor | File Extension | then assign brs to Visual Basic) but not validation as far as I can tell.

Alternately, is there another way to check program correctness (syntax, behavior, whatever) short of downloading it to the device and running it?


It may not be of interest to you, but I have a basic emacs major mode that does syntax highlighting.

-Mark


Mark, that greatly interests me. Can I get that?
0 Kudos
MarkRoddy
Visitor

Re: Syntax highlighting plugins? Standalone parser?

"calicommando" wrote:
"MarkRoddy" wrote:
"enorris" wrote:
I haven't been able to find Eclipse or IntelliJ plugins for BrightScript syntax highlighting or parsing. Visual Studio can do syntax highlighting (Tools | Options | Text Editor | File Extension | then assign brs to Visual Basic) but not validation as far as I can tell.

Alternately, is there another way to check program correctness (syntax, behavior, whatever) short of downloading it to the device and running it?


It may not be of interest to you, but I have a basic emacs major mode that does syntax highlighting.

-Mark


Mark, that greatly interests me. Can I get that?


I posted it here:
http://dibon.homelinux.org/~mark/brightscript-mode.el

A few caveats:
* So far I've only added keyword and built-in function highlighting.
* Comments are sorta kinda handled but not really.
* Except for comments starting with "Rem", these aren't handled at all.
* I'm an amateur elisp hacker at best, if some of the code looks silly it probably is.

That aside, I find it way easier to work with keywords (function/sub, if/then/else, etc) highlighted as it feels like one giant blob of text otherwise. If I have time in the future, I'd like to add smarter syntax handling so I'm not constantly fudging with my indents as well as a few other niceties, but who knows if I'll ever get around to that.

-Mark
0 Kudos
calicommando
Visitor

Re: Syntax highlighting plugins? Standalone parser?

Thank you.
0 Kudos
enorris
Visitor

Re: Syntax highlighting plugins? Standalone parser?

MarkRoddy: Thanks for the emacs link.

The lack of a non-Roku test environment reminds me of writing VBScript for InstallShield - since IS runs the script inside its own custom context, you had to perform an actual install to test the code. PITB.
0 Kudos
MarkRoddy
Visitor

Re: Syntax highlighting plugins? Standalone parser?

@enorris We use Nullsoft NSIS for installers at my job. I cringe whenever we have to change them. So many junk installs on my workstation from debugging them.

I have been toying with the idea of writing a BrightScript interpreter or maybe just a parser to find syntax errors which could be hooked up to emac's flymake-mode to highlight errors. I'm not yet sure that the it makes sense from a cost/benefit standpoint (lot of work and would it really help that much comparitably?).

In the mean time you might want to check out the testing library I released last week. While it's not as convenient as locally running interpreter, I find it's a much easier way to work since I can write tests for the logic of an app, push changes to my box, and immediately the results of the tests instead of having to push out the changes and click through each UI element every time to see if I broke anything.
http://code.google.com/p/brstest/

-Mark
0 Kudos
MarkRoddy
Visitor

Re: Syntax highlighting plugins? Standalone parser?

I was planning on spending this weekend adding a few new features to the testing framework I release last week, but when I got home from work last night I discovered that my box was quite dead. I've filed a support request, but until it's resolved I'm not going to be able to work on any brightscript coding as I do not have access to a box to deploy it to in the interm.

Sounds like a good of a time as any to work on a parser. I'm going to try to throw together a simple syntax parser that could be hooked up to emacs' flymake-mode. No where near a stand alone runtime (which would be awesome), but a step in that direction and a useful tool in and of itself. If I have anything interesting together and anyone is interested in a flymake-mode for brightscript I'll post it online.

-Mark
0 Kudos
kc8pql
Visitor

Re: Syntax highlighting plugins? Standalone parser?

"MarkRoddy" wrote:
...but when I got home from work last night I discovered that my box was quite dead.

You may want to check the power supply. They have a history of going bad. If you have one that matches, you may be able to swap it out and be back in business.
____________________________________________________________________________________________________________
No, I don't work for Roku.
Netflix Player N1000X, XDS 2100X (premature death by lightning)
Roku2 XD 3050X, Roku2 XS 3100R, Roku2 4210R
0 Kudos
MarkRoddy
Visitor

Re: Syntax highlighting plugins? Standalone parser?

"kc8pql" wrote:
"MarkRoddy" wrote:
...but when I got home from work last night I discovered that my box was quite dead.

You may want to check the power supply. They have a history of going bad. If you have one that matches, you may be able to swap it out and be back in business.


Thanks, I contacted Roku tech support, and that was one of the things they suggested I try. Unfortunately I don't have a comparable adapter so I have to pick one up.

-Mark
0 Kudos