Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: caml/mac + alpha
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matias Giovannini <mgiovann@s...>
Subject: RE: caml/mac + alpha

> quelqu'un a-t-il interface' caml-light/mac avec l'e'diteur alpha ? je n'ai
> pas le courage de plonger dans TCL pour faire le travail... et je suis
> certain que quelqu'un l'a de'ja` fait bien mieux que je serais capable de
> le faire...

I've written a (sort of) Caml mode definition for Alpha. It's kind of useable, though.
I hadn't the time to test the marking procedure. If somebody likes to build upon this mode, feel free to do so.

###############################################################################
if {$startingUp} {
	addMode Caml dummyCaml {*.ml *.mli} {}
	return
}


newModeVar Caml leftFillColumn {4} 0
newModeVar Caml electricSemi {1} 1
newModeVar Caml wordBreak {\w+} 0
newModeVar Caml wordWrap {0} 1
newModeVar Caml funcExpr {^let(\s+rec)?(\s+prefix)?\s+\S+(\s+\w+)*\s*=} 0
newModeVar Caml wordBreakPreface {\W} 0
newModeVar Caml electricTab {1} 1
newModeVar Caml autoMark	0	1

set CamlCommentRegexp	{/\(\*([^\*]|\*[^)])*\*\)/}
set CamlPreRegexp		{^\#\s*\w+}
set CamlKeyWords		{
	and    as     begin       do      done      downto 
	else   end    exception   for     fun       function 
	if     in     let         match   mutable   not 
	of     or     prefix      rec     then      to 
	try    type   value       where   while     with
	ref
}
regModeKeywords -b {(*} {*)} -c red -k blue -s green Caml $CamlKeyWords
unset CamlKeyWords


#================================================================================

proc dummyCaml {} {}

proc CamlMarkFile {} {
 	global CamlModeVars
 	set pos 0
 	while {![catch {search -s -f 1 -r 1 -m 0 -i 0 $CamlModeVars(funcExpr) $pos} res]} {
 		set start [lindex $res 0]
 		set end [expr [lindex $res 1] + 1]
 		set text [getText $start $end]
 		if {[regexp {let(\s+rec)?(\s+prefix)?\s+(\S+)} $text entire isrec ispref fname]} {
 			set tmp [expr $start + [string first $fname $text]]
 			set inds($fname) "$tmp [expr $tmp + [string length $fname]]"
 		}
 		set pos $end
 	}
 	if {[info exists inds]} {
 		foreach f [lsort -ignore [array names inds]] {
 			set res $inds($f)
 			setNamedMark $f [lineStart [lindex $res 0]] [lindex $res 0] [lindex $res 1]
 		}
 	}
}