开发者

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.

So the question is: how do I translate this grammar to vim syntax rules?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