Robot Framework syntax coloring for Nano

Yeah, go ahead and make fun, but Nano is a handy, simple editor.

So - does anyone know of a *.nanorc for Robot Framework?

Nano is a handy So true.

Though I often use nano, I didn’t know nano could do syntax colouring. I agree this would be useful :+1:t3:

Dave.

Because I use Nano enough cross-platform, I created a Gist for it.

Let me know what you think!

P.S. I’ll add Linux info if there’s enough interest, but generally I’ve found most Linux distros come with “batteries included” so probably no need.

1 Like

@GLMeece

it seems that Nano does a simple regex based syntax highlighting.

Some years ago i improved a pretty basic syntax highlighting file for TextMate highlighting that was then used by Language Server.
Back in these days, LSP did not support semantic syntax highlighting so we needed also that “static” regex based thing.

Maybe you can dig out some of the regexes that helps you create an own one.
And then you may want to contribute to GitHub - scopatz/nanorc: Improved Nano Syntax Highlighting Files a robot highlighter?

if you want to test a regex, i can recommend regex101.com .

2 Likes

For example this is a more or less ok working regex for variables.

(?i)(?:(?:(?<!^)(?<!\\)|(?<=\\\\))([$@&%]\{)(?:((?:\d+\.?\d*)|(?:0x[\/da-f]+)|(?:0o[0-7]+)|(?:0b[01]+))|(true|false|none|null|empty|space|\/|:|\\n)|((.+?}*)))(\})(?:(\[)(?:(\d+)|(.*?))?(\]))?)

be aware that in json \ (balckslashes) are written as double backslashes \\ .

1 Like