Vim Tips Wiki
Tip 1659 Printable Monobook Previous Next

created July 19, 2010 · complexity basic · author Maxslug · version 7.0

This is a syntax file for the Perl EP3 pre-processor which will render the Perl parts as Perl and the rest as Verilog.


" Vim syntax file
" Language:    EP3 (Perl/Verilog)
" Based on mason.vim, html.vim
" Clear previous syntax settings unless this is v6 or above, in which case just
" exit without doing anything.
if version < 600
  syn clear
elseif exists("b:current_syntax")

" Load perl and verilog into their own namespaces
syn include @ep3Perl    syntax/perl.vim
unlet b:current_syntax
syn include @ep3Verilog syntax/verilog.vim
unlet b:current_syntax

" Load verilog as the default syntax
runtime! syntax/verilog.vim
unlet b:current_syntax

" Add some EP3-specific syntax
syn match verilogGlobal "@include"

" TODO: How do I get the strings in a perl section to render as verilog?
"syn region ep3String   start=+"+ end=+"+ contained contains=@ep3Verilog
"hi def link perlString @ep3Verilog

syn region ep3Vline     matchgroup=Delimiter start="^@>"         end="$"         contains=@ep3Verilog
syn region ep3PerlChunk matchgroup=Delimiter start="@perl_begin" end="@perl_end" contains=@ep3Perl,ep3Vline

let b:current_syntax = "ep3"



  • Tell people how to use it.

JohnBeckett 08:21, September 20, 2010 (UTC)