I'm trying to put together a syntax coloring scheme for the M4 macro language. Keywords are easy, as are comments and a couple other items that user defined words accommodate. Where I'm running it to some issues is the strings. M4 uses (by default, at least) the ` character (back quote?) as the leading quoting character, and the ' characters (quote) as the trailing quoting character. It also permits effectively infinite nesting of strings, across multiple lines. What would be absolutely ideal is to be able to see the full quoted string with the nested sub-strings somehow also indicated, but that strikes me as somewhat difficult. Failing that, it would be useful to be able to highlight the open quote and close quote by color, perhaps using different colors. What I tried was to define the open quote as a user-defined 1 word, and close quote as a user-defined 2 word, with nothing entered for the string or literal settings. This works well for the open quote, but only sporadically for the close quote. Is there an alternative way?
Another possibility would be to use BraceMatching, but I don't see any way to tell it about open and close quoting.
I'm considering developing a macro that highlights the string on request - am I correct that the only means I have of highlighting is to mark the text?
Bill Diener
Question about syntax coloring
Any syntax highlighting that uses information from multiple lines can only be catered for by special code built into to the syntax highlighter and generally these options can not be user configured.It also permits effectively infinite nesting of strings, across multiple lines.
For multi-line syntax highlighting the currently available options are the two block comments and the Python triple quotes options.
When it comes to string quotes the logic is also hard coded into the syntax highlighter. There rules for strings are fairly simple:Is there an alternative way?
- Is the current character any of the characters defined as a string?
- If the answer is no then we are done.
- If the answer is yes then search for the next character that matches the current character ignoring any characters that are delimited.
The brace matching characters are defined in the Templates section of the document type.Another possibility would be to use BraceMatching, but I don't see any way to tell it about open and close quoting.
I'm not sure if there is a lot you can do via the scripting layerI'm considering developing a macro that highlights the string on request - am I correct that the only means I have of highlighting is to mark the text?

Cheers Jussi
Based on the code you posted in your bug report:Is there an alternative way?
Code: Select all
define(`procdivarglist', `ifelse(`$#', `0', , `$#', `1', ``$1'', ``$1'
procdivarglist(shift($@))')')dnl
I would say the only other option is to define a keyword pattern that looks like this: `*'
But you would also need to remove the `$#' characters as delimiters.
Cheers Jussi