home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim55rt.sit / runtime / syntax / forth.vim < prev    next >
Encoding:
Text File  |  1999-09-25  |  5.0 KB  |  133 lines  |  [TEXT/VIM!]

  1. " Vim syntax file
  2. " Language   : FORTH
  3. " Maintainer : Christian V. J. Br=FCssow <cvjb@bigfoot.de>
  4. " Last change: Fre 18 Jun 1999 13:44:14 MEST
  5.  
  6. " The list of keywords is incomplete, compared with the offical ANS
  7. " wordlist. If you use this language, please improve it, and send me
  8. " the patches.
  9.  
  10. " Remove any old syntax stuff hanging around
  11. syn clear
  12.  
  13. " Synchronization method
  14. syn sync ccomment maxlines=200
  15.  
  16. " Forth is not case sensitive
  17. syn case ignore
  18.  
  19. " Some special, non-FORTH keywords
  20. syn keyword forthTodo contained TODO FIXME XXX FSF
  21. syn match forthTodo contained 'Copyright\(\s([Cc])\)\=\(\s[0-9]\{2,4}\)\=\s\='
  22. syn match forthTodo contained 'Free\sSoftware\sFoundation\(,\sInc[.]\=\)\='
  23.  
  24. " Characters allowed in keywords
  25. " I don't know if 128-255 are allowed in ANS-FORHT
  26. set iskeyword=!,@,33-64,A-Z,91-96,a-z,123-126,128-255
  27.  
  28. " Keywords
  29.  
  30. " * basic (return)stack manipulation and control words
  31. syn keyword forthStack -ROT . .R .S 2DROP 2DUP 2OVER 2ROT 2SWAP 3DUP 4DUP
  32. syn keyword forthStack ?DUP D. D.R DEPTH DROP DUP F. FDEPTH FDUP FDROP FE. FLIP
  33. syn keyword forthStack FOVER FROT FS. FSWAP NIP OVER PICK ROLL ROT SP0 SP@
  34. syn keyword forthStack SWAP TOS TUCK U. U.R UD. UD.R
  35. syn keyword forthRStack 2>R 2R> 2R@ >R R> R@ RP0 RP@ TOR
  36.  
  37. " * basic character operations
  38. syn keyword forthCharOps (.) -TRAILING /STRING ?UPPERCASE ASCII BL CAPS CAPS-COMP
  39. syn keyword forthCharOps CHAR CHAR+ CHARS COMP COMPARE CONTROL COUNT CR EMIT EMIT?
  40. syn keyword forthCharOps EXPECT FIND KEY KEY? LENGTH SPACE SPACES TYPE UPC UPPER
  41. syn keyword forthCharOps WORD
  42.  
  43. " * char-number converion
  44. syn keyword forthConversion <# # #> #S (NUMBER) (NUMBER?) CONVERT D>F D>S DIGIT DPL
  45. syn keyword forthConversion F>D HLD HOLD NUMBER S>D SIGN
  46.  
  47. " * Interptreter, Wordbook, Compiler
  48. syn keyword forthForth ABORT ALLOCATE ASSEMBLER BASE BYE COLD DECIMAL DEBUG
  49. syn keyword forthForth DUMP EXECUTE EXIT HERE HEX INTERPRET NOOP PAD PERFORM QUERY
  50. syn keyword forthForth QUIT SEARCH SEE VIEW WORDS
  51. syn region forthForth start=+ABORT"+ skip=+\\"+ end=+"+
  52.  
  53. " * Vocabularies
  54. syn keyword forthVocs ALSO FORTH ONLY ORDER ROOT SEAL USER VOCS
  55.  
  56. " * basic mathematical and logical operators
  57. syn keyword forthOperators = * */ */MOD *D + - / /MOD 1+ 1- 2* 2+ 2- 2/ 8* ABS AND
  58. syn keyword forthOperators D+ D- D2* D2/ DABS F* F** F+ F- F/ FABS FM/MOD LSHIFT
  59. syn keyword forthOperators M* M*/ M+ M/MOD MOD NOT OR RSHIFT U*D D2/ UM* UM/MOD XOR
  60.  
  61. " * basic address operations
  62. syn keyword forthAdrOps ! ' +! , .ID 2! 2@ >BODY >FLOAT >IN >LINK >NAME >NEXT
  63. syn keyword forthAdrOps >NUMBER >VIEW @ ALLOT BLANK BODY> BOUNDS C! C, C@ CMOVE
  64. syn keyword forthAdrOps CMOVE> CRESET CSET CTOGGLE ERASE DF! DF@ F! F@ FILL L>NAME
  65. syn keyword forthAdrOps LINK> MOVE N>LINK SF! SF@ VIEW>
  66.  
  67. " * Iterations
  68. syn keyword forthIteration +LOOP ?DO ?LEAVE AGAIN BEGIN DO ENDOF I J LEAVE LOOP OF
  69. syn keyword forthIteration RECURSE RECURSIVE REPEAT UNLOOP UNTIL WHILE
  70.  
  71. " * Conditionals
  72. syn keyword forthConditional ?BRANCH BRANCH CASE ELSE ENDCASE ENDIF IF THEN
  73. syn keyword forthConditional 0< 0<= 0<> 0= 0> 0>= < <= <> > >= BETWEEN D0< D0=
  74. syn keyword forthConditional D< D= D> DU< F0< F0= F< FALSE OFF ON TRUE
  75. syn keyword forthConditional U< U<= U> U>=
  76.  
  77. " Numbers
  78. syn match forthInteger '\<-\=[0-9.]*[0-9]\+\>'
  79. syn match forthFloat '\<-\=[0-9]*[.]\=[0-9]\+[Ee][0-9]\+\>'
  80.  
  81. " Comments
  82. syn match forthComment '\\\s.*$' contains=forthTodo
  83. syn region forthComment start='\\S\s' end='.*' contains=forthTodo
  84. syn match forthComment '\.(\s[^)]*)' contains=forthTodo
  85. syn region forthComment start='(\s' skip='\\)' end=')' contains=forthTodo
  86. "syn match forthComment '(\s[^\-]*\-\-[^\-]*)' contains=forthTodo
  87.  
  88. " Include files
  89. syn match forthInclude '^INCLUDE\s\+\k\+'
  90.  
  91. " Definition of new words
  92. syn match forthColonDef '\<:\s*[^ \t]\+\>'
  93. syn keyword forthEndOfColonDef ;
  94. syn keyword forthDefine ;CODE ;USES 2CONSTANT 2VARIABLE 2LITERAL ACTIVATE
  95. syn keyword forthDefine ASSOCIATIVE: BACKGROUND: CASE: CODE COMPILE COMPILE,
  96. syn keyword forthDefine CONSTANT CREATE DEFER DEFINITIONS DLITERAL DOES>
  97. syn keyword forthDefine FCONSTANT FLITERAL FORGET FVARIABLE IMMEDIATE IS
  98. syn keyword forthDefine LITERAL SLITERAL TASK: VARIABLE VOCABULARY ]
  99. syn match forthDefine '\<\[\>'
  100. syn match forthDefine "\[']"
  101. syn match forthDefine '\[COMPILE]'
  102.  
  103. " Strings
  104. syn region forthString start=+\.\"+ skip=+\\"+ end=+"+
  105.  
  106. if !exists("did_forth_syntax")
  107.     let did_forth_syntax = 1
  108.     " The default methods for highlighting. Can be overriden later.
  109.     hi link forthTodo Todo
  110.     hi link forthInteger Number
  111.     hi link forthFloat Float
  112.     hi link forthComment Comment
  113.     hi link forthInclude Include
  114.     hi link forthString String
  115.     hi link forthStack Number
  116.     hi link forthRStack Number
  117.     hi link forthCharOps Character
  118.     hi link forthConversion SpecialChar
  119.     hi link forthForth Special
  120.     hi link forthVocs Special
  121.     hi link forthOperators Operator
  122.     hi link forthAdrOps Operator
  123.     hi link forthIteration Repeat
  124.     hi link forthConditional Conditional
  125.     hi link forthColonDef Define
  126.     hi link forthEndOfColonDef forthColonDef
  127.     hi link forthDefine forthColonDef
  128. endif
  129.  
  130. let b:current_syntax = "forth"
  131.  
  132. " vim:ts=3:sw=3
  133.