diff --git a/misc/factor.vim.fgen b/misc/factor.vim.fgen index 7dcf59142d..110eadfd3a 100644 --- a/misc/factor.vim.fgen +++ b/misc/factor.vim.fgen @@ -12,7 +12,7 @@ IN: factor.vim.fgen " Vim syntax file " Language: Factor " Maintainer: Alex Chapman -" Last Change: 2011 Mar 21 +" Last Change: 2011 Apr 06 " To run: USING: html.templates html.templates.fhtml ; "resource:misc/factor.vim.fgen" call-template " For version 5.x: Clear all syntax items @@ -23,22 +23,21 @@ elseif exists("b:current_syntax") finish endif -" factor is case sensitive. +" Factor is case sensitive. syn case match -" make all of these characters part of a word (useful for skipping over words with w, e, and b) +" Make all of these characters part of a word (useful for skipping over words with w, e, and b) if version >= 600 setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 else set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 endif -syn cluster factorCluster contains=factorComment,factorFrySpecifier,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorBreakpoint,factorDeclaration,factorCallQuotation,factorExecute,factorCallNextMethod,factorString,factorTriString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorBackslash,factorLiteral,factorLiteralBlock,@factorWordOps,factorAlien,factorSlot,factorTuple,factorError,factorStruct +syn cluster factorCluster contains=factorComment,factorFrySpecifier,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorBreakpoint,factorDeclaration,factorCallQuotation,factorExecute,factorCallNextMethod,factorString,factorTriString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorBackslash,factorMBackslash,factorLiteral,factorLiteralBlock,@factorWordOps,factorAlien,factorSlot,factorTuple,factorError,factorStruct syn match factorTodo /\(TODO\|FIXME\|XXX\):\=/ contained -syn match factorComment /\\s.*/ contains=factorTodo,@Spell -syn match factorComment /\<#!\>\s.*/ contains=factorTodo,@Spell -syn match factorShebang /\%\^#!\s.*/ display +syn match factorComment /\<#\?!\>.*/ contains=factorTodo,@Spell +syn match factorShebang /\%\^#!.*/ display syn match factorShebangErr /\%\^#!\S\+/ syn cluster factorDefnContents contains=@factorCluster,factorStackEffect,factorLiteralStackEffect,factorArray0,factorQuotation0 @@ -60,8 +59,8 @@ syn keyword factorBoolean f t syn keyword factorBreakpoint B syn keyword factorFrySpecifier @ _ contained syn keyword factorDeclaration delimiter deprecated final flushable foldable inline recursive -syn match factorCallQuotation /\/ -syn match factorExecute /\/ +syn match factorCallQuotation /\/ +syn match factorExecute /\/ syn keyword factorCallNextMethod call-next-method <% @@ -101,6 +100,7 @@ syn match factorUnuse /\/ syn match factorChar /\/ syn match factorBackslash /\<\\\>\s\+\S\+\>/ +syn match factorMBackslash /\\s\+\S\+\s\+\S\+\>/ syn match factorLiteral /\<\$\>\s\+\S\+\>/ syn region factorLiteralBlock start=/\<\$\[\>/ end=/\<\]\>/ @@ -128,7 +128,7 @@ syn match factorDefer /\/ syn match factorForget /\/ syn match factorMixin /\/ syn match factorInstance /\/ -syn match factorHook /\/ +syn match factorHook /\/ nextgroup=factorStackEffect skipwhite skipempty syn match factorMain /\/ syn match factorConstructor /\/ syn match factorAlien /\/ @@ -161,8 +161,8 @@ syn match factorMultiStringContents /.*/ contained "syn match factorStackEffectErr /\<)\>/ "syn region factorStackEffectErr start=/\<(\>/ end=/\<)\>/ "syn region factorStackEffect start=/\<(\>/ end=/\<)\>/ contained -syn match factorStackEffect /\<(\s\(.*\s\)\?--\(\s.*\)\?\s)\>/ contained -syn match factorLiteralStackEffect /\<((\s\(.*\s\)\?--\(\s.*\)\?\s))\>/ +syn match factorStackEffect /\<(\s\(\S*\s\)\?--\(\s\S*\)\?\s)\>/ contained +syn match factorLiteralStackEffect /\<((\s\(\S*\s\)\?--\(\s\S*\)\?\s))\>/ "adapted from lisp.vim if exists("g:factor_norainbow") @@ -266,6 +266,7 @@ if version >= 508 || !exists("did_factor_syn_inits") HiLink factorChar Character HiLink factorDelimiter Delimiter HiLink factorBackslash Special + HiLink factorMBackslash Special HiLink factorLiteral Special HiLink factorLiteralBlock Special HiLink factorDeclaration Typedef diff --git a/misc/vim/README.md b/misc/vim/README.md index e75d02ab8c..12cd1a51f6 100644 --- a/misc/vim/README.md +++ b/misc/vim/README.md @@ -16,7 +16,7 @@ into `~/.vim/` or the equivalent path on other platforms (Open Vim and type The current set of files is as follows: * ftdetect/factor.vim - Teach Vim when to load Factor support files. -* ftplugin/factor_settings.vim - Teach Vim to follow the Factor Coding Style guidelines. +* ftplugin/factor.vim - Teach Vim to follow the Factor Coding Style guidelines. * plugin/factor.vim - Teach Vim some commands for navigating Factor source code. See below. * syntax/factor.vim - Syntax highlighting for Factor code. diff --git a/misc/vim/ftplugin/factor_settings.vim b/misc/vim/ftplugin/factor.vim similarity index 70% rename from misc/vim/ftplugin/factor_settings.vim rename to misc/vim/ftplugin/factor.vim index ced9e85719..bb34b3a60d 100644 --- a/misc/vim/ftplugin/factor_settings.vim +++ b/misc/vim/ftplugin/factor.vim @@ -1,3 +1,14 @@ +" Vim filetype plugin file +" Language: Factor +" Maintainer: Tim Allen +" Last Change: 2011 Apr 05 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + " Code formatting settings loosely adapted from: " http://concatenative.org/wiki/view/Factor/Coding%20Style diff --git a/misc/vim/syntax/factor.vim b/misc/vim/syntax/factor.vim index 35b7a4c253..5cea099f45 100644 --- a/misc/vim/syntax/factor.vim +++ b/misc/vim/syntax/factor.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Factor " Maintainer: Alex Chapman -" Last Change: 2011 Mar 21 +" Last Change: 2011 Apr 06 " To run: USING: html.templates html.templates.fhtml ; "resource:misc/factor.vim.fgen" call-template " For version 5.x: Clear all syntax items @@ -12,22 +12,21 @@ elseif exists("b:current_syntax") finish endif -" factor is case sensitive. +" Factor is case sensitive. syn case match -" make all of these characters part of a word (useful for skipping over words with w, e, and b) +" Make all of these characters part of a word (useful for skipping over words with w, e, and b) if version >= 600 setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 else set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 endif -syn cluster factorCluster contains=factorComment,factorFrySpecifier,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorBreakpoint,factorDeclaration,factorCallQuotation,factorExecute,factorCallNextMethod,factorString,factorTriString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorBackslash,factorLiteral,factorLiteralBlock,@factorWordOps,factorAlien,factorSlot,factorTuple,factorError,factorStruct +syn cluster factorCluster contains=factorComment,factorFrySpecifier,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorBreakpoint,factorDeclaration,factorCallQuotation,factorExecute,factorCallNextMethod,factorString,factorTriString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorBackslash,factorMBackslash,factorLiteral,factorLiteralBlock,@factorWordOps,factorAlien,factorSlot,factorTuple,factorError,factorStruct syn match factorTodo /\(TODO\|FIXME\|XXX\):\=/ contained -syn match factorComment /\\s.*/ contains=factorTodo,@Spell -syn match factorComment /\<#!\>\s.*/ contains=factorTodo,@Spell -syn match factorShebang /\%\^#!\s.*/ display +syn match factorComment /\<#\?!\>.*/ contains=factorTodo,@Spell +syn match factorShebang /\%\^#!.*/ display syn match factorShebangErr /\%\^#!\S\+/ syn cluster factorDefnContents contains=@factorCluster,factorStackEffect,factorLiteralStackEffect,factorArray0,factorQuotation0 @@ -49,8 +48,8 @@ syn keyword factorBoolean f t syn keyword factorBreakpoint B syn keyword factorFrySpecifier @ _ contained syn keyword factorDeclaration delimiter deprecated final flushable foldable inline recursive -syn match factorCallQuotation /\/ -syn match factorExecute /\/ +syn match factorCallQuotation /\/ +syn match factorExecute /\/ syn keyword factorCallNextMethod call-next-method syn keyword factorKeyword or 2bi 2tri while wrapper nip 4dip wrapper? bi* callstack>array both? hashcode die dupd callstack callstack? 3dup tri@ pick curry build ?execute 3bi prepose >boolean ?if clone eq? tri* ? = swapd 2over 2keep 3keep clear 2dup when not tuple? dup 2bi* 2tri* call tri-curry object bi@ do unless* if* loop bi-curry* drop when* assert= retainstack assert? -rot execute 2bi@ 2tri@ boa with either? 3drop bi curry? datastack until 3dip over 3curry tri-curry* tri-curry@ swap and 2nip throw bi-curry (clone) hashcode* compose 2dip if 3tri unless compose? tuple keep 2curry equal? assert tri 2drop most boolean? identity-hashcode identity-tuple? null new dip bi-curry@ rot xor identity-tuple boolean @@ -88,6 +87,7 @@ syn match factorUnuse /\/ syn match factorChar /\/ syn match factorBackslash /\<\\\>\s\+\S\+\>/ +syn match factorMBackslash /\\s\+\S\+\s\+\S\+\>/ syn match factorLiteral /\<\$\>\s\+\S\+\>/ syn region factorLiteralBlock start=/\<\$\[\>/ end=/\<\]\>/ @@ -115,7 +115,7 @@ syn match factorDefer /\/ syn match factorForget /\/ syn match factorMixin /\/ syn match factorInstance /\/ -syn match factorHook /\/ +syn match factorHook /\/ nextgroup=factorStackEffect skipwhite skipempty syn match factorMain /\/ syn match factorConstructor /\/ syn match factorAlien /\/ @@ -148,8 +148,8 @@ syn match factorMultiStringContents /.*/ contained "syn match factorStackEffectErr /\<)\>/ "syn region factorStackEffectErr start=/\<(\>/ end=/\<)\>/ "syn region factorStackEffect start=/\<(\>/ end=/\<)\>/ contained -syn match factorStackEffect /\<(\s\(.*\s\)\?--\(\s.*\)\?\s)\>/ contained -syn match factorLiteralStackEffect /\<((\s\(.*\s\)\?--\(\s.*\)\?\s))\>/ +syn match factorStackEffect /\<(\s\(\S*\s\)\?--\(\s\S*\)\?\s)\>/ contained +syn match factorLiteralStackEffect /\<((\s\(\S*\s\)\?--\(\s\S*\)\?\s))\>/ "adapted from lisp.vim if exists("g:factor_norainbow") @@ -253,6 +253,7 @@ if version >= 508 || !exists("did_factor_syn_inits") HiLink factorChar Character HiLink factorDelimiter Delimiter HiLink factorBackslash Special + HiLink factorMBackslash Special HiLink factorLiteral Special HiLink factorLiteralBlock Special HiLink factorDeclaration Typedef