Ace Forth Vim syntax file
Priskribo de la ĉi-paĝa enhavo
Dosiero de Vim por kolorigi kodon en Ace Forth.
Etikedoj:
Fontkodo
" aceforth.vim
" Vim syntax file
" Language: ACE Forth (Jupiter ACE computer)
" Author: Marcos Cruz (programandala.net)
" License: Vim license (GPL compatible)
" URL: http://programandala.net
" Updated: 2015-02-26
" Based on:
" Language: FORTH
" Maintainer: Christian V. J. Br<fc>ssow
" Last Change: Di 06 Jul 2004 18:40:33 CEST
" Filenames: *.fs,*.ft
" URL: http://www.cvjb.de/comp/vim/forth.vim
" $Id: forth.vim,v 1.2 2004/07/10 09:40:55 vimboss Exp $
" History:
" 2009-05-26: First changes. Unfinished.
" 2010-03-24: Some changes and addons.
" 2010-12-08: iskeyword fixed: char 0 is not allowed.
" 2013-06-26: Fix: typo in comments' regexp; comments were not highlighted.
" 2013-06-26: Fix: two "forthTodo" remained; changed to "aceforthTodo".
" 2014-10-19: Change: an unused method for highlighting is removed;
" highlighting definitions are simplified (no support for old Vim versions
" anymore).
" 2014-10-19: Fix: 'iskeyword=1-255' made most highlighting fail; now
" 'iskeyword=33-255' is used.
" 2014-10-24: Fix: 'slow', 'fast' and 'beep' were missing.
" 2014-10-24: Fix: Also the filenames after file words are highlighted.
" 2014-10-24: Improvement: 'compiler' and 'definer' highlight also the following word.
" 2014-10-24: Improvement: better highlight of strings.
" 2015-02-26: Vim license.
" Possible locations:
" ~/.vim/syntax/ace_forth.vim
" /usr/share/vim/vimcurrent/syntax/ace_forth.vim
" --------------------------------------------------------------
" XXX TODO
" Words: . ,
" --------------------------------------------------------------
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" Synchronization method
syn sync ccomment
syn sync maxlines=200
syn case ignore
" Some special, non-FORTH keywords
syn keyword aceforthTodo contained
syn keyword aceforthTodo TODO
syn keyword aceforthTodo FIXME
syn keyword aceforthTodo XXX
syn match aceforthTodo contained 'Copyright\(\s([Cc])\)\=\(\s[0-9]\{2,4}\)\='
" Characters allowed in keywords
if version >= 600
" setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
setlocal iskeyword=33-255
else
" set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
set iskeyword=33-255
endif
" Keywords
syn keyword aceforthAdrArith ALLOT
syn keyword aceforthAdrArith HERE
syn keyword aceforthAssembler C,
syn keyword aceforthAssembler CALL
syn keyword aceforthCharOps CR
syn keyword aceforthCharOps EMIT
syn keyword aceforthCharOps FIND
syn keyword aceforthCharOps TYPE
syn keyword aceforthCharOps WORD
syn keyword aceforthCond ELSE
syn keyword aceforthCond IF
syn keyword aceforthCond THEN
syn keyword aceforthConversion #
syn keyword aceforthConversion #>
syn keyword aceforthConversion #S
syn keyword aceforthConversion <#
syn keyword aceforthConversion CONVERT
syn keyword aceforthConversion HOLD
syn keyword aceforthConversion INT
syn keyword aceforthConversion NUMBER
syn keyword aceforthConversion SIGN
syn keyword aceforthConversion UFLOAT
syn keyword aceforthDefine CONSTANT
syn keyword aceforthDefine CREATE
syn keyword aceforthDefine REDEFINE
syn keyword aceforthDefine DOES>
syn keyword aceforthDefine EXECUTE
syn keyword aceforthDefine IMMEDIATE
syn keyword aceforthDefine LITERAL
syn keyword aceforthDefine RUNS>
syn keyword aceforthDefine VARIABLE
syn keyword aceforthEndOfColonDef ;
syn keyword aceforthForth ABORT
syn keyword aceforthForth AT
syn keyword aceforthForth CLS
syn keyword aceforthForth FORGET
syn keyword aceforthForth INKEY
syn keyword aceforthForth INVIS
syn keyword aceforthForth PAD
syn keyword aceforthForth SPACE
syn keyword aceforthForth SPACES
syn keyword aceforthForth VIS
syn keyword aceforthForth BEEP
syn keyword aceforthForth FAST
syn keyword aceforthForth SLOW
syn keyword aceforthLoop +LOOP
syn keyword aceforthLoop BEGIN
syn keyword aceforthLoop DO
syn keyword aceforthLoop EXIT
syn keyword aceforthLoop I
syn keyword aceforthLoop I'
syn keyword aceforthLoop J
syn keyword aceforthLoop LEAVE
syn keyword aceforthLoop LOOP
syn keyword aceforthLoop REPEAT
syn keyword aceforthLoop UNTIL
syn keyword aceforthLoop WHILE
syn keyword aceforthMath BASE
syn keyword aceforthMath DECIMAL
syn keyword aceforthMemory !
syn keyword aceforthMemory @
syn keyword aceforthMemory C!
syn keyword aceforthMemory C@
syn keyword aceforthOperator *
syn keyword aceforthOperator */
syn keyword aceforthOperator */MOD
syn keyword aceforthOperator +
syn keyword aceforthOperator -
syn keyword aceforthOperator /
syn keyword aceforthOperator /MOD
syn keyword aceforthOperator 0<
syn keyword aceforthOperator 0=
syn keyword aceforthOperator 0>
syn keyword aceforthOperator 1+
syn keyword aceforthOperator 1-
syn keyword aceforthOperator 2+
syn keyword aceforthOperator 2-
syn keyword aceforthOperator <
syn keyword aceforthOperator =
syn keyword aceforthOperator >
syn keyword aceforthOperator ABS
syn keyword aceforthOperator AND
syn keyword aceforthOperator D+
syn keyword aceforthOperator D<
syn keyword aceforthOperator DNEGATE
syn keyword aceforthOperator F*
syn keyword aceforthOperator F+
syn keyword aceforthOperator F-
syn keyword aceforthOperator F/
syn keyword aceforthOperator FNEGATE
syn keyword aceforthOperator INVERT
syn keyword aceforthOperator MAX
syn keyword aceforthOperator MIN
syn keyword aceforthOperator MOD
syn keyword aceforthOperator NEGATE
syn keyword aceforthOperator OR
syn keyword aceforthOperator U<
syn keyword aceforthOperator XOR
syn keyword aceforthRStack >R
syn keyword aceforthRStack R>
syn keyword aceforthStack ?DUP
syn keyword aceforthStack DROP
syn keyword aceforthStack DUP
syn keyword aceforthStack OVER
syn keyword aceforthStack PICK
syn keyword aceforthStack ROLL
syn keyword aceforthStack ROT
syn keyword aceforthStack SWAP
syn keyword aceforthVocs CONTEXT
syn keyword aceforthVocs DEFINITIONS
syn keyword aceforthVocs FORTH
syn keyword aceforthVocs VLIST
syn keyword aceforthVocs VOCABULARY
syn match aceforthColonDef '\<:\s\+\S\+\>'
syn match aceforthDefine '\<COMPILER\s\+\S\+\>'
syn match aceforthDefine '\<DEFINER\s\+\S\+\>'
" Numbers
syn match aceforthInteger '\<-\=[0-9.]*[0-9.]\+\>'
syn match aceforthFloat '\<-\=\d*[.]\=\d\+[Ee]\d\+\>'
" Strings
syn match aceforthCharOps '\<ascii\s\S\+\>'
" ACE Forth does not provide string words beside '."', but they can easily created.
" The following rule provides a generic highlighting for such words
" (e.g. 's"', 'c"', 'abort"'):
syn region aceforthString start=+\<\S\+"\>+ end=+"+
" Comments
syn match aceforthComment '\<(\s[^)]*)' contains=aceforthTodo
" The line comment is not part of Ace Forth, but it can be easily implemented:
syn match aceforthComment '\<\\\>.*$' contains=aceforthTodo
" Files
" XXX TODO check how these words are used inside Forth definitions.
syn match aceforthInclude '^LOAD\s\+\S\+'
syn match aceforthInclude '^BLOAD\s\+\S\+'
syn match aceforthInclude '^SAVE\s\+\S\+'
syn match aceforthInclude '^BSAVE\s\+\S\+'
syn match aceforthInclude '^VERIFY\s\+\S\+'
syn match aceforthInclude '^BVERIFY\s\+\S\+'
" Define the highlighting.
hi def link aceforthAdrArith Function
hi def link aceforthAssembler Include
hi def link aceforthCharOps Character
hi def link aceforthColonDef Define
hi def link aceforthComment Comment
hi def link aceforthCond Conditional
hi def link aceforthConversion String
hi def link aceforthDebug Debug
hi def link aceforthDefine Define
hi def link aceforthEndOfColonDef Define
hi def link aceforthFloat Float
hi def link aceforthForth Statement
hi def link aceforthInclude Include
hi def link aceforthInteger Number
hi def link aceforthLoop Repeat
hi def link aceforthMath Number
hi def link aceforthMemory Function
hi def link aceforthOperator Operator
hi def link aceforthRstack Special
hi def link aceforthStack Special
hi def link aceforthString String
hi def link aceforthTodo Todo
hi def link aceforthVocs Statement
let b:current_syntax = "aceforth"
" vim:ts=8:sw=4:nocindent:smartindent: