euphoria4.vim 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. " Vim syntax file
  2. " Language: Euphoria 4.0.5 (http://www.openeuphoria.org/)
  3. " Maintainer: Shian Lee
  4. " Last Change: 2014 Feb 26 (for Vim 7.4)
  5. " Remark: Euphoria has two syntax files, euphoria3.vim and euphoria4.vim;
  6. " For details see :help ft-euphoria-syntax
  7. " quit when a syntax file was already loaded
  8. if exists("b:current_syntax")
  9. finish
  10. endif
  11. " Reset compatible-options to Vim default value, just in case:
  12. let s:save_cpo = &cpo
  13. set cpo&vim
  14. " Should suffice for very long strings and expressions:
  15. syn sync lines=40
  16. " Euphoria is a case-sensitive language (with only 4 builtin types):
  17. syntax case match
  18. " Some keywords/Builtins for Debug - from $EUDIR/include/euphoria/keywords.e:
  19. syn keyword euphoria4Debug with without trace profile batch check indirect
  20. syn keyword euphoria4Debug includes inline warning define
  21. " Keywords for conditional compilation - from $EUDIR/include/euphoria/keywords.e:
  22. syn keyword euphoria4PreProc elsedef elsifdef ifdef
  23. " Keywords (Statments) - from $EUDIR/include/euphoria/keywords.e:
  24. syn keyword euphoria4Keyword and as break by case constant continue do else
  25. syn keyword euphoria4Keyword elsif end entry enum exit export
  26. syn keyword euphoria4Keyword fallthru for function global goto if include
  27. syn keyword euphoria4Keyword label loop namespace not or override procedure
  28. syn keyword euphoria4Keyword public retry return routine switch then to type
  29. syn keyword euphoria4Keyword until while xor
  30. " Builtins (Identifiers) - from $EUDIR/include/euphoria/keywords.e:
  31. syn keyword euphoria4Builtin abort and_bits append arctan atom c_func c_proc
  32. syn keyword euphoria4Builtin call call_func call_proc clear_screen close
  33. syn keyword euphoria4Builtin command_line compare cos date delete delete_routine
  34. syn keyword euphoria4Builtin equal find floor get_key getc getenv gets hash
  35. syn keyword euphoria4Builtin head include_paths insert integer length log
  36. syn keyword euphoria4Builtin machine_func machine_proc match mem_copy mem_set
  37. syn keyword euphoria4Builtin not_bits object open option_switches or_bits peek
  38. syn keyword euphoria4Builtin peek2s peek2u peek4s peek4u peek_string peeks pixel
  39. syn keyword euphoria4Builtin platform poke poke2 poke4 position power prepend
  40. syn keyword euphoria4Builtin print printf puts rand remainder remove repeat
  41. syn keyword euphoria4Builtin replace routine_id sequence sin splice sprintf
  42. syn keyword euphoria4Builtin sqrt system system_exec tail tan task_clock_start
  43. syn keyword euphoria4Builtin task_clock_stop task_create task_list task_schedule
  44. syn keyword euphoria4Builtin task_self task_status task_suspend task_yield time
  45. syn keyword euphoria4Builtin xor_bits
  46. " Builtins (Identifiers) shortcuts for length() and print():
  47. syn match euphoria4Builtin "\$"
  48. syn match euphoria4Builtin "?"
  49. " Library Identifiers (Function) - grep from $EUDIR/include/*:
  50. syn keyword euphoria4Library DEP_on SyntaxColor abbreviate_path abs absolute_path
  51. syn keyword euphoria4Library accept add add_item all_copyrights all_matches
  52. syn keyword euphoria4Library allocate allocate_code allocate_data allocate_low
  53. syn keyword euphoria4Library allocate_pointer_array allocate_protect
  54. syn keyword euphoria4Library allocate_string allocate_string_pointer_array
  55. syn keyword euphoria4Library allocate_wstring allocations allow_break any_key
  56. syn keyword euphoria4Library append_lines apply approx arccos arccosh arcsin
  57. syn keyword euphoria4Library arcsinh arctanh assert at atan2 atom_to_float32
  58. syn keyword euphoria4Library atom_to_float64 attr_to_colors avedev average
  59. syn keyword euphoria4Library begins binary_search bind binop_ok bits_to_int
  60. syn keyword euphoria4Library bk_color breakup build_commandline build_list
  61. syn keyword euphoria4Library bytes_to_int calc_hash calc_primes call_back
  62. syn keyword euphoria4Library canon2win canonical canonical_path ceil
  63. syn keyword euphoria4Library central_moment chance char_test chdir
  64. syn keyword euphoria4Library check_all_blocks check_break check_free_list
  65. syn keyword euphoria4Library checksum clear clear_directory cmd_parse
  66. syn keyword euphoria4Library colors_to_attr columnize combine connect
  67. syn keyword euphoria4Library console_colors copy copy_file cosh count crash
  68. syn keyword euphoria4Library crash_file crash_message crash_routine create
  69. syn keyword euphoria4Library create_directory create_file curdir current_dir
  70. syn keyword euphoria4Library cursor custom_sort datetime days_in_month
  71. syn keyword euphoria4Library days_in_year db_cache_clear db_clear_table db_close
  72. syn keyword euphoria4Library db_compress db_connect db_create db_create_table
  73. syn keyword euphoria4Library db_current db_current_table db_delete_record
  74. syn keyword euphoria4Library db_delete_table db_dump db_fetch_record db_find_key
  75. syn keyword euphoria4Library db_get_errors db_get_recid db_insert db_open
  76. syn keyword euphoria4Library db_record_data db_record_key db_record_recid
  77. syn keyword euphoria4Library db_rename_table db_replace_data db_replace_recid
  78. syn keyword euphoria4Library db_select db_select_table db_set_caching
  79. syn keyword euphoria4Library db_table_list db_table_size deallocate decanonical
  80. syn keyword euphoria4Library decode defaulted_value defaultext define_c_func
  81. syn keyword euphoria4Library define_c_proc define_c_var deg2rad delete_file
  82. syn keyword euphoria4Library dep_works dequote deserialize diff dir dir_size
  83. syn keyword euphoria4Library dirname disk_metrics disk_size display
  84. syn keyword euphoria4Library display_text_image dnsquery driveid dump dup emovavg
  85. syn keyword euphoria4Library encode ends ensure_in_list ensure_in_range
  86. syn keyword euphoria4Library error_code error_message error_no error_string
  87. syn keyword euphoria4Library error_to_string escape euphoria_copyright exec
  88. syn keyword euphoria4Library exp extract fetch fib file_exists file_length
  89. syn keyword euphoria4Library file_timestamp file_type filebase fileext filename
  90. syn keyword euphoria4Library filter find_all find_all_but find_any find_each
  91. syn keyword euphoria4Library find_nested find_replace find_replace_callback
  92. syn keyword euphoria4Library find_replace_limit flags_to_string flatten
  93. syn keyword euphoria4Library float32_to_atom float64_to_atom flush for_each
  94. syn keyword euphoria4Library format frac free free_code free_console free_low
  95. syn keyword euphoria4Library free_pointer_array from_date from_unix gcd geomean
  96. syn keyword euphoria4Library get get_bytes get_charsets get_def_lang
  97. syn keyword euphoria4Library get_display_page get_dstring get_encoding_properties
  98. syn keyword euphoria4Library get_integer16 get_integer32 get_lang_path get_lcid
  99. syn keyword euphoria4Library get_mouse get_option get_ovector_size get_pid
  100. syn keyword euphoria4Library get_position get_rand get_screen_char get_text
  101. syn keyword euphoria4Library get_vector getaddrinfo getmxrr getnsrr graphics_mode
  102. syn keyword euphoria4Library harmean has has_console has_match hex_text
  103. syn keyword euphoria4Library host_by_addr host_by_name http_get http_post iff
  104. syn keyword euphoria4Library iif info init_class init_curdir insertion_sort
  105. syn keyword euphoria4Library instance int_to_bits int_to_bytes intdiv
  106. syn keyword euphoria4Library is_DEP_supported is_empty is_even is_even_obj
  107. syn keyword euphoria4Library is_in_list is_in_range is_inetaddr is_leap_year
  108. syn keyword euphoria4Library is_match is_using_DEP is_win_nt join join_path
  109. syn keyword euphoria4Library keep_comments keep_newlines key_codes keys keyvalues
  110. syn keyword euphoria4Library kill kurtosis lang_load larger_of largest last
  111. syn keyword euphoria4Library listen load load_map locate_file lock_file
  112. syn keyword euphoria4Library lock_memory log10 lookup lower malloc mapping
  113. syn keyword euphoria4Library match_all match_any match_replace matches max
  114. syn keyword euphoria4Library maybe_any_key median memory_used merge message_box
  115. syn keyword euphoria4Library mid min minsize mod mode money mouse_events
  116. syn keyword euphoria4Library mouse_pointer movavg move_file nested_get
  117. syn keyword euphoria4Library nested_put new new_extra new_from_kvpairs
  118. syn keyword euphoria4Library new_from_string new_time next_prime now now_gmt
  119. syn keyword euphoria4Library number open_dll optimize option_spec_to_string
  120. syn keyword euphoria4Library or_all pad_head pad_tail pairs parse
  121. syn keyword euphoria4Library parse_commandline parse_ip_address parse_querystring
  122. syn keyword euphoria4Library parse_url patch pathinfo pathname pcre_copyright
  123. syn keyword euphoria4Library peek_end peek_top peek_wstring pivot platform_name
  124. syn keyword euphoria4Library poke_string poke_wstring pop powof2 prepare_block
  125. syn keyword euphoria4Library pretty_print pretty_sprint prime_list process_lines
  126. syn keyword euphoria4Library product project prompt_number prompt_string proper
  127. syn keyword euphoria4Library push put put_integer16 put_integer32 put_screen_char
  128. syn keyword euphoria4Library quote rad2deg rand_range range raw_frequency read
  129. syn keyword euphoria4Library read_bitmap read_file read_lines receive receive_from
  130. syn keyword euphoria4Library register_block rehash remove_all remove_directory
  131. syn keyword euphoria4Library remove_dups remove_item remove_subseq rename_file
  132. syn keyword euphoria4Library repeat_pattern reset retain_all reverse rfind rmatch
  133. syn keyword euphoria4Library rnd rnd_1 roll rotate rotate_bits round safe_address
  134. syn keyword euphoria4Library sample save_bitmap save_map save_text_image scroll
  135. syn keyword euphoria4Library seek select send send_to serialize series
  136. syn keyword euphoria4Library service_by_name service_by_port set
  137. syn keyword euphoria4Library set_accumulate_summary set_charsets set_colors
  138. syn keyword euphoria4Library set_decimal_mark set_def_lang set_default_charsets
  139. syn keyword euphoria4Library set_encoding_properties set_keycodes set_lang_path
  140. syn keyword euphoria4Library set_option set_rand set_test_abort set_test_verbosity
  141. syn keyword euphoria4Library set_vector set_wait_on_summary setenv shift_bits
  142. syn keyword euphoria4Library show_block show_help show_tokens shuffle shutdown
  143. syn keyword euphoria4Library sign sim_index sinh size skewness sleep slice small
  144. syn keyword euphoria4Library smaller_of smallest sort sort_columns sound split
  145. syn keyword euphoria4Library split_any split_limit split_path sprint start_time
  146. syn keyword euphoria4Library statistics stdev store string_numbers subtract sum
  147. syn keyword euphoria4Library sum_central_moments swap tanh task_delay temp_file
  148. syn keyword euphoria4Library test_equal test_exec test_fail test_false
  149. syn keyword euphoria4Library test_not_equal test_pass test_read test_report
  150. syn keyword euphoria4Library test_true test_write text_color text_rows threshold
  151. syn keyword euphoria4Library tick_rate to_integer to_number to_string to_unix
  152. syn keyword euphoria4Library tokenize_file tokenize_string top transform translate
  153. syn keyword euphoria4Library transmute trim trim_head trim_tail trsprintf trunc
  154. syn keyword euphoria4Library type_of uname unlock_file unregister_block unsetenv
  155. syn keyword euphoria4Library upper use_vesa valid valid_index value values version
  156. syn keyword euphoria4Library version_date version_major version_minor version_node
  157. syn keyword euphoria4Library version_patch version_revision version_string
  158. syn keyword euphoria4Library version_string_long version_string_short version_type
  159. syn keyword euphoria4Library video_config vlookup vslice wait_key walk_dir
  160. syn keyword euphoria4Library warning_file weeks_day where which_bit wildcard_file
  161. syn keyword euphoria4Library wildcard_match wrap write write_file write_lines
  162. syn keyword euphoria4Library writef writefln years_day
  163. " Library Identifiers (Type) - grep from $EUDIR/include/*:
  164. syn keyword euphoria4Type ascii_string boolean bordered_address byte_range
  165. syn keyword euphoria4Type case_flagset_type color cstring
  166. syn keyword euphoria4Type file_number file_position graphics_point
  167. syn keyword euphoria4Type integer_array lcid lock_type machine_addr map
  168. syn keyword euphoria4Type mixture number_array option_spec
  169. syn keyword euphoria4Type page_aligned_address positive_int process regex
  170. syn keyword euphoria4Type sequence_array socket stack std_library_address
  171. syn keyword euphoria4Type string t_alnum t_alpha t_ascii t_boolean
  172. syn keyword euphoria4Type t_bytearray t_cntrl t_consonant t_digit t_display
  173. syn keyword euphoria4Type t_graph t_identifier t_lower t_print t_punct
  174. syn keyword euphoria4Type t_space t_specword t_text t_upper t_vowel t_xdigit
  175. syn keyword euphoria4Type valid_memory_protection_constant valid_wordsize
  176. " Linux shell comment (#!...):
  177. syn match euphoria4Comment "\%^#!.*$"
  178. " Single and multilines comments:
  179. syn region euphoria4Comment start=/--/ end=/$/
  180. syn region euphoria4Comment start="/\*" end="\*/"
  181. " Delimiters and brackets:
  182. syn match euphoria4Delimit "[([\])]"
  183. syn match euphoria4Delimit "\.\."
  184. syn match euphoria4Delimit ":"
  185. syn match euphoria4Operator "[{}]"
  186. " Character constant:
  187. syn region euphoria4Char start=/'/ skip=/\\'\|\\\\/ end=/'/ oneline
  188. " String constant (""" must be *after* "):
  189. syn region euphoria4String start=/"/ skip=/\\"\|\\\\/ end=/"/ oneline
  190. syn region euphoria4String start=/b"\|x"/ end=/"/
  191. syn region euphoria4String start=/`/ end=/`/
  192. syn region euphoria4String start=/"""/ end=/"""/
  193. " Binary/Octal/Decimal/Hexadecimal integer:
  194. syn match euphoria4Number "\<0b[01_]\+\>"
  195. syn match euphoria4Number "\<0t[0-7_]\+\>"
  196. syn match euphoria4Number "\<0d[0-9_]\+\>"
  197. syn match euphoria4Number "\<0x[0-9A-Fa-f_]\+\>"
  198. syn match euphoria4Number "#[0-9A-Fa-f_]\+\>"
  199. " Integer/Floating point without a dot:
  200. syn match euphoria4Number "\<\d\+\>"
  201. " Floating point with dot:
  202. syn match euphoria4Number "\<\d\+\.\d*\>"
  203. " Floating point starting with a dot:
  204. syn match euphoria4Number "\.\d\+\>"
  205. " Boolean constants:
  206. syn keyword euphoria4Boolean true TRUE false FALSE
  207. " Define the default highlighting.
  208. " Only used when an item doesn't have highlighting yet:
  209. hi def link euphoria4Comment Comment
  210. hi def link euphoria4String String
  211. hi def link euphoria4Char Character
  212. hi def link euphoria4Number Number
  213. hi def link euphoria4Boolean Boolean
  214. hi def link euphoria4Builtin Identifier
  215. hi def link euphoria4Library Function
  216. hi def link euphoria4Type Type
  217. hi def link euphoria4Keyword Statement
  218. hi def link euphoria4Operator Statement
  219. hi def link euphoria4Debug Debug
  220. hi def link euphoria4Delimit Delimiter
  221. hi def link euphoria4PreProc PreProc
  222. let b:current_syntax = "euphoria4"
  223. " Restore current compatible-options:
  224. let &cpo = s:save_cpo
  225. unlet s:save_cpo