numbat.vim 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. " Numbat.vim - Vim syntax file for Numbat language
  2. if exists("b:current_syntax")
  3. finish
  4. endif
  5. " Numbat Keywords
  6. syn keyword numbatKeywords per to let fn where and dimension unit use struct long short both none if then else true false NaN inf print assert assert_eq type
  7. highlight default link numbatKeywords Keyword
  8. " Physical dimensions (every capitalized word)
  9. syn match numbatDimensions "\<\u\w*\>"
  10. highlight default link numbatDimensions Type
  11. " Variables and units (lowercase words)
  12. " syn match numbatIdentifier "\<\l\w*\>"
  13. " highlight default link numbatIdentifier Identifier
  14. " Comments
  15. syn match numbatComments "#.*"
  16. highlight default link numbatComments Comment
  17. " Digits/Numbers
  18. syn match numbatNumber '\v<0x[0-9a-fA-F]+>'
  19. syn match numbatNumber '\v<0o[0-7]+>'
  20. syn match numbatNumber '\v<0b[01]+>'
  21. syn match numbatNumber '\v<[0-9]+(_[0-9]+)*([eE][+-]?[0-9]+)?>'
  22. syn match numbatNumber '\v<([0-9]*\.[0-9]*|[0-9]*\.[0-9]+)([eE][+-]?[0-9]+)?>'
  23. highlight default link numbatNumber Number
  24. " Operators
  25. syn match numbatOperators "->\|[+*^=/\-:·×÷²³<>]"
  26. highlight default link numbatOperators Operator
  27. " Unit decorators
  28. syn match numbatDecorator "@\w\+"
  29. highlight default link numbatDecorator Constant
  30. " Special units
  31. syn match numbatSpecialUnits "[\u00B0]" " degree symbol
  32. highlight default link numbatSpecialUnits SpecialChar
  33. " Strings
  34. syntax match numbatString /"\([^"]*\)"/
  35. highlight link numbatString String
  36. " Load the matchit.vim script for the "%" matching, if it's available
  37. if exists(":DoMatchIt")
  38. DoMatchIt
  39. endif
  40. setlocal comments=b:#,fb:-
  41. setlocal commentstring=#\ %s
  42. let b:current_syntax = "numbat"