Hi all,
I just created a PR to add SuperCollider. It was pretty easy. I'm trying to add the
MUMPS language, but this language has a ton of quirks that I'm finding very hard to write regexes for.
Here are some example issues:
- All keywords and built_ins are case independent, but everything else in the language is case dependent. For syntax coloring this has only one implication I can see: 1e3 is read as a number whereas only 1E3 is a number. This is pretty minor.
- All keywords can be abbreviated to a single character, so "if" is valid but so is "i" (and the latter is actually more idiomatic)
- Function definitions (which are really just goto tags) are defined as /^[%a-zA-Z0-9]+/, but NOT if their name conflicts with a keyword. So "hiThere" is a function by "h" is a keyword.
- Here's the really brutal one - there are no reserved keywords in MUMPS. All commands are interpreted based on whitespace context. In the following examples I'll use an underscore to represent a space and bold to represent something that should be a keyword:
- i_i_s_i=s
- .__f__s:i_d
- d_d
- d__d
The best way I think of expressing the last two is using lookarounds, but:
1. Lookbehinds aren't supported in JS
2. It's a bit unclear to me how lookaheads affect highlightjs. It looks like they are captured by the "begin" or "end" regexps.
For what it's worth - yes I agree that this language has one of the stupidest syntaxes I've ever seen.