I am wrapping my head around the question whether it is possible to create a custom syntax highlighting using the new .sublime-syntax definitions for the IBM High-Level Assembler (HLASM), a computer programming language still widely used on Mainframes today. The language stems from a time where the code lines were stored on punched cards of 80 characters width and therefore have some rather obscure properties from today’s point of view.
Problem:
When there is any character in column 72, then the contents of the next line must be matched as if both were concatenated in one line. This can be repeated, i.e. a continuation line may also have a line-continuation character in position 72, so that the continuation line continues on the next line, and so on…
Additional Problems:
-
There might be characters after the line-continuation character (e.g. usually a so called sequence number of 8 digits), that should be highlighted differently as they are discarded by the assembler.
-
Any characters in a continuation line before column 16 should also be highlighted differently, as they are also discarded by the assembler.
-
Characters in the continuation-column should be highlighted differently.
Each line consists of the following entries separated by one or more blanks (the entries themselves may not contain any blanks, except in strings):
[name] operation operand(s) [remark]
The name and remark entries are optional. The operand(s) are sometimes optional too.
From my point of view it should be possbile to get a rather basic highlighting done, which would consist of the four contexts name, operation, operand, and remark. Each of them would consume one character at a time unless it is in column 72 or a blank. A blank would move to the next context. A line-continuation would eat up all character until the next line, all characters until column 16, and then continue the current context.
But if I would want to have some more sothisticated solution, where the operands are highlighted differently based on the content, then I see problems how to achive that (i.e. a regular expression that consumes more than one character but must not consume any character past column 71 - not to speak about that it may continue on the next line on column 16).
I am still waiting for a ST3 beta that supports the .sublime-syntax to give my basic ide a try.
Thanks in advance, greetings from Stuttgart, Germany,
Jens
