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?

In reply to RFC [OT?]: vim syntax file for Parse::RecDescent by polettix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.