From b402063aae5813d6aeb95ca46b49d4742d51784a Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Tue, 14 Oct 2014 22:58:06 +0200 Subject: [PATCH] ebnf:doc: add syntax file for vim Signed-off-by: Alejandro Mery --- ebnf/doc/ebnf.vim | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ebnf/doc/ebnf.vim diff --git a/ebnf/doc/ebnf.vim b/ebnf/doc/ebnf.vim new file mode 100644 index 0000000..22c7242 --- /dev/null +++ b/ebnf/doc/ebnf.vim @@ -0,0 +1,36 @@ +" Vim syntax file +" Language: EBNF +" Maintainer: Hans Fugal +" Last Change: $Date: 2003/01/28 14:42:09 $ +" Version: $Id: ebnf.vim,v 1.1 2003/01/28 14:42:09 fugalh Exp $ +" With thanks to Michael Brailsford for the BNF syntax file. + +" Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn match ebnfMetaIdentifier /[A-Za-z]/ skipwhite skipempty nextgroup=ebnfSeperator + +syn match ebnfSeperator "=" contained nextgroup=ebnfProduction skipwhite skipempty + +syn region ebnfProduction start=/\zs[^\.;]/ end=/[\.;]/me=e-1 contained contains=ebnfSpecial,ebnfDelimiter,ebnfTerminal,ebnfSpecialSequence,ebnfComment nextgroup=ebnfEndProduction skipwhite skipempty +syn match ebnfDelimiter #[,(|)\]}\[{/!]\|\(\*)\)\|\((\*\)\|\(/)\)\|\(:)\)\|\((/\)\|\((:\)# contained +syn match ebnfSpecial /[\-\*]/ contained +syn region ebnfSpecialSequence matchgroup=Delimiter start=/?/ end=/?/ contained +syn match ebnfEndProduction /[\.;]/ contained +syn region ebnfTerminal matchgroup=delimiter start=/"/ end=/"/ contained +syn region ebnfTerminal matchgroup=delimiter start=/'/ end=/'/ contained +syn region ebnfComment start="(\*" end="\*)" + + +hi link ebnfComment Comment +hi link ebnfMetaIdentifier Identifier +hi link ebnfSeperator ebnfSpecial +hi link ebnfEndProduction ebnfDelimiter +hi link ebnfDelimiter Delimiter +hi link ebnfSpecial Special +hi link ebnfSpecialSequence Statement +hi link ebnfTerminal Constant