antlr.vim 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. " Vim syntax file
  2. " Antlr: ANTLR, Another Tool For Language Recognition <www.antlr.org>
  3. " Maintainer: Mathieu Clabaut <mathieu.clabaut@free.fr>
  4. " LastChange: 02 May 2001
  5. " Original: Comes from JavaCC.vim
  6. " quit when a syntax file was already loaded
  7. if exists("b:current_syntax")
  8. finish
  9. endif
  10. " This syntac file is a first attempt. It is far from perfect...
  11. " Uses java.vim, and adds a few special things for JavaCC Parser files.
  12. " Those files usually have the extension *.jj
  13. " source the java.vim file
  14. runtime! syntax/java.vim
  15. unlet b:current_syntax
  16. "remove catching errors caused by wrong parenthesis (does not work in antlr
  17. "files) (first define them in case they have not been defined in java)
  18. syn match javaParen "--"
  19. syn match javaParenError "--"
  20. syn match javaInParen "--"
  21. syn match javaError2 "--"
  22. syn clear javaParen
  23. syn clear javaParenError
  24. syn clear javaInParen
  25. syn clear javaError2
  26. " remove function definitions (they look different) (first define in
  27. " in case it was not defined in java.vim)
  28. "syn match javaFuncDef "--"
  29. "syn clear javaFuncDef
  30. "syn match javaFuncDef "[a-zA-Z][a-zA-Z0-9_. \[\]]*([^-+*/()]*)[ \t]*:" contains=javaType
  31. " syn region javaFuncDef start=+t[a-zA-Z][a-zA-Z0-9_. \[\]]*([^-+*/()]*,[ ]*+ end=+)[ \t]*:+
  32. syn keyword antlrPackages options language buildAST
  33. syn match antlrPackages "PARSER_END([^)]*)"
  34. syn match antlrPackages "PARSER_BEGIN([^)]*)"
  35. syn match antlrSpecToken "<EOF>"
  36. " the dot is necessary as otherwise it will be matched as a keyword.
  37. syn match antlrSpecToken ".LOOKAHEAD("ms=s+1,me=e-1
  38. syn match antlrSep "[|:]\|\.\."
  39. syn keyword antlrActionToken TOKEN SKIP MORE SPECIAL_TOKEN
  40. syn keyword antlrError DEBUG IGNORE_IN_BNF
  41. hi def link antlrSep Statement
  42. hi def link antlrPackages Statement
  43. let b:current_syntax = "antlr"
  44. " vim: ts=8