http://qs321.pair.com?node_id=648073

Hi all,

I'm working a bit with Parse::RecDescent and I'd like to share this (minimal) vim syntax file for Parse::RecDescent grammars. I have very little experience with vim "programming", so any comment and improvement would be great before trying to propose it either to the vim website or to TheDamian.

I saved this as ~/.vimrc/syntax/parse_recdescent.vim:

" Vim syntax file " Language: Parse::RecDescent (Perl module) " Maintainer: Flavio Poletti <flavio [you know what] polettix.it> " Last Change: 2007 October 30 " Location: none at the moment :) " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif syn match prdDefinedAs /:/ syn region prdComment start=/#/ end=/$/ syn region prdDoubleString start=/"/ skip=/\\[\\"]/ end=/"/ syn region prdSingleString start=/'/ skip=/\\'/ end=/'/ syn match prdIdentifier /[a-zA-Z_][a-zA-Z0-9_]*/ syn region prdRegex start="m\?/"hs=e+1 skip="\\/" end="/[gmsxi]\?"he=s +-1 syn include @Perl syntax/perl.vim syn region prdCodeBlock start=/{/ end=/}/ contains=prdCodeBlock,@Perl " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighti +ng yet if version >= 508 || !exists("did_yacc_syn_inits") if version < 508 let did_yacchdl_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink prdDefinedAs Operator HiLink prdComment Comment HiLink prdDoubleString String HiLink prdSingleString String HiLink prdIdentifier Keyword HiLink prdRegex String delcommand HiLink endif let b:current_syntax = "parse_recdescent"
Making the syntax file autoload on startup is somewhat beyond my vim-fu. I personally use .prd extension for these grammars, and I've added this line:
au BufRead,BufNewFile *.prd set filetype=parse_recdescent
in my ~.vimrc personalisation file.

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Io ho capito... ma tu che hai detto?

Replies are listed 'Best First'.
Re: RFC [OT?]: vim syntax file for Parse::RecDescent
by princepawn (Parson) on Oct 30, 2007 at 18:47 UTC
    Best place to announce it would be the mailing list and I will be sure to put a link in Parse::RecDescent::FAQ to it tonight.


    Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality