home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / matlab.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  3.1 KB  |  95 lines

  1. " Vim syntax file
  2. " Language:    Matlab
  3. " Maintainer:    Preben "Peppe" Guldberg <c928400@student.dtu.dk>
  4. "        Original author: Mario Eusebio
  5. " Last change:    Tue Jul 28 17:44:06 1998
  6.  
  7. " Remove any old syntax stuff hanging around
  8. syn clear
  9.  
  10. syn keyword matlabStatement        return
  11. syn keyword matlabLabel            case switch
  12. syn keyword matlabConditional        else elseif end if otherwise
  13. syn keyword matlabRepeat        do for while
  14.  
  15. syn keyword matlabTodo            contained  TODO
  16.  
  17. " If you do not want these operators lit, uncommment them and the "hi link" below
  18. syn match matlabArithmeticOperator    "[-+]"
  19. syn match matlabArithmeticOperator    "\.\=[*/\\^]"
  20. syn match matlabRelationalOperator    "[=~]="
  21. syn match matlabRelationalOperator    "[<>]=\="
  22. syn match matlabLogicalOperator        "[&|~]"
  23.  
  24. syn match matlabLineContinuation    "\.\{3}"
  25.  
  26. "syn match matlabIdentifier        "\<\a\w*\>"
  27.  
  28. " String
  29. syn region matlabString            start=+'+ end=+'+    oneline
  30.  
  31. " If you don't like tabs
  32. syn match matlabTab            "\t"
  33.  
  34. " Standard numbers
  35. syn match matlabNumber        "\<\d\+[ij]\=\>"
  36. " floating point number, with dot, optional exponent
  37. syn match matlabFloat        "\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>"
  38. " floating point number, starting with a dot, optional exponent
  39. syn match matlabFloat        "\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>"
  40.  
  41. " Transpose character and delimiters: Either use just [...] or (...) aswell
  42. syn match matlabDelimiter        "[][]"
  43. "syn match matlabDelimiter        "[][()]"
  44. syn match matlabTransposeOperator    "[])a-zA-Z0-9.]'"lc=1
  45.  
  46. syn match matlabSemicolon        ";"
  47.  
  48. syn match matlabComment            "%.*$"    contains=matlabTodo,matlabTab
  49.  
  50. syn keyword matlabOperator        break zeros default margin round ones rand
  51. syn keyword matlabOperator        ceil floor size clear zeros eye mean std cov
  52.  
  53. syn keyword matlabFunction        error eval function
  54.  
  55. syn keyword matlabImplicit        abs acos atan asin cos cosh exp log prod sum
  56. syn keyword matlabImplicit        log10 max min sign sin sqrt tan reshape
  57.  
  58. syn match matlabError    "-\=\<\d\+\.\d\+\.[^*/\\^]"
  59. syn match matlabError    "-\=\<\d\+\.\d\+[eEdD][-+]\=\d\+\.\([^*/\\^]\)"
  60.  
  61. if !exists("did_matlab_syntax_inits")
  62.   let did_matlab_syntax_inits = 1
  63.   " The default methods for highlighting.  Can be overridden later
  64.   hi link matlabTransposeOperator    matlabOperator
  65.   hi link matlabOperator        Operator
  66.   hi link matlabLineContinuation    Special
  67.   hi link matlabLabel            Label
  68.   hi link matlabConditional        Conditional
  69.   hi link matlabRepeat            Repeat
  70.   hi link matlabTodo            Todo
  71.   hi link matlabString            String
  72.   hi link matlabDelimiter        Identifier
  73.   hi link matlabTransposeOther        Identifier
  74.   hi link matlabNumber            Number
  75.   hi link matlabFloat            Float
  76.   hi link matlabFunction        Function
  77.   hi link matlabError            Error
  78.   hi link matlabImplicit        matlabStatement
  79.   hi link matlabStatement        Statement
  80.   hi link matlabSemicolon        SpecialChar
  81.   hi link matlabComment            Comment
  82.  
  83.   hi link matlabArithmeticOperator    matlabOperator
  84.   hi link matlabRelationalOperator    matlabOperator
  85.   hi link matlabLogicalOperator        matlabOperator
  86.  
  87. "optional highlighting
  88.   "hi link matlabIdentifier        Identifier
  89.   "hi link matlabTab            Error
  90. endif
  91.  
  92. let b:current_syntax = "matlab"
  93.  
  94. "EOF    vim: ts=8 noet tw=100 sw=8 sts=0
  95.