|
Karsten Hopp |
174d41 |
" Vim syntax file
|
|
Karsten Hopp |
174d41 |
" Language: FORTH
|
|
Karsten Hopp |
174d41 |
" Maintainer: Christian V. J. Brüssow <cvjb@cvjb.de>
|
|
Karsten Hopp |
174d41 |
" Last Change: Sa 09 Feb 2008 13:27:29 CET
|
|
Karsten Hopp |
174d41 |
" Filenames: *.fs,*.ft
|
|
Karsten Hopp |
174d41 |
" URL: http://www.cvjb.de/comp/vim/forth.vim
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" $Id$
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" The list of keywords is incomplete, compared with the offical ANS
|
|
Karsten Hopp |
174d41 |
" wordlist. If you use this language, please improve it, and send me
|
|
Karsten Hopp |
174d41 |
" the patches.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" Before sending me patches, please download the newest version of this file
|
|
Karsten Hopp |
174d41 |
" from http://www.cvjb.de/comp/vim/forth.vim or http://www.vim.org/ (search
|
|
Karsten Hopp |
174d41 |
" for forth.vim).
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Many Thanks to...
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2008-02-09:
|
|
Karsten Hopp |
174d41 |
" Shawn K. Quinn <sjquinn at speakeasy dot net> send a big patch with
|
|
Karsten Hopp |
174d41 |
" new words commonly used in Forth programs or defined by GNU Forth.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2007-07-11:
|
|
Karsten Hopp |
174d41 |
" Benjamin Krill <ben at codiert dot org> send me a patch
|
|
Karsten Hopp |
174d41 |
" to highlight space errors.
|
|
Karsten Hopp |
174d41 |
" You can toggle this feature on through setting the
|
|
Karsten Hopp |
174d41 |
" flag forth_space_errors in you vimrc. If you have switched it on,
|
|
Karsten Hopp |
174d41 |
" you can turn off highlighting of trailing spaces in comments by
|
|
Karsten Hopp |
174d41 |
" setting forth_no_trail_space_error in your vimrc. If you do not want
|
|
Karsten Hopp |
174d41 |
" the highlighting of a tabulator following a space in comments, you
|
|
Karsten Hopp |
174d41 |
" can turn this off by setting forth_no_tab_space_error.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2006-05-25:
|
|
Karsten Hopp |
174d41 |
" Bill McCarthy <WJMc@...> and Ilya Sher <ilya-vim@...>
|
|
Karsten Hopp |
174d41 |
" Who found a bug in the ccomment line in 2004!!!
|
|
Karsten Hopp |
174d41 |
" I'm really very sorry, that it has taken two years to fix that
|
|
Karsten Hopp |
174d41 |
" in the offical version of this file. Shame on me.
|
|
Karsten Hopp |
174d41 |
" I think my face will be red the next ten years...
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2006-05-21:
|
|
Karsten Hopp |
174d41 |
" Thomas E. Vaughan <tevaugha at ball dot com> send me a patch
|
|
Karsten Hopp |
174d41 |
" for the parenthesis comment word, so words with a trailing
|
|
Karsten Hopp |
174d41 |
" parenthesis will not start the highlighting for such comments.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2003-05-10:
|
|
Karsten Hopp |
174d41 |
" Andrew Gaul <andrew at gaul.org> send me a patch for
|
|
Karsten Hopp |
174d41 |
" forthOperators.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2003-04-03:
|
|
Karsten Hopp |
174d41 |
" Ron Aaron <ron at ronware dot org> made updates for an
|
|
Karsten Hopp |
174d41 |
" improved Win32Forth support.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2002-04-22:
|
|
Karsten Hopp |
174d41 |
" Charles Shattuck <charley at forth dot org> helped me to settle up with the
|
|
Karsten Hopp |
174d41 |
" binary and hex number highlighting.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2002-04-20:
|
|
Karsten Hopp |
174d41 |
" Charles Shattuck <charley at forth dot org> send me some code for correctly
|
|
Karsten Hopp |
174d41 |
" highlighting char and [char] followed by an opening paren. He also added
|
|
Karsten Hopp |
174d41 |
" some words for operators, conditionals, and definitions; and added the
|
|
Karsten Hopp |
174d41 |
" highlighting for s" and c".
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
" 2000-03-28:
|
|
Karsten Hopp |
174d41 |
" John Providenza <john at probo dot com> made improvements for the
|
|
Karsten Hopp |
174d41 |
" highlighting of strings, and added the code for highlighting hex numbers.
|
|
Karsten Hopp |
174d41 |
"
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" For version 5.x: Clear all syntax items
|
|
Karsten Hopp |
174d41 |
" For version 6.x: Quit when a syntax file was already loaded
|
|
Karsten Hopp |
174d41 |
if version < 600
|
|
Karsten Hopp |
174d41 |
syntax clear
|
|
Karsten Hopp |
174d41 |
elseif exists("b:current_syntax")
|
|
Karsten Hopp |
174d41 |
finish
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Synchronization method
|
|
Karsten Hopp |
174d41 |
syn sync ccomment
|
|
Karsten Hopp |
174d41 |
syn sync maxlines=200
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" I use gforth, so I set this to case ignore
|
|
Karsten Hopp |
174d41 |
syn case ignore
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Some special, non-FORTH keywords
|
|
Karsten Hopp |
174d41 |
syn keyword forthTodo contained TODO FIXME XXX
|
|
Karsten Hopp |
174d41 |
syn match forthTodo contained 'Copyright\(\s([Cc])\)\=\(\s[0-9]\{2,4}\)\='
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Characters allowed in keywords
|
|
Karsten Hopp |
174d41 |
" I don't know if 128-255 are allowed in ANS-FORTH
|
|
Karsten Hopp |
174d41 |
if version >= 600
|
|
Karsten Hopp |
174d41 |
setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
|
|
Karsten Hopp |
174d41 |
else
|
|
Karsten Hopp |
174d41 |
set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" when wanted, highlight trailing white space
|
|
Karsten Hopp |
174d41 |
if exists("forth_space_errors")
|
|
Karsten Hopp |
174d41 |
if !exists("forth_no_trail_space_error")
|
|
Karsten Hopp |
174d41 |
syn match forthSpaceError display excludenl "\s\+$"
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
if !exists("forth_no_tab_space_error")
|
|
Karsten Hopp |
174d41 |
syn match forthSpaceError display " \+\t"me=e-1
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Keywords
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" basic mathematical and logical operators
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators + - * / MOD /MOD NEGATE ABS MIN MAX
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators AND OR XOR NOT LSHIFT RSHIFT INVERT 2* 2/ 1+
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators 1- 2+ 2- 8* UNDER+
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators M+ */ */MOD M* UM* M*/ UM/MOD FM/MOD SM/REM
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators D+ D- DNEGATE DABS DMIN DMAX D2* D2/
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators F+ F- F* F/ FNEGATE FABS FMAX FMIN FLOOR FROUND
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators F** FSQRT FEXP FEXPM1 FLN FLNP1 FLOG FALOG FSIN
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators FCOS FSINCOS FTAN FASIN FACOS FATAN FATAN2 FSINH
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators FCOSH FTANH FASINH FACOSH FATANH F2* F2/ 1/F
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators F~REL F~ABS F~
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators 0< 0<= 0<> 0= 0> 0>= < <= <> = > >= U< U<=
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators U> U>= D0< D0<= D0<> D0= D0> D0>= D< D<= D<>
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators D= D> D>= DU< DU<= DU> DU>= WITHIN ?NEGATE
|
|
Karsten Hopp |
174d41 |
syn keyword forthOperators ?DNEGATE
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" stack manipulations
|
|
Karsten Hopp |
174d41 |
syn keyword forthStack DROP NIP DUP OVER TUCK SWAP ROT -ROT ?DUP PICK ROLL
|
|
Karsten Hopp |
174d41 |
syn keyword forthStack 2DROP 2NIP 2DUP 2OVER 2TUCK 2SWAP 2ROT 2-ROT
|
|
Karsten Hopp |
174d41 |
syn keyword forthStack 3DUP 4DUP 5DUP 3DROP 4DROP 5DROP 8DROP 4SWAP 4ROT
|
|
Karsten Hopp |
174d41 |
syn keyword forthStack 4-ROT 4TUCK 8SWAP 8DUP
|
|
Karsten Hopp |
174d41 |
syn keyword forthRStack >R R> R@ RDROP 2>R 2R> 2R@ 2RDROP
|
|
Karsten Hopp |
174d41 |
syn keyword forthRstack 4>R 4R> 4R@ 4RDROP
|
|
Karsten Hopp |
174d41 |
syn keyword forthFStack FDROP FNIP FDUP FOVER FTUCK FSWAP FROT
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" stack pointer manipulations
|
|
Karsten Hopp |
174d41 |
syn keyword forthSP SP@ SP! FP@ FP! RP@ RP! LP@ LP!
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" address operations
|
|
Karsten Hopp |
174d41 |
syn keyword forthMemory @ ! +! C@ C! 2@ 2! F@ F! SF@ SF! DF@ DF!
|
|
Karsten Hopp |
174d41 |
syn keyword forthAdrArith CHARS CHAR+ CELLS CELL+ CELL ALIGN ALIGNED FLOATS
|
|
Karsten Hopp |
174d41 |
syn keyword forthAdrArith FLOAT+ FLOAT FALIGN FALIGNED SFLOATS SFLOAT+
|
|
Karsten Hopp |
174d41 |
syn keyword forthAdrArith SFALIGN SFALIGNED DFLOATS DFLOAT+ DFALIGN DFALIGNED
|
|
Karsten Hopp |
174d41 |
syn keyword forthAdrArith MAXALIGN MAXALIGNED CFALIGN CFALIGNED
|
|
Karsten Hopp |
174d41 |
syn keyword forthAdrArith ADDRESS-UNIT-BITS ALLOT ALLOCATE HERE
|
|
Karsten Hopp |
174d41 |
syn keyword forthMemBlks MOVE ERASE CMOVE CMOVE> FILL BLANK
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" conditionals
|
|
Karsten Hopp |
174d41 |
syn keyword forthCond IF ELSE ENDIF THEN CASE OF ENDOF ENDCASE ?DUP-IF
|
|
Karsten Hopp |
174d41 |
syn keyword forthCond ?DUP-0=-IF AHEAD CS-PICK CS-ROLL CATCH THROW WITHIN
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" iterations
|
|
Karsten Hopp |
174d41 |
syn keyword forthLoop BEGIN WHILE REPEAT UNTIL AGAIN
|
|
Karsten Hopp |
174d41 |
syn keyword forthLoop ?DO LOOP I J K +DO U+DO -DO U-DO DO +LOOP -LOOP
|
|
Karsten Hopp |
174d41 |
syn keyword forthLoop UNLOOP LEAVE ?LEAVE EXIT DONE FOR NEXT
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" new words
|
|
Karsten Hopp |
174d41 |
syn match forthClassDef '\<:class\s*[^ \t]\+\>'
|
|
Karsten Hopp |
174d41 |
syn match forthObjectDef '\<:object\s*[^ \t]\+\>'
|
|
Karsten Hopp |
174d41 |
syn match forthColonDef '\<:m\?\s*[^ \t]\+\>'
|
|
Karsten Hopp |
174d41 |
syn keyword forthEndOfColonDef ; ;M ;m
|
|
Karsten Hopp |
174d41 |
syn keyword forthEndOfClassDef ;class
|
|
Karsten Hopp |
174d41 |
syn keyword forthEndOfObjectDef ;object
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine CONSTANT 2CONSTANT FCONSTANT VARIABLE 2VARIABLE
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine FVARIABLE CREATE USER VALUE TO DEFER IS DOES> IMMEDIATE
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine COMPILE-ONLY COMPILE RESTRICT INTERPRET POSTPONE EXECUTE
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine LITERAL CREATE-INTERPRET/COMPILE INTERPRETATION>
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine <INTERPRETATION COMPILATION>
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine COMP' POSTPONE, FIND-NAME NAME>INT NAME?INT NAME>COMP
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine NAME>STRING STATE C; CVARIABLE
|
|
Karsten Hopp |
174d41 |
syn keyword forthDefine , 2, F, C,
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[IFDEF]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[IFUNDEF]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[THEN]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[ENDIF]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[ELSE]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[?DO]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[DO]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[LOOP]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[+LOOP]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[NEXT]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[BEGIN]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[UNTIL]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[AGAIN]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[WHILE]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[REPEAT]"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[COMP']"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "'"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine '\<\[\>'
|
|
Karsten Hopp |
174d41 |
syn match forthDefine "\[']"
|
|
Karsten Hopp |
174d41 |
syn match forthDefine '\[COMPILE]'
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" debugging
|
|
Karsten Hopp |
174d41 |
syn keyword forthDebug PRINTDEBUGDATA PRINTDEBUGLINE
|
|
Karsten Hopp |
174d41 |
syn match forthDebug "\<\~\~\>"
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Assembler
|
|
Karsten Hopp |
174d41 |
syn keyword forthAssembler ASSEMBLER CODE END-CODE ;CODE FLUSH-ICACHE C,
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" basic character operations
|
|
Karsten Hopp |
174d41 |
syn keyword forthCharOps (.) CHAR EXPECT FIND WORD TYPE -TRAILING EMIT KEY
|
|
Karsten Hopp |
174d41 |
syn keyword forthCharOps KEY? TIB CR
|
|
Karsten Hopp |
174d41 |
" recognize 'char (' or '[char] (' correctly, so it doesn't
|
|
Karsten Hopp |
174d41 |
" highlight everything after the paren as a comment till a closing ')'
|
|
Karsten Hopp |
174d41 |
syn match forthCharOps '\
|
|
Karsten Hopp |
174d41 |
syn match forthCharOps '\<\[char\]\s\S\s'
|
|
Karsten Hopp |
174d41 |
syn region forthCharOps start=+."\s+ skip=+\\"+ end=+"+
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" char-number conversion
|
|
Karsten Hopp |
174d41 |
syn keyword forthConversion <<# <# # #> #>> #S (NUMBER) (NUMBER?) CONVERT D>F
|
|
Karsten Hopp |
174d41 |
syn keyword forthConversion D>S DIGIT DPL F>D HLD HOLD NUMBER S>D SIGN >NUMBER
|
|
Karsten Hopp |
174d41 |
syn keyword forthConversion F>S S>F
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" interptreter, wordbook, compiler
|
|
Karsten Hopp |
174d41 |
syn keyword forthForth (LOCAL) BYE COLD ABORT >BODY >NEXT >LINK CFA >VIEW HERE
|
|
Karsten Hopp |
174d41 |
syn keyword forthForth PAD WORDS VIEW VIEW> N>LINK NAME> LINK> L>NAME FORGET
|
|
Karsten Hopp |
174d41 |
syn keyword forthForth BODY> ASSERT( ASSERT0( ASSERT1( ASSERT2( ASSERT3( )
|
|
Karsten Hopp |
174d41 |
syn region forthForth start=+ABORT"\s+ skip=+\\"+ end=+"+
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" vocabularies
|
|
Karsten Hopp |
174d41 |
syn keyword forthVocs ONLY FORTH ALSO ROOT SEAL VOCS ORDER CONTEXT #VOCS
|
|
Karsten Hopp |
174d41 |
syn keyword forthVocs VOCABULARY DEFINITIONS
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" File keywords
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileMode R/O R/W W/O BIN
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileWords OPEN-FILE CREATE-FILE CLOSE-FILE DELETE-FILE
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileWords RENAME-FILE READ-FILE READ-LINE KEY-FILE
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileWords KEY?-FILE WRITE-FILE WRITE-LINE EMIT-FILE
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileWords FLUSH-FILE FILE-STATUS FILE-POSITION
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileWords REPOSITION-FILE FILE-SIZE RESIZE-FILE
|
|
Karsten Hopp |
174d41 |
syn keyword forthFileWords SLURP-FILE SLURP-FID STDIN STDOUT STDERR
|
|
Karsten Hopp |
174d41 |
syn keyword forthBlocks OPEN-BLOCKS USE LOAD --> BLOCK-OFFSET
|
|
Karsten Hopp |
174d41 |
syn keyword forthBlocks GET-BLOCK-FID BLOCK-POSITION LIST SCR BLOCK
|
|
Karsten Hopp |
174d41 |
syn keyword forthBlocks BUFER EMPTY-BUFFERS EMPTY-BUFFER UPDATE UPDATED?
|
|
Karsten Hopp |
174d41 |
syn keyword forthBlocks SAVE-BUFFERS SAVE-BUFFER FLUSH THRU +LOAD +THRU
|
|
Karsten Hopp |
174d41 |
syn keyword forthBlocks BLOCK-INCLUDED
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" numbers
|
|
Karsten Hopp |
174d41 |
syn keyword forthMath DECIMAL HEX BASE
|
|
Karsten Hopp |
174d41 |
syn match forthInteger '\<-\=[0-9.]*[0-9.]\+\>'
|
|
Karsten Hopp |
174d41 |
syn match forthInteger '\<&-\=[0-9.]*[0-9.]\+\>'
|
|
Karsten Hopp |
174d41 |
" recognize hex and binary numbers, the '$' and '%' notation is for gforth
|
|
Karsten Hopp |
174d41 |
syn match forthInteger '\<\$\x*\x\+\>' " *1* --- dont't mess
|
|
Karsten Hopp |
174d41 |
syn match forthInteger '\<\x*\d\x*\>' " *2* --- this order!
|
|
Karsten Hopp |
174d41 |
syn match forthInteger '\<%[0-1]*[0-1]\+\>'
|
|
Karsten Hopp |
174d41 |
syn match forthFloat '\<-\=\d*[.]\=\d\+[DdEe]\d\+\>'
|
|
Karsten Hopp |
174d41 |
syn match forthFloat '\<-\=\d*[.]\=\d\+[DdEe][-+]\d\+\>'
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" XXX If you find this overkill you can remove it. this has to come after the
|
|
Karsten Hopp |
174d41 |
" highlighting for numbers otherwise it has no effect.
|
|
Karsten Hopp |
174d41 |
syn region forthComment start='0 \[if\]' end='\[endif\]' end='\[then\]' contains=forthTodo
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Strings
|
|
Karsten Hopp |
174d41 |
syn region forthString start=+\.*\"+ end=+"+ end=+$+
|
|
Karsten Hopp |
174d41 |
" XXX
|
|
Karsten Hopp |
174d41 |
syn region forthString start=+s\"+ end=+"+ end=+$+
|
|
Karsten Hopp |
174d41 |
syn region forthString start=+c\"+ end=+"+ end=+$+
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Comments
|
|
Karsten Hopp |
174d41 |
syn match forthComment '\\\s.*$' contains=forthTodo,forthSpaceError
|
|
Karsten Hopp |
174d41 |
syn region forthComment start='\\S\s' end='.*' contains=forthTodo,forthSpaceError
|
|
Karsten Hopp |
174d41 |
syn match forthComment '\.(\s[^)]*)' contains=forthTodo,forthSpaceError
|
|
Karsten Hopp |
174d41 |
syn region forthComment start='\s(\s' skip='\\)' end=')' contains=forthTodo,forthSpaceError
|
|
Karsten Hopp |
174d41 |
syn region forthComment start='/\*' end='\*/' contains=forthTodo,forthSpaceError
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Include files
|
|
Karsten Hopp |
174d41 |
syn match forthInclude '^INCLUDE\s\+\k\+'
|
|
Karsten Hopp |
174d41 |
syn match forthInclude '^require\s\+\k\+'
|
|
Karsten Hopp |
174d41 |
syn match forthInclude '^fload\s\+'
|
|
Karsten Hopp |
174d41 |
syn match forthInclude '^needs\s\+'
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Locals definitions
|
|
Karsten Hopp |
174d41 |
syn region forthLocals start='{\s' start='{$' end='\s}' end='^}'
|
|
Karsten Hopp |
174d41 |
syn match forthLocals '{ }' " otherwise, at least two spaces between
|
|
Karsten Hopp |
174d41 |
syn region forthDeprecated start='locals|' end='|'
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" Define the default highlighting.
|
|
Karsten Hopp |
174d41 |
" For version 5.7 and earlier: only when not done already
|
|
Karsten Hopp |
174d41 |
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
Karsten Hopp |
174d41 |
if version >= 508 || !exists("did_forth_syn_inits")
|
|
Karsten Hopp |
174d41 |
if version < 508
|
|
Karsten Hopp |
174d41 |
let did_forth_syn_inits = 1
|
|
Karsten Hopp |
174d41 |
command -nargs=+ HiLink hi link <args>
|
|
Karsten Hopp |
174d41 |
else
|
|
Karsten Hopp |
174d41 |
command -nargs=+ HiLink hi def link <args>
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" The default methods for highlighting. Can be overriden later.
|
|
Karsten Hopp |
174d41 |
HiLink forthTodo Todo
|
|
Karsten Hopp |
174d41 |
HiLink forthOperators Operator
|
|
Karsten Hopp |
174d41 |
HiLink forthMath Number
|
|
Karsten Hopp |
174d41 |
HiLink forthInteger Number
|
|
Karsten Hopp |
174d41 |
HiLink forthFloat Float
|
|
Karsten Hopp |
174d41 |
HiLink forthStack Special
|
|
Karsten Hopp |
174d41 |
HiLink forthRstack Special
|
|
Karsten Hopp |
174d41 |
HiLink forthFStack Special
|
|
Karsten Hopp |
174d41 |
HiLink forthSP Special
|
|
Karsten Hopp |
174d41 |
HiLink forthMemory Function
|
|
Karsten Hopp |
174d41 |
HiLink forthAdrArith Function
|
|
Karsten Hopp |
174d41 |
HiLink forthMemBlks Function
|
|
Karsten Hopp |
174d41 |
HiLink forthCond Conditional
|
|
Karsten Hopp |
174d41 |
HiLink forthLoop Repeat
|
|
Karsten Hopp |
174d41 |
HiLink forthColonDef Define
|
|
Karsten Hopp |
174d41 |
HiLink forthEndOfColonDef Define
|
|
Karsten Hopp |
174d41 |
HiLink forthDefine Define
|
|
Karsten Hopp |
174d41 |
HiLink forthDebug Debug
|
|
Karsten Hopp |
174d41 |
HiLink forthAssembler Include
|
|
Karsten Hopp |
174d41 |
HiLink forthCharOps Character
|
|
Karsten Hopp |
174d41 |
HiLink forthConversion String
|
|
Karsten Hopp |
174d41 |
HiLink forthForth Statement
|
|
Karsten Hopp |
174d41 |
HiLink forthVocs Statement
|
|
Karsten Hopp |
174d41 |
HiLink forthString String
|
|
Karsten Hopp |
174d41 |
HiLink forthComment Comment
|
|
Karsten Hopp |
174d41 |
HiLink forthClassDef Define
|
|
Karsten Hopp |
174d41 |
HiLink forthEndOfClassDef Define
|
|
Karsten Hopp |
174d41 |
HiLink forthObjectDef Define
|
|
Karsten Hopp |
174d41 |
HiLink forthEndOfObjectDef Define
|
|
Karsten Hopp |
174d41 |
HiLink forthInclude Include
|
|
Karsten Hopp |
174d41 |
HiLink forthLocals Type " nothing else uses type and locals must stand out
|
|
Karsten Hopp |
174d41 |
HiLink forthDeprecated Error " if you must, change to Type
|
|
Karsten Hopp |
174d41 |
HiLink forthFileMode Function
|
|
Karsten Hopp |
174d41 |
HiLink forthFileWords Statement
|
|
Karsten Hopp |
174d41 |
HiLink forthBlocks Statement
|
|
Karsten Hopp |
174d41 |
HiLink forthSpaceError Error
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
delcommand HiLink
|
|
Karsten Hopp |
174d41 |
endif
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
let b:current_syntax = "forth"
|
|
Karsten Hopp |
174d41 |
|
|
Karsten Hopp |
174d41 |
" vim:ts=8:sw=4:nocindent:smartindent:
|