cmod.vim 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. " Vim syntax file
  2. " Language: Cmod
  3. " Current Maintainer: Stephen R. van den Berg <srb@cuci.nl>
  4. " Last Change: 2018 Jan 23
  5. " Version: 2.9
  6. " Remark: Is used to edit Cmod files for Pike development.
  7. " Remark: Includes a highlighter for any embedded Autodoc format.
  8. " quit when a syntax file was already loaded
  9. if exists("b:current_syntax")
  10. finish
  11. endif
  12. let s:cpo_save = &cpo
  13. set cpo&vim
  14. " Read the C syntax to start with
  15. runtime! syntax/c.vim
  16. unlet b:current_syntax
  17. if !exists("c_autodoc")
  18. " For embedded Autodoc documentation
  19. syn include @cmodAutodoc <sfile>:p:h/autodoc.vim
  20. unlet b:current_syntax
  21. endif
  22. " Supports rotating amongst several same-level preprocessor conditionals
  23. packadd! matchit
  24. let b:match_words = "({:}\\@1<=),^\s*#\s*\%(if\%(n\?def\)\|else\|el\%(se\)\?if\|endif\)\>"
  25. " Cmod extensions
  26. syn keyword cmodStatement __INIT INIT EXIT GC_RECURSE GC_CHECK
  27. syn keyword cmodStatement EXTRA OPTIMIZE RETURN
  28. syn keyword cmodStatement ADD_EFUN ADD_EFUN2 ADD_FUNCTION
  29. syn keyword cmodStatement MK_STRING MK_STRING_SVALUE CONSTANT_STRLEN
  30. syn keyword cmodStatement SET_SVAL pop_n_elems pop_stack
  31. syn keyword cmodStatement SIMPLE_ARG_TYPE_ERROR Pike_sp Pike_fp MKPCHARP
  32. syn keyword cmodStatement SET_SVAL_TYPE REF_MAKE_CONST_STRING INC_PCHARP
  33. syn keyword cmodStatement PTR_FROM_INT INHERIT_FROM_PTR
  34. syn keyword cmodStatement DECLARE_CYCLIC BEGIN_CYCLIC END_CYCLIC
  35. syn keyword cmodStatement UPDATE_LOCATION UNSAFE_IS_ZERO SAFE_IS_ZERO
  36. syn keyword cmodStatement MKPCHARP_STR APPLY_MASTER current_storage
  37. syn keyword cmodStatement PIKE_MAP_VARIABLE size_shift
  38. syn keyword cmodStatement THREADS_ALLOW THREADS_DISALLOW
  39. syn keyword cmodStatement add_integer_constant ref_push_object
  40. syn keyword cmodStatement push_string apply_svalue free_svalue
  41. syn keyword cmodStatement get_inherit_storage get_storage
  42. syn keyword cmodStatement make_shared_binary_string push_int64
  43. syn keyword cmodStatement begin_shared_string end_shared_string
  44. syn keyword cmodStatement add_ref fast_clone_object clone_object
  45. syn keyword cmodStatement push_undefined push_int ref_push_string
  46. syn keyword cmodStatement free_string push_ulongest free_object
  47. syn keyword cmodStatement convert_stack_top_to_bignum push_array
  48. syn keyword cmodStatement push_object reduce_stack_top_bignum
  49. syn keyword cmodStatement push_static_text apply_current
  50. syn keyword cmodStatement assign_svalue free_program destruct_object
  51. syn keyword cmodStatement start_new_program low_inherit stack_swap
  52. syn keyword cmodStatement generic_error_program end_program
  53. syn keyword cmodStatement free_array apply_external copy_mapping
  54. syn keyword cmodStatement push_constant_text ref_push_mapping
  55. syn keyword cmodStatement mapping_insert mapping_string_insert_string
  56. syn keyword cmodStatement f_aggregate_mapping f_aggregate apply
  57. syn keyword cmodStatement push_mapping push_svalue low_mapping_lookup
  58. syn keyword cmodStatement assign_svalues_no_free f_add
  59. syn keyword cmodStatement push_empty_string stack_dup assign_lvalue
  60. syn keyword cmodStatement low_mapping_string_lookup allocate_mapping
  61. syn keyword cmodStatement copy_shared_string make_shared_binary_string0
  62. syn keyword cmodStatement f_call_function f_index f_utf8_to_string
  63. syn keyword cmodStatement finish_string_builder init_string_builder
  64. syn keyword cmodStatement reset_string_builder free_string_builder
  65. syn keyword cmodStatement string_builder_putchar get_all_args
  66. syn keyword cmodStatement add_shared_strings check_all_args
  67. syn keyword cmodStatement do_inherit add_string_constant
  68. syn keyword cmodStatement add_program_constant set_init_callback
  69. syn keyword cmodStatement simple_mapping_string_lookup
  70. syn keyword cmodStatement f_sprintf push_text string_has_null
  71. syn keyword cmodStatement end_and_resize_shared_string
  72. syn keyword cmodStatement args sp
  73. syn keyword cmodStatement free
  74. syn keyword cmodConstant ID_PROTECTED ID_FINAL PIKE_DEBUG
  75. syn keyword cmodConstant NUMBER_NUMBER
  76. syn keyword cmodConstant PIKE_T_INT PIKE_T_STRING PIKE_T_ARRAY
  77. syn keyword cmodConstant PIKE_T_MULTISET PIKE_T_OBJECT PIKE_T_MAPPING
  78. syn keyword cmodConstant NUMBER_UNDEFINED PIKE_T_PROGRAM PIKE_T_FUNCTION
  79. syn keyword cmodConstant T_OBJECT T_STRING T_ARRAY T_MAPPING
  80. syn keyword cmodException SET_ONERROR UNSET_ONERROR ONERROR
  81. syn keyword cmodException CALL_AND_UNSET_ONERROR
  82. syn keyword cmodDebug Pike_fatal Pike_error check_stack
  83. syn keyword cmodAccess public protected private INHERIT
  84. syn keyword cmodAccess CTYPE CVAR PIKEVAR PIKEFUN
  85. syn keyword cmodModifier efun export flags optflags optfunc
  86. syn keyword cmodModifier type rawtype errname name c_name prototype
  87. syn keyword cmodModifier program_flags gc_trivial PMOD_EXPORT
  88. syn keyword cmodModifier ATTRIBUTE noclone noinline
  89. syn keyword cmodModifier tOr tFuncV tInt tMix tVoid tStr tMap tPrg
  90. syn keyword cmodModifier tSetvar tArr tMult tMultiset
  91. syn keyword cmodModifier tArray tMapping tString tSetvar tVar
  92. syn keyword cmodType bool mapping string multiset array mixed
  93. syn keyword cmodType object function program auto svalue
  94. syn keyword cmodType bignum longest zero pike_string
  95. syn keyword cmodType this this_program THIS INT_TYPE INT64 INT32
  96. syn keyword cmodType p_wchar2 PCHARP p_wchar1 p_wchar0 MP_INT
  97. syn keyword cmodOperator _destruct create __hash _sizeof _indices _values
  98. syn keyword cmodOperator _is_type _sprintf _equal _m_delete _get_iterator
  99. syn keyword cmodOperator _search _types _serialize _deserialize
  100. syn keyword cmodOperator _size_object _random _sqrt TYPEOF SUBTYPEOF
  101. syn keyword cmodOperator LIKELY UNLIKELY
  102. syn keyword cmodStructure DECLARATIONS PIKECLASS DECLARE_STORAGE
  103. if !exists("c_autodoc")
  104. syn match cmodAutodocReal display contained "\%(//\|[/ \t\v]\*\|^\*\)\@2<=!.*" contains=@cmodAutodoc containedin=cComment,cCommentL
  105. syn cluster cCommentGroup add=cmodAutodocReal
  106. syn cluster cPreProcGroup add=cmodAutodocReal
  107. endif
  108. " Default highlighting
  109. hi def link cmodAccess Statement
  110. hi def link cmodOperator Operator
  111. hi def link cmodStatement Statement
  112. hi def link cmodConstant Constant
  113. hi def link cmodModifier Type
  114. hi def link cmodType Type
  115. hi def link cmodStorageClass StorageClass
  116. hi def link cmodStructure Structure
  117. hi def link cmodException Exception
  118. hi def link cmodDebug Debug
  119. let b:current_syntax = "cmod"
  120. let &cpo = s:cpo_save
  121. unlet s:cpo_save
  122. " vim: ts=8