Bro script spacing

Hello,

I hear there is a "style/format" for spacing syntax in bro scripts. Where can I become familiar with this?

JP

I hear there is a "style/format" for spacing syntax in bro scripts. Where can I become familiar with this?

The indentation is called Whitesmiths style [1]. We currently don't
have an exact guideline, for example like Google's style guide [2].
Maybe some editors have the ability to explicitly set a style. At
least in Vim, you can use this:

     autocmd FileType bro set noexpandtab cino='>1s,f1s,{1s'

This gives you reasonably close support for brace placement. (It also
assumes you have a Bro syntax plugin.)

I'm curious how others have tweaked their editors, not for syntax
highlighting, but to get an efficient and style-compatible working
environment.

     Matthias

[1] Indentation style - Wikipedia
[2] GitHub - google/styleguide: Style guides for Google-originated open-source projects

Btw, I'd very much like to have a "formatting mode" in Bro that
reformats a given script into a standard style. We could then run that
consistently over all the standard scripts, and users could use it
adapt their own ones accordingly. Should actually not be too hard to
implement for somebody who's a bit familiar with C++.

Robin

I could have sworn someone has made an emacs mode for Bro scripts and posted that to the list once.

Yes, Scott did it.

https://github.com/srunnels/bro-mode

That was me. http://github.com/srunnels/bro-mode

It needs some work to catch up to some of the new changes though.

If Bro wants to make it’s official stance “just use emacs”, hey I’m totally in! :slight_smile:

Mathias,

Thanks man! This makes sense - I wonder is Seth or someone has a trick to get this work in Sublime Text - I’ll try and find one myself and post it if I can.

JP

Courtesy of being pointed out by Chris Crawford:

http://liamrandall.com/syntax-highlighting-for-bro-network-programming-language/
http://www.appliednsm.com/syntax-highlighting-for-bro-for-nano/

Also:
https://dl.dropboxusercontent.com/u/4303535/Screencasts/bro-mode.mpg

Charles “Chuck” A. Fair
charles.fair@mac.com

I just deal with it manually in sublime text. I've been meaning to fix my Bro support for textmate and sublimetext *forever* to make it work correctly.

  .Seth