Moto vi syntax file

"Shay Harding" <sharding-YCNXYxaMkU/[email protected]> Wed, 26 Mar 2003 17:31:35 -0700
Newsgroups gmane.comp.lang.moto.devel
Message-ID <000c01c2f3f8$395dc200$7500000a@ccbill22ms668m>
------=_NextPart_000_000D_01C2F3BD.8CFEEA00
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

After messing around with Vi yet again, I got into the moto.vim file =
that
Stefano sent a while back. Ended up cleaning it out, then just rewriting =
it
altogether to get rid of all the extra Java stuff that was in there.

This one has the ability to highlight the HTML as well as the Moto code.
Along with the HTML all the Java/VB script and style sheet stuff gets
syntaxed. The Moto code is treated as one large page with embedded code =
a
single component in order to make it all work. This is so the HTML won't =
get
highlighted within the embedded moto code.

There are still some rough spots, especially when embedding Moto code =
within
HTML tags (especially since Moto casts read as HTML tags due to the =
<...>
construct). I think to work these sort of things out, I'd have to create =
a
motoHtml.vim rather than using the html.vim file in order to =
differentiate.

Anyway, thought I'd post it in case anyone was interested.



Shay

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/2003
=20
 =20

------=_NextPart_000_000D_01C2F3BD.8CFEEA00
Content-Type: text/plain;
	name="moto.vim"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="moto.vim"

" Vim syntax file
" Language:     Moto
" Author:       Stefano Corsi <[email protected]>, Shay Harding =
<sharding-YCNXYxaMkU/[email protected]>
" Maintainer:   Stefano Corsi <[email protected]>, Shay Harding =
<sharding-YCNXYxaMkU/[email protected]>
" URL:          http://www.projectmoto.org
" Last Change:  2003 Mar 25

" Please check :help moto.vim for comments on some of the options =
available.

" Quit when a syntax file was already loaded
if !exists("main_syntax")
  if version < 600
    syntax clear
  elseif exists("b:current_syntax")
    finish
  endif
  " we define it here so that included files can test for it
  let main_syntax=3D'moto'
endif

" don't use standard HiLink, it will not work with included syntax files
if version < 508
  command! -nargs=3D+ MotoHiLink hi link <args>
else
  command! -nargs=3D+ MotoHiLink hi def link <args>
endif

let html_no_rendering =3D 1
syn include @html <sfile>:p:h/html.vim

" Remove this since it's really not an error in Moto
syn cluster html remove=3DhtmlError

syn region motoPage start=3D".[^\$]" end=3D"${" =
contains=3D@html,motoEmbedded,motoMultiLineComment,@motoText,@motoMacros
syn region motoEmbedded matchgroup=3DMotoCEmbed start=3D"${" end=3D"}\$" =
contained =
contains=3DmotoError,@motoComments,@motoText,@motoAll,motoRegex,motoCast
"MotoHiLink motoEmbedded Comment=20

" Characters that cannot be in a moto program (outside a string)
" Some of these can be on a Regex // so we declare that below
syn match motoError =
"<<<\|\.\.\|=3D>\|<>\|||=3D\|&&=3D\|[^-]->\|\*\/\|[\\@`]\|$\w*(" =
contained

" Comments
syn keyword motoTodo contained TODO FIXME XXX
syn region motoMultiLineComment start=3D"\s*\$\*" end=3D"\*\$" =
contains=3DmotoTodo contained
syn match motoLineComment "\s*//.*" contains=3DmotoTodo contained
syn cluster motoComments contains=3DmotoMultiLineComment,motoLineComment

" Regex... used to supress false errors
syn match motoRegex "/.*/" contained

" Cast... used to stop html formatting of our casting
syn match motoCast "<.*>" contained

" Macros and directives
syn region motoMacro1 start=3D"\$\w\+" end=3D"[(\t ]"he=3De-1 =
contains=3D@motoDirectives contained
syn match motoMacro2 "$("he=3De-1 contained
syn cluster motoMacros =
contains=3DmotoMacro1,motoMacro2,@motoTypes,motoObjectOps

" Strings
syn region motoString start=3D/"/ skip=3D/\\"/ end=3D/"/ =
contains=3DmotoStringEscape contained
syn match motoStringEscape "\\." contained

" Numbers
syn match motoNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=3D\>" =
contained
syn match motoNumber =
"\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=3D\d\+\)\=3D[fFdD]\=3D" contained
syn match motoNumber "\<\d\+[eE][-+]\=3D\d\+[fFdD]\=3D\>" contained
syn match motoNumber "\<\d\+\([eE][-+]\=3D\d\+\)\=3D[fFdD]\>" contained

syn cluster motoText contains=3DmotoString,motoNumber

