Translate simple formal grammar to vim syntax
I want to write bison
syntax file for vim
. I've managed to write syntax rule for definition section. Now I'm trying to compose syntax rule for bison
rule. So, I have
rule : identifier ":" rightHandSidePart ( "|" rightHandSidePart )* ";"
where
rightH开发者_JAVA百科andSidePart : listOfIdentifiers "{" /* some C code here */ "}"
listOfIdentifiers : listOfIdentifiers identifier | /* nothing */
and identifier
may be declared as [_a-zA-Z][_0-9a-zA-Z]*
regular expression.
You might be able to use autohighlight to convert your grammar to vim's syntax regex.
Autohighlight generates vim and emacs syntax highlighting from a BNF grammar and a description of which terms should be highlighted which colors.
精彩评论