Abersoft Forth Afera syntax file
Description of the page content
Vim syntax file for highlighting Abersoft Forth code expanded with the Afera library.
I wrote the following Vim syntax file in order to work with Abersoft Forth and Afera more comfortably during the development of Tron 0xF.
Source code
" abersoftforthafera.vim
" Vim syntax file
" Language: Abersoft Forth with Afera library (ZX Spectrum computer)
" Author: Marcos Cruz (programandala.net)
" License: Vim license (GPL compatible)
" URL: http://programandala.net/en.program.abersoft_forth_afera_vim_syntax_file.html
" Updated: 2016-01-07
" --------------------------------------------------------------
" History:
" 2015-05-18: First version.
"
" 2015-05-20: Fix: 'syn case ignore' was misplaced. New: some
" words were missing.
"
" 2015-06-05: Update: `UNLOOP` added.
"
" 2015-06-13: Update: `0<>`, `EXTEND`, `SYSTEM`, `TURNKEY`,
" `/DISC`, `SCR/DR`, `GREETING` and `BOOT` added.
"
" 2016-01-07: Fixed the URL.
" --------------------------------------------------------------
syn case ignore
:runtime! syntax/abersoftforth.vim " Include the Abersoft Forth syntax file
" Keywords.
syn keyword abersoftforthAssembler CODE
syn keyword abersoftforthAssembler END-CODE
syn keyword abersoftforthFiles +LOAD
syn keyword abersoftforthFiles +THRU
syn keyword abersoftforthFiles /DISC
syn keyword abersoftforthFiles /RUNT
syn keyword abersoftforthFiles /SCR
syn keyword abersoftforthFiles ?-->
syn keyword abersoftforthFiles ?NEEDS
syn keyword abersoftforthFiles DISC-SCR
syn keyword abersoftforthFiles NEEDS
syn keyword abersoftforthFiles RUNT
syn keyword abersoftforthFiles SCR/DR
syn keyword abersoftforthFiles THRU
syn keyword abersoftforthFlow UNLOOP
syn keyword abersoftforthForth .AUTHOR
syn keyword abersoftforthForth .SYS
syn keyword abersoftforthForth BOOT
syn keyword abersoftforthForth EXTEND
syn keyword abersoftforthForth GREETING
syn keyword abersoftforthForth SYSTEM
syn keyword abersoftforthForth TURNKEY
syn keyword abersoftforthFunction FALSE
syn keyword abersoftforthFunction TRUE
syn keyword abersoftforthGraphics CLS0
syn keyword abersoftforthGraphics COLORS0
syn keyword abersoftforthMemory OFF
syn keyword abersoftforthMemory ON
syn keyword abersoftforthOperator 0<>
syn keyword abersoftforthOperator 1-
syn keyword abersoftforthOperator 2*
syn keyword abersoftforthOperator 2-
syn keyword abersoftforthOperator 2/
syn keyword abersoftforthOperator D-
syn keyword abersoftforthReturnStack 2>R
syn keyword abersoftforthReturnStack 2R
syn keyword abersoftforthReturnStack 2R>
syn keyword abersoftforthStack -ROT
syn keyword abersoftforthStack 2NIP
syn keyword abersoftforthStack BOUNDS
syn keyword abersoftforthStack DEPTH
syn keyword abersoftforthStack NIP
syn keyword abersoftforthStack PICK
syn keyword abersoftforthStack TUCK
syn keyword abersoftforthVocs ASSEMBLER
" Regions and matches.
" syn region abersoftforthString start=+\.*\"+ end=+"+ end=+$+
" XXX
syn region abersoftforthString start=+s\"+ end=+"+ end=+$+
syn region abersoftforthString start=+s\'+ end=+'+ end=+$+
syn match abersoftforthCharOps '\<char\s\+\S\+\>'
syn match abersoftforthCharOps '\<\[char\]\s\+\S\+\>'
syn match abersoftforthInclude '\<NEEDS\s\+\k\+\s\+\k\+'
syn match abersoftforthInclude '\<?NEEDS\s\+\k\+'
syn match abersoftforthComment '\<\.(\s[^)]*)'
syn match abersoftforthComment '\<\\\>.*$' contains=abersoftforthTodo
syn match abersoftforthFiles "?\\"
syn match abersoftforthDefine "\[IF]"
syn match abersoftforthDefine "\[DEFINED]"
syn match abersoftforthDefine "\[UNDEFINED]"
syn match abersoftforthDefine "\[ELSE]"
syn match abersoftforthDefine "\[THEN]"
syn match abersoftforthFunction "\[TRUE]"
syn match abersoftforthFunction "\[FALSE]"
" Define the highlighting.
hi def link abersoftforthCharOps Character
hi def link abersoftforthInclude Include
hi def link abersoftforthFunction Number