开发者

Translate simple formal grammar to vim syntax

开发者 https://www.devze.com 2023-04-02 00:35 出处:网络
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

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

精彩评论

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