syn keyword motoPrimitiveTypes contained        double float long int =
byte boolean char void
syn keyword motoObjectTypes    contained        Array Integer Long Float =
Double Boolean
syn keyword motoObjectTypes    contained        Character Regex Match =
String Date Enumeration
syn keyword motoObjectTypes    contained        FileIO Hashset Hashtable =
IntEnumeration IntHashtable
syn keyword motoObjectTypes    contained        IntSet IntStack =
ItolHashtable KMPString Sharedmem
syn keyword motoObjectTypes    contained        Stack StringBuffer =
Stringset SymbolTable TabularData=20
syn keyword motoObjectTypes    contained        Tokenizer Vector Cookie =
Form HTTPRequest ModuleConfig=20
syn keyword motoObjectTypes    contained        HTTPResonse MIMEEntity =
State Session Context=20
syn keyword motoObjectTypes    contained        MySQLResultSet =
MySQLConnection PGResultSet PGConnection=20
syn keyword motoObjectTypes    contained        PosixFileSystem=20
syn keyword motoStatement      contained        declare define use =
enddef
syn keyword motoObjectStore    contained        class endclass
syn keyword motoObjectOps      contained        new delete
syn keyword motoBranch         contained        break return continue =
case
syn keyword motoConstant       contained        null true false
syn keyword motoStorage        contained        global
syn keyword motoConditional    contained        if else switch endif =
endswitch elseif
syn keyword motoRepeat         contained        for while do endwhile =
endfor
syn keyword motoLabel          contained        default
syn keyword motoException      contained        try catch finally throw =
endtry
syn keyword motoExceptionType  contained        Exception =
AllocationFailureException ArrayBoundsException
syn keyword motoExceptionType  contained        =
ConnectionRefusedException DLCloseException
syn keyword motoExceptionType  contained        DLException =
DLOpenException DLSymbolException
syn keyword motoExceptionType  contained        DefaultException =
EmptyQueueException EmptyStackException
syn keyword motoExceptionType  contained        ExecFailedException =
FileNotFoundException ForkFailedException
syn keyword motoExceptionType  contained        IOException =
IllegalArgumentException MathException NetException
syn keyword motoExceptionType  contained        NoSuchElementException =
NullPointerException NumberFormatException
syn keyword motoExceptionType  contained        SecurityException =
SemaphoreException UnexpectedEOFException
syn keyword motoExceptionType  contained        =
UnsupportedOperationException SignalException RegexParseException
syn keyword motoExceptionType  contained        RuntimeException =
SQLException IllegalConversionException

syn cluster motoTypes contains=3DmotoPrimitiveTypes,motoObjectTypes
syn cluster motoDirectives =
contains=3DmotoBranch,motoConditional,motoRepeat,motoException,motoStatem=
ent,motoObjectStore

syn cluster motoAll =
contains=3D@motoTypes,@motoDirectives,motoConstant,motoStorage,motoLabel,=
motoExceptionType,motoObjectOps

" Custom colors=20
hi def MotoCComment term=3Dbold ctermfg=3Dlightgrey guifg=3Dlightgrey
hi def MotoCTodo term=3Dbold,underline cterm=3Dbold,underline =
ctermfg=3Ddarkred gui=3Dbold,underline
hi def MotoCEmbed ctermfg=3Ddarkgrey
hi def MotoCException ctermfg=3Ddarkcyan

" The default highlighting.
if version >=3D 508 || !exists("did_moto_syn_inits")
  if version < 508
    let did_moto_syn_inits =3D 1
  endif
   MotoHiLink motoStringEscape         Special
   MotoHiLink motoString               Constant
   MotoHiLink motoStatement            Statement=20
   MotoHiLink motoRepeat               Repeat
   MotoHiLink motoConditional          Conditional
   MotoHiLink motoBranch               Statement
   MotoHiLink motoException            Exception
   MotoHiLink motoExceptionType        MotoCException
   MotoHiLink motoObjectStore          Statement
   MotoHiLink motoObjectOps            Statement
   MotoHiLink motoConstant             Constant
   MotoHiLink motoStorage              StorageClass=20
   MotoHiLink motoLabel                Label
   MotoHiLink motoPrimitiveTypes       Type
   MotoHiLink motoObjectTypes          Type
   MotoHiLink motoTodo                 MotoCTodo
   MotoHiLink motoLineComment          MotoCComment
   MotoHiLink motoMultiLineComment     MotoCComment
   MotoHiLink motoError                Error
   MotoHiLink motoMacro1               Identifier
   MotoHiLink motoMacro2               Identifier
   MotoHiLink motoNumber               Number
endif

if !exists("moto_minlines")
  let moto_minlines =3D 50=20
endif
exec "syn sync ccomment motoComment minlines=3D" . moto_minlines

delcommand MotoHiLink
let b:current_syntax =3D "moto"

if main_syntax =3D=3D 'moto'
  unlet main_syntax
endif

let b:spell_options=3D"contained"


------=_NextPart_000_000D_01C2F3BD.8CFEEA00--