caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@eecs.harvard.edu>
To: Caml Mailing List <caml-list@inria.fr>
Subject: Re: mixing different languages (was: RE: [Caml-list] dynamic HTML pages)
Date: Thu, 10 Apr 2003 09:20:28 +0200	[thread overview]
Message-ID: <20030410072028.GA634@eecs.harvard.edu> (raw)
In-Reply-To: <20030409172438.GA2596@etria.com>

On Wed, Apr 09, 2003 at 01:24:38PM -0400, Brian Skahan wrote:
> Vim has a similar feature, though I don't think its implemented for
> ocaml at the moment.  It works for mixed php/html, python(psp)/html,
> and jsp/html.

As an example, find below a Vim syntax file for mixing LaTeX and OCaml
in NoWEB documents.  The OCaml code shows up inline like in
[[List.length]] and in named chunks:

<<foo.ml>>=
let f x = x
@

Here, LaTeX is on the outer level, and OCaml code is mixed in. I the
context discussed, OCaml probably would be on the outer level.

It is easy to exchange either LaTeX or OCaml for a different language or
define new delimiters.  However, I found that using Perl instead of
OCaml did not work for some reason. I am not aware of a general
framework for mixing languages in Vim.

" syntax file for vim: ts=8 sw=4 et:
" 
" Language:	NoWEB
" Maintainer:	Christian Lindig <lindig@eecs.harvard.edu>
" Last Change:	Mon Feb  3 21:42:55 CET 2003
" Remark:	Includes tex, ocaml 
"
" A NoWEB file typically uses LaTeX for markup plus a programming
" language. 
" 

runtime! syntax/tex.vim
unlet b:current_syntax

syn include @Noweb     syntax/ocaml.vim     " or any other language
syn region  nowebTT    start="\[\["hs=s+2 end="\]\]"he=e-2 
syn region  nowebName  start="<<" end=">>" oneline contains=nowebTT
syn region  nowebCode  start="^<<.*>>=" end="^@ *$" contains=nowebName, @Noweb

hi def link nowebName String
hi def link nowebTT   Constant
" hi def link nowebCode Special " use, if @Noweb undefined

let b:current_syntax="noweb"

-- Christian

-- 
Christian Lindig         http://www.eecs.harvard.edu/~lindig/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2003-04-10 11:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-08  7:27 [Caml-list] dynamic HTML pages David Monniaux
2003-04-08  9:19 ` Maxence Guesdon
2003-04-08 11:59 ` Mattias Waldau
2003-04-08 12:28   ` mixing different languages (was: RE: [Caml-list] dynamic HTML pages) David Monniaux
2003-04-09 17:03     ` Fred Yankowski
2003-04-09 17:24       ` Brian Skahan
2003-04-10  7:20         ` Christian Lindig [this message]
2003-04-13 14:01       ` Pierre Weis
2003-04-09 18:12     ` Miles Egan
2003-04-09 23:00       ` Jeff Henrikson
2003-04-10  0:19         ` Miles Egan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030410072028.GA634@eecs.harvard.edu \
    --to=lindig@eecs.harvard.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).