15496Re: WSH (Windows Scripting Host) syntax file
- Oct 2, 2000Paul Moore wrote:
> Attached is a syntax file for WSH (Windows Scripting Host) files. The fileLooks OK, I'll include it (with a few modifications, see below).
> extension is .wsf (not .wsh!). I wrapped a couple of syn region lines so my
> mailer doesn't do it. You'll need to rejoin them manually.
> It's a nice example of reusing other syntax files.Ehm, fail in what way? Normally it would then produce an error message, and
> Some points.
> 1. I use "runtime syntax/xml.vim" to load the base XML highlighting. Only
> one problem, I'd like this to *fail* if xml.vim isn't available, as
> continuing without the xml stuff is a bit meaningless. I could use :source
> <sfile>:p:h/xml.vim, but that relies on wsh.vim being installed in the same
> directory as xml.vim (which it won't be, unless/until it's accepted into the
> standard distribution). It would be nice to have a version of :runtime which
> failed if the file could not be found.
your script still continues (with more errors).
You could test if b:current_syntax has been set to "xml". If it isn't,
something went wrong.
> 2. Similarly, it would be nice to be able to do the "syn include" statementsHmm, ":syn include" is like searching for a syntax file to include. We could
> without needing to explicitly specify the directory. In general, I suspect
> we need a "find a file on the runtimepath" function, here... It probably
> should be widely used (it won't be at the moment, because the runtimepath
> stuff is new) so could do with being a builtin.
search 'runtimepath' for the file. But previously it included the full path,
which conflicts with using just the file name.
I suppose adding a new :syntax sub-command will be the simplest solution.
":syn includepath"? Or an extra argument: ":syn include path"?
This is the file as I would include it for Vim 5.7:
" Vim syntax file
" Language: Windows Scripting Host
" Maintainer: Paul Moore <gustav@...>
" Last Change: 01 Oct 2000
" VBScript, it's close enough for us. No attempt is made to handle
" other languages.
" Send comments, suggestions and requests to the maintainer.
syn case ignore
syn include @wshVBScript <sfile>:p:h/vb.vim
syn region wshVBScript matchgroup=xmlTag start="<script[^>]*VBScript[^>]*>" end="</script>" contains=@wshVBScript
let did_wsh_syntax_inits = 1
" No type-specific highlighting -- it's all reused from other files
let b:current_syntax = "wsh"
hundred-and-one symptoms of being an internet addict:
134. You consider bandwidth to be more important than carats.
/// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
\\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
- << Previous post in topic Next post in topic >>