Ron Aaron wrote:

> AFAICT, the syntax highlighting engine operates solely by means of regex 
> matches. That's fine as far as it goes, but one of my users has implemented 
> a more useful kind of syntax highlighting in "VSCode" for my "8th" language.
> 
> Essentially, in 8th (as in most Forths), you can be in either "interpret" 
> or "compile" mode, and some words (functions) are illegal in one or the 
> other modes.  It is very useful to be able to flag such a case in the 
> editor, to alert the programmer of a likely error.
> 
> So, for example, the word "if" is illegal in 8th, in 'interpret' mode.
> 
> There are a few words which signal that the mode is 'compile' and a few 
> others which turn it off.
> 
> Is there a reasonable way to get the vim syntax highlighter to recognize 
> this kind of situation?

Probably the simplest is to recognize all the syntax items, and then
only define highlighting for what you want to see.  You could provide a
user command to switch between states.

To still allow for user defined highlighting, you would add or remove
links with "hi link MyLangItem DoHighlight" and "hi link MyLangItem
NONE".

-- 
You know you use Vim too much when you have this alias in your
~/.bashrc file: alias :e=/bin/vim             (Eljay Love-Jensen)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909271132.x8RBWlwS016366%40masaka.moolenaar.net.

Raspunde prin e-mail lui