I've attached an image containing some sample code on the left, and then some syntax highlighting on the right (just done by me, by hand, for sake of discussion).
I attempted to set up a TextEd highlighter last night for this, but ran into an issue immediately because there are not spaces separating things (though there can be).
For instance, it's not possible to define "G00" (4th line from the bottom above, in green) as keyword, as it's not separated from the "X" that follows. Defining "X" as a "symbol" for use as a word separator is not really an option...
In the example, some key/value pairs have specific meaning. In that case, I've colorized them in green or pink (two different categories). In other cases, the value portion of a key/value pair is a coordinate in space, so it's unpredictable. For instance, the "31.1605" on the last line. Usually, X, Y, I, and J are associated with coordinate values, so I'd like to just pick them off on their own for visibility, while leaving the value just the standard text color.
The main challenge for a highlighter is to be able to pick off defined "words" without requiring white space separators. Also, it would need to be able to determine the difference between (for instance) "M10" and "M101". That is, it wouldn't be correct to "colorize" the "M10" portion of "M101" and leave the trailing 1 all by itself.
This type of code is fairly easy to pick apart using simple regular expressions, which might add a lot of power to TextEd's syntax highlighting. For instance, all key/value pairs in the file can be picked off using something like this:
Code: Select all
[A-Z]+[0-9.\-]+
Code: Select all
M[0-9]+
Thanks,
Jeff