Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

RFC [OT?]: vim syntax file for Parse::RecDescent

by polettix (Vicar)
on Oct 30, 2007 at 17:56 UTC ( #648073=perlmeditation: print w/replies, xml ) Need Help??

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]> " 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.

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://648073]
Approved by naikonta
Front-paged by planetscape
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2021-04-19 10:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found