From f35ba3510f42ed1a5a22cc0bb5afd32e49d04ea2 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sat, 7 Jun 2008 17:21:47 +0000 Subject: [PATCH] vim syntax files for *.ac and *.nas files. See nasal.vim for how to use them. Note that for XML embedded Nasal you can type :set ft=nasal and back to XML with :set ft=xml (ft ... filetype) --- utils/syntax/ac3d.vim | 62 +++++++++++++++++ utils/syntax/nasal.vim | 147 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 utils/syntax/ac3d.vim create mode 100644 utils/syntax/nasal.vim diff --git a/utils/syntax/ac3d.vim b/utils/syntax/ac3d.vim new file mode 100644 index 000000000..12863c163 --- /dev/null +++ b/utils/syntax/ac3d.vim @@ -0,0 +1,62 @@ +if !exists("main_syntax") + if version < 600 + syntax clear +" elseif exists("b:current_syntax") +" finish + endif + let main_syntax = 'ac3d' +endif + +"setlocal iskeyword=46,95,97-122 + +syn keyword ac3dIdentifier AC3Db +syn region ac3dMaterial start=+^MATERIAL+ end=+$+ contains=ac3dSTringS,ac3dStringD,ac3dMatKeyword +syn match ac3dError display +^OBJECT+ +syn match ac3dObject display +^OBJECT\s\+\(world\|group\|poly\)\s*$+ +syn match ac3dMaterial display +^SURF.*+ +syn region ac3dStringS start=+'+ end=+'+ +syn region ac3dStringD start=+"+ end=+"+ +syn match ac3dFunction display +^\(crease\|mat\|texture\|texrep\|texoff\|url\|data\|refs\)+ +syn match ac3dFunction display +^\(numvert\|numsurf\|kids\|name\|SURF\|loc\)+ +syn keyword ac3dMatKeyword MATERIAL rgb amb emis spec shi trans + + + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_ac3d_syn_inits") + if version < 508 + let did_ac3d_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink ac3dMatKeyword Statement + HiLink ac3dStringS String + HiLink ac3dStringD String + HiLink ac3dIdentifier Identifier + HiLink ac3dObject Identifier + + HiLink ac3dFunction Function + HiLink ac3dComment Comment + HiLink ac3dSpecial Special + HiLink ac3dCharacter Character + HiLink ac3dNumber Number + HiLink ac3dFloat Float + HiLink ac3dIdentifier Identifier + HiLink ac3dConditional Conditional + HiLink ac3dRepeat Repeat + HiLink ac3dOperator Operator + HiLink ac3dType Type + HiLink ac3dError Error + HiLink ac3dBoolean Boolean + delcommand HiLink +endif + +let b:current_syntax = "ac3d" +if main_syntax == 'ac3d' + unlet main_syntax +endif + +" vim: ts=8 diff --git a/utils/syntax/nasal.vim b/utils/syntax/nasal.vim new file mode 100644 index 000000000..72b72f8a1 --- /dev/null +++ b/utils/syntax/nasal.vim @@ -0,0 +1,147 @@ +" Vim syntax file +" Language: Nasal (FlightGear) +" Maintainer: Melchior FRANZ +" URL: http://members.aon.at/mfranz/nasal.vim +" Last Change: 2005 Apr 25 +" $Id$ + +" ________________________________CUSTOMIZATION______________________________ +" +" :let nasal_no_fgfs=1 " turn off FlightGear extensions +" :hi nasalStatement ctermfg=Green " change statement color +" ___________________________________________________________________________ +" for use in ~/.vimrc drop the initial colon +" type ":help new-filetype" in vim for installation instructions + + +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = 'nasal' +endif + + +syn keyword nasalCommentTodo TODO FIXME XXX contained +syn match nasalComment "#.*$" contains=nasalCommentTodo +syn region nasalStringS start=+'+ skip=+\\'+ end=+'+ contains=nasalSpecialS +syn region nasalStringD start=+"+ skip=+\\"+ end=+"+ contains=nasalSpecialD,nasalSpecial +syn match nasalSpecialS contained "\\'" +syn match nasalSpecialD contained "\\[\\rnt\"]" +syn match nasalSpecial contained "\\x[[:xdigit:]][[:xdigit:]]" + +syn match nasalError "``\=" +syn match nasalError "`\\[^`\\rnt]`" +syn match nasalError "`[^`][^`]\+`" +syn match nasalCharConstant "`[^`\\]`" +syn match nasalCharConstant "`\\[`\\rnt]`" +syn match nasalCharConstant "`\\x[[:xdigit:]][[:xdigit:]]`" + +syn match nasalNumber "-\=\<\d\+\>" +syn match nasalNumber "\.\d\+\([eE][+-]\=\d\+\)\=\>" +syn match nasalNumber "\<\d\+\.\([eE][+-]\=\d\+\)\=\>" +syn match nasalNumber "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=\>" + +syn keyword nasalStatement func return var +syn keyword nasalConditional if elsif else +syn keyword nasalRepeat while for foreach forindex +syn keyword nasalBranch break continue +syn keyword nasalVar me arg parents +syn keyword nasalType nil +syn keyword nasalOperator and or +syn match nasalFoo "\~" + +syn match nasalFunction display "\" +syn keyword nasalFunction size keys append pop setsize subvec delete int num streq substr +syn keyword nasalFunction chr typeof compile call die sprintf caller closure find cmp +syn keyword nasalFunction split rand bind sort ghosttype + +" math lib +syn match nasalFunction "\" +syn match nasalConstant "\" + +" io lib +syn match nasalFunction "\" +syn match nasalVar "\" + +" bits lib +syn match nasalFunction "\" + + +" FlightGear specific commands +if !exists("nasal_no_fgfs") + syn keyword nasalFGFSFunction getprop setprop print _fgcommand settimer _setlistener _cmdarg + syn keyword nasalFGFSFunction _interpolate rand srand directory removelistener systime + syn keyword nasalFGFSFunction geodtocart carttogeod geodinfo parsexml airportinfo + + syn keyword nasalGlobalsFunction isa fgcommand cmdarg abs interpolate setlistener defined printlog + + syn keyword nasalPropsFunction getType getName getIndex getValue setValue setIntValue + syn keyword nasalPropsFunction setBoolValue setDoubleValue getParent getChild getChildren + syn keyword nasalPropsFunction getAttribute setAttribute + syn keyword nasalPropsFunction removeChild removeChildren getNode + syn keyword nasalPropsFunction getPath getBoolValue setValues getValues + syn match nasalPropsFunction "\\.\=" +endif + + +syn sync fromstart +syn sync maxlines=100 + +syn match nasalParenError ")" +syn match nasalBrackError "]" +syn match nasalBraceError "}" + +syn region nasalEncl transparent matchgroup=nasalParenEncl start="(" matchgroup=nasalParenEncl end=")" contains=ALLBUT,nasalParenError +syn region nasalEncl transparent matchgroup=nasalBrackEncl start="\[" matchgroup=nasalBrackEncl end="\]" contains=ALLBUT,nasalBrackError +syn region nasalEncl transparent matchgroup=nasalBraceEncl start="{" matchgroup=nasalBraceEncl end="}" contains=ALLBUT,nasalBraceError + + +if version >= 508 || !exists("did_nasal_syn_inits") + if version < 508 + let did_nasal_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink nasalComment Comment + HiLink nasalCommentTodo Todo + HiLink nasalSpecial Special + HiLink nasalSpecialS Special + HiLink nasalSpecialD Special + HiLink nasalStringS String + HiLink nasalStringD String + HiLink nasalNumber Number + HiLink nasalConditional Conditional + + HiLink nasalVar Macro + HiLink nasalType Type + HiLink nasalConstant Constant + HiLink nasalCharConstant Type + HiLink nasalFoo NonText + + HiLink nasalRepeat Repeat + HiLink nasalBranch Conditional + HiLink nasalOperator Operator + HiLink nasalStatement Statement + HiLink nasalFunction Function + + HiLink nasalFGFSFunction Function + HiLink nasalGlobalsFunction Function + HiLink nasalPropsFunction Function + + HiLink nasalError Error + HiLink nasalParenError nasalError + HiLink nasalBrackError nasalError + HiLink nasalBraceError nasalError + delcommand HiLink +endif + +let b:current_syntax = "nasal" +if main_syntax == 'nasal' + unlet main_syntax +endif + +" vim: ts=8 -- 2.39.5