Goodies 2: Calculation Syntax Coloring

MBS Plugin can colorize the calculations on macOS.

When you type calculations, we can apply our rules to color the calculations. This includes rules to give functions a color, brackets a color, numbers a color and quoted text a color. You can even set colors for local variables and global variables in general and specific variables with specific colors. Some for function names, so you can define a general color for functions and give your special functions an unique color. Than if you misspell a function name, you notice right away.

If you have brackets set incorrectly, we highlight the wrong brackets in red. This is super useful to find where a bracket closing is needed.

Wildcards

You can pass wild cards for formula coloring with SyntaxColoring.AddTag function. Just define a tag with stars on beginning and end to get that color rule applied on the end over all other rules:

MBS( "SyntaxColoring.AddTag"; "formula"; "*deprecated*"; "red" )

This rule would mark everything with deprecated in a formula text with red color. Great if you have fields you want to get rid off. Rename the field to have deprecated in the name and then walk your way through calculations to easily spot the field name.

We got a new way to color comments in calculations. When we detect a comment with // or /* in your calculation, we can pick up the first word after that and lookup if a special color is defined. We look first in formula colors and then in script step colors for this with the # prefix. For example you may define a generic comment color. Then maybe define a few more special colors like one for #todo, another one for #fixme or one for #warning.

We hope those coloring options help you. Check the new fmSyntaxColorizer for a clever GUI to setup all the options or do it yourself via our SyntaxColoring functions.

Brackets Highlighting

MBS Plugin in version 10.5 is available and you can try our bracket highlighting for macOS:

For macOS we added a new feature to the calculation dialog to highlight matching brackets. If you put the cursor on a square, curly or regular bracket, the plugin looks for the matching bracket and provides a blue background for both. This usually ignores quoted text, except if your selection is within quoted text. Then we look for brackets in this text to help with e.g. SQL commands.

You can turn this on or off in the preferences dialog. As usual, those function can be configured in script via SyntaxColoring.ShowBracketPositions.SetEnabled function.


Script Coloring 2 Search script