phix.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. """
  2. pygments.lexers.phix
  3. ~~~~~~~~~~~~~~~~~~~~
  4. Lexers for Phix.
  5. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
  6. :license: BSD, see LICENSE for details.
  7. """
  8. import re
  9. from pygments.lexer import RegexLexer, words
  10. from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
  11. Whitespace
  12. __all__ = ['PhixLexer']
  13. class PhixLexer(RegexLexer):
  14. """
  15. Pygments Lexer for Phix files (.exw).
  16. See http://phix.x10.mx
  17. .. versionadded:: 2.14.0
  18. """
  19. name = 'Phix'
  20. url = 'http://phix.x10.mx'
  21. aliases = ['phix']
  22. filenames = ['*.exw']
  23. mimetypes = ['text/x-phix']
  24. flags = re.MULTILINE # nb: **NOT** re.DOTALL! (totally spanners comment handling)
  25. preproc = (
  26. 'ifdef', 'elsifdef', 'elsedef'
  27. )
  28. # Note these lists are auto-generated by pwa/p2js.exw, when pwa\src\p2js_keywords.e (etc)
  29. # change, though of course subsequent copy/commit/pull requests are all manual steps.
  30. types = (
  31. 'string', 'nullable_string', 'atom_string', 'atom', 'bool', 'boolean',
  32. 'cdCanvan', 'cdCanvas', 'complex', 'CURLcode', 'dictionary', 'int',
  33. 'integer', 'Ihandle', 'Ihandles', 'Ihandln', 'mpfr', 'mpq', 'mpz',
  34. 'mpz_or_string', 'number', 'rid_string', 'seq', 'sequence', 'timedate',
  35. 'object'
  36. )
  37. keywords = (
  38. 'abstract', 'class', 'continue', 'export', 'extends', 'nullable',
  39. 'private', 'public', 'static', 'struct', 'trace',
  40. 'and', 'break', 'by', 'case', 'catch', 'const', 'constant', 'debug',
  41. 'default', 'do', 'else', 'elsif', 'end', 'enum', 'exit', 'fallthru',
  42. 'fallthrough', 'for', 'forward', 'function', 'global', 'if', 'in',
  43. 'include', 'js', 'javascript', 'javascript_semantics', 'let', 'not',
  44. 'or', 'procedure', 'profile', 'profile_time', 'return', 'safe_mode',
  45. 'switch', 'then', 'to', 'try', 'type', 'type_check', 'until', 'warning',
  46. 'while', 'with', 'without', 'xor'
  47. )
  48. routines = (
  49. 'abort', 'abs', 'adjust_timedate', 'and_bits', 'and_bitsu', 'apply',
  50. 'append', 'arccos', 'arcsin', 'arctan', 'assert', 'atan2',
  51. 'atom_to_float32', 'atom_to_float64', 'bankers_rounding', 'beep',
  52. 'begins', 'binary_search', 'bits_to_int', 'bk_color', 'bytes_to_int',
  53. 'call_func', 'call_proc', 'cdCanvasActivate', 'cdCanvasArc',
  54. 'cdCanvasBegin', 'cdCanvasBox', 'cdCanvasChord', 'cdCanvasCircle',
  55. 'cdCanvasClear', 'cdCanvasEnd', 'cdCanvasFlush', 'cdCanvasFont',
  56. 'cdCanvasGetImageRGB', 'cdCanvasGetSize', 'cdCanvasGetTextAlignment',
  57. 'cdCanvasGetTextSize', 'cdCanvasLine', 'cdCanvasMark',
  58. 'cdCanvasMarkSize', 'cdCanvasMultiLineVectorText', 'cdCanvasPixel',
  59. 'cdCanvasRect', 'cdCanvasRoundedBox', 'cdCanvasRoundedRect',
  60. 'cdCanvasSector', 'cdCanvasSetAttribute', 'cdCanvasSetBackground',
  61. 'cdCanvasSetFillMode', 'cdCanvasSetForeground',
  62. 'cdCanvasSetInteriorStyle', 'cdCanvasSetLineStyle',
  63. 'cdCanvasSetLineWidth', 'cdCanvasSetTextAlignment', 'cdCanvasText',
  64. 'cdCanvasSetTextOrientation', 'cdCanvasGetTextOrientation',
  65. 'cdCanvasVectorText', 'cdCanvasVectorTextDirection',
  66. 'cdCanvasVectorTextSize', 'cdCanvasVertex', 'cdCreateCanvas',
  67. 'cdDecodeAlpha', 'cdDecodeColor', 'cdDecodeColorAlpha', 'cdEncodeAlpha',
  68. 'cdEncodeColor', 'cdEncodeColorAlpha', 'cdKillCanvas', 'cdVersion',
  69. 'cdVersionDate', 'ceil', 'change_timezone', 'choose', 'clear_screen',
  70. 'columnize', 'command_line', 'compare', 'complex_abs', 'complex_add',
  71. 'complex_arg', 'complex_conjugate', 'complex_cos', 'complex_cosh',
  72. 'complex_div', 'complex_exp', 'complex_imag', 'complex_inv',
  73. 'complex_log', 'complex_mul', 'complex_neg', 'complex_new',
  74. 'complex_norm', 'complex_power', 'complex_rho', 'complex_real',
  75. 'complex_round', 'complex_sin', 'complex_sinh', 'complex_sprint',
  76. 'complex_sqrt', 'complex_sub', 'complex_theta', 'concat', 'cos',
  77. 'crash', 'custom_sort', 'date', 'day_of_week', 'day_of_year',
  78. 'days_in_month', 'decode_base64', 'decode_flags', 'deep_copy', 'deld',
  79. 'deserialize', 'destroy_dict', 'destroy_queue', 'destroy_stack',
  80. 'dict_name', 'dict_size', 'elapsed', 'elapsed_short', 'encode_base64',
  81. 'equal', 'even', 'exp', 'extract', 'factorial', 'factors',
  82. 'file_size_k', 'find', 'find_all', 'find_any', 'find_replace', 'filter',
  83. 'flatten', 'float32_to_atom', 'float64_to_atom', 'floor',
  84. 'format_timedate', 'free_console', 'from_polar', 'gcd', 'get_file_base',
  85. 'get_file_extension', 'get_file_name', 'get_file_name_and_path',
  86. 'get_file_path', 'get_file_path_and_name', 'get_maxprime', 'get_prime',
  87. 'get_primes', 'get_primes_le', 'get_proper_dir', 'get_proper_path',
  88. 'get_rand', 'get_routine_info', 'get_test_abort', 'get_test_logfile',
  89. 'get_test_pause', 'get_test_verbosity', 'get_tzid', 'getd', 'getdd',
  90. 'getd_all_keys', 'getd_by_index', 'getd_index', 'getd_partial_key',
  91. 'glAttachShader', 'glBindBuffer', 'glBindTexture', 'glBufferData',
  92. 'glCanvasSpecialText', 'glClear', 'glClearColor', 'glColor',
  93. 'glCompileShader', 'glCreateBuffer', 'glCreateProgram',
  94. 'glCreateShader', 'glCreateTexture', 'glDeleteProgram',
  95. 'glDeleteShader', 'glDrawArrays', 'glEnable',
  96. 'glEnableVertexAttribArray', 'glFloat32Array', 'glInt32Array',
  97. 'glFlush', 'glGetAttribLocation', 'glGetError', 'glGetProgramInfoLog',
  98. 'glGetProgramParameter', 'glGetShaderInfoLog', 'glGetShaderParameter',
  99. 'glGetUniformLocation', 'glLinkProgram', 'glLoadIdentity',
  100. 'glMatrixMode', 'glOrtho', 'glRotatef', 'glShadeModel',
  101. 'glShaderSource', 'glSimpleA7texcoords', 'glTexImage2Dc',
  102. 'glTexParameteri', 'glTranslate', 'glUniform1f', 'glUniform1i',
  103. 'glUniformMatrix4fv', 'glUseProgram', 'glVertex',
  104. 'glVertexAttribPointer', 'glViewport', 'head', 'hsv_to_rgb', 'iff',
  105. 'iif', 'include_file', 'incl0de_file', 'insert', 'instance',
  106. 'int_to_bits', 'int_to_bytes', 'is_dict', 'is_integer', 's_leap_year',
  107. 'is_prime', 'is_prime2', 'islower', 'isupper', 'Icallback',
  108. 'iup_isdouble', 'iup_isprint', 'iup_XkeyBase', 'IupAppend', 'IupAlarm',
  109. 'IupBackgroundBox', 'IupButton', 'IupCalendar', 'IupCanvas',
  110. 'IupClipboard', 'IupClose', 'IupCloseOnEscape', 'IupControlsOpen',
  111. 'IupDatePick', 'IupDestroy', 'IupDialog', 'IupDrawArc', 'IupDrawBegin',
  112. 'IupDrawEnd', 'IupDrawGetSize', 'IupDrawGetTextSize', 'IupDrawLine',
  113. 'IupDrawRectangle', 'IupDrawText', 'IupExpander', 'IupFill',
  114. 'IupFlatLabel', 'IupFlatList', 'IupFlatTree', 'IupFlush', 'IupFrame',
  115. 'IupGetAttribute', 'IupGetAttributeId', 'IupGetAttributePtr',
  116. 'IupGetBrother', 'IupGetChild', 'IupGetChildCount', 'IupGetClassName',
  117. 'IupGetDialog', 'IupGetDialogChild', 'IupGetDouble', 'IupGetFocus',
  118. 'IupGetGlobal', 'IupGetGlobalInt', 'IupGetGlobalIntInt', 'IupGetInt',
  119. 'IupGetInt2', 'IupGetIntId', 'IupGetIntInt', 'IupGetParent',
  120. 'IupGLCanvas', 'IupGLCanvasOpen', 'IupGLMakeCurrent', 'IupGraph',
  121. 'IupHbox', 'IupHide', 'IupImage', 'IupImageRGBA', 'IupItem',
  122. 'iupKeyCodeToName', 'IupLabel', 'IupLink', 'IupList', 'IupMap',
  123. 'IupMenu', 'IupMenuItem', 'IupMessage', 'IupMessageDlg', 'IupMultiBox',
  124. 'IupMultiLine', 'IupNextField', 'IupNormaliser', 'IupOpen',
  125. 'IupPlayInput', 'IupPopup', 'IupPreviousField', 'IupProgressBar',
  126. 'IupRadio', 'IupRecordInput', 'IupRedraw', 'IupRefresh',
  127. 'IupRefreshChildren', 'IupSeparator', 'IupSetAttribute',
  128. 'IupSetAttributes', 'IupSetAttributeHandle', 'IupSetAttributeId',
  129. 'IupSetAttributePtr', 'IupSetCallback', 'IupSetCallbacks',
  130. 'IupSetDouble', 'IupSetFocus', 'IupSetGlobal', 'IupSetGlobalInt',
  131. 'IupSetGlobalFunction', 'IupSetHandle', 'IupSetInt',
  132. 'IupSetStrAttribute', 'IupSetStrGlobal', 'IupShow', 'IupShowXY',
  133. 'IupSplit', 'IupStoreAttribute', 'IupSubmenu', 'IupTable',
  134. 'IupTableClearSelected', 'IupTableClick_cb', 'IupTableGetSelected',
  135. 'IupTableResize_cb', 'IupTableSetData', 'IupTabs', 'IupText',
  136. 'IupTimer', 'IupToggle', 'IupTreeAddNodes', 'IupTreeView', 'IupUpdate',
  137. 'IupValuator', 'IupVbox', 'join', 'join_by', 'join_path', 'k_perm',
  138. 'largest', 'lcm', 'length', 'log', 'log10', 'log2', 'lower',
  139. 'm4_crossProduct', 'm4_inverse', 'm4_lookAt', 'm4_multiply',
  140. 'm4_normalize', 'm4_perspective', 'm4_subtractVectors', 'm4_xRotate',
  141. 'm4_yRotate', 'machine_bits', 'machine_word', 'match', 'match_all',
  142. 'match_replace', 'max', 'maxsq', 'min', 'minsq', 'mod', 'mpfr_add',
  143. 'mpfr_ceil', 'mpfr_cmp', 'mpfr_cmp_si', 'mpfr_const_pi', 'mpfr_div',
  144. 'mpfr_div_si', 'mpfr_div_z', 'mpfr_floor', 'mpfr_free', 'mpfr_get_d',
  145. 'mpfr_get_default_precision', 'mpfr_get_default_rounding_mode',
  146. 'mpfr_get_fixed', 'mpfr_get_precision', 'mpfr_get_si', 'mpfr_init',
  147. 'mpfr_inits', 'mpfr_init_set', 'mpfr_init_set_q', 'mpfr_init_set_z',
  148. 'mpfr_mul', 'mpfr_mul_si', 'mpfr_pow_si', 'mpfr_set', 'mpfr_set_d',
  149. 'mpfr_set_default_precision', 'mpfr_set_default_rounding_mode',
  150. 'mpfr_set_precision', 'mpfr_set_q', 'mpfr_set_si', 'mpfr_set_str',
  151. 'mpfr_set_z', 'mpfr_si_div', 'mpfr_si_sub', 'mpfr_sqrt', 'mpfr_sub',
  152. 'mpfr_sub_si', 'mpq_abs', 'mpq_add', 'mpq_add_si', 'mpq_canonicalize',
  153. 'mpq_cmp', 'mpq_cmp_si', 'mpq_div', 'mpq_div_2exp', 'mpq_free',
  154. 'mpq_get_den', 'mpq_get_num', 'mpq_get_str', 'mpq_init', 'mpq_init_set',
  155. 'mpq_init_set_si', 'mpq_init_set_str', 'mpq_init_set_z', 'mpq_inits',
  156. 'mpq_inv', 'mpq_mul', 'mpq_neg', 'mpq_set', 'mpq_set_si', 'mpq_set_str',
  157. 'mpq_set_z', 'mpq_sub', 'mpz_abs', 'mpz_add', 'mpz_addmul',
  158. 'mpz_addmul_ui', 'mpz_addmul_si', 'mpz_add_si', 'mpz_add_ui', 'mpz_and',
  159. 'mpz_bin_uiui', 'mpz_cdiv_q', 'mpz_cmp', 'mpz_cmp_si', 'mpz_divexact',
  160. 'mpz_divexact_ui', 'mpz_divisible_p', 'mpz_divisible_ui_p', 'mpz_even',
  161. 'mpz_fac_ui', 'mpz_factorstring', 'mpz_fdiv_q', 'mpz_fdiv_q_2exp',
  162. 'mpz_fdiv_q_ui', 'mpz_fdiv_qr', 'mpz_fdiv_r', 'mpz_fdiv_ui',
  163. 'mpz_fib_ui', 'mpz_fib2_ui', 'mpz_fits_atom', 'mpz_fits_integer',
  164. 'mpz_free', 'mpz_gcd', 'mpz_gcd_ui', 'mpz_get_atom', 'mpz_get_integer',
  165. 'mpz_get_short_str', 'mpz_get_str', 'mpz_init', 'mpz_init_set',
  166. 'mpz_inits', 'mpz_invert', 'mpz_lcm', 'mpz_lcm_ui', 'mpz_max',
  167. 'mpz_min', 'mpz_mod', 'mpz_mod_ui', 'mpz_mul', 'mpz_mul_2exp',
  168. 'mpz_mul_d', 'mpz_mul_si', 'mpz_neg', 'mpz_nthroot', 'mpz_odd',
  169. 'mpz_pollard_rho', 'mpz_pow_ui', 'mpz_powm', 'mpz_powm_ui', 'mpz_prime',
  170. 'mpz_prime_factors', 'mpz_prime_mr', 'mpz_rand', 'mpz_rand_ui',
  171. 'mpz_re_compose', 'mpz_remove', 'mpz_scan0', 'mpz_scan1', 'mpz_set',
  172. 'mpz_set_d', 'mpz_set_si', 'mpz_set_str', 'mpz_set_v', 'mpz_sign',
  173. 'mpz_sizeinbase', 'mpz_sqrt', 'mpz_sub', 'mpz_sub_si', 'mpz_sub_ui',
  174. 'mpz_si_sub', 'mpz_tdiv_q_2exp', 'mpz_tdiv_r_2exp', 'mpz_tstbit',
  175. 'mpz_ui_pow_ui', 'mpz_xor', 'named_dict', 'new_dict', 'new_queue',
  176. 'new_stack', 'not_bits', 'not_bitsu', 'odd', 'or_all', 'or_allu',
  177. 'or_bits', 'or_bitsu', 'ord', 'ordinal', 'ordinant',
  178. 'override_timezone', 'pad', 'pad_head', 'pad_tail', 'parse_date_string',
  179. 'papply', 'peep', 'peepn', 'peep_dict', 'permute', 'permutes',
  180. 'platform', 'pop', 'popn', 'pop_dict', 'power', 'pp', 'ppEx', 'ppExf',
  181. 'ppf', 'ppOpt', 'pq_add', 'pq_destroy', 'pq_empty', 'pq_new', 'pq_peek',
  182. 'pq_pop', 'pq_pop_data', 'pq_size', 'prepend', 'prime_factors',
  183. 'printf', 'product', 'proper', 'push', 'pushn', 'putd', 'puts',
  184. 'queue_empty', 'queue_size', 'rand', 'rand_range', 'reinstate',
  185. 'remainder', 'remove', 'remove_all', 'repeat', 'repeatch', 'replace',
  186. 'requires', 'reverse', 'rfind', 'rgb', 'rmatch', 'rmdr', 'rnd', 'round',
  187. 'routine_id', 'scanf', 'serialize', 'series', 'set_rand',
  188. 'set_test_abort', 'set_test_logfile', 'set_test_module',
  189. 'set_test_pause', 'set_test_verbosity', 'set_timedate_formats',
  190. 'set_timezone', 'setd', 'setd_default', 'shorten', 'sha256',
  191. 'shift_bits', 'shuffle', 'sign', 'sin', 'smallest', 'sort',
  192. 'sort_columns', 'speak', 'splice', 'split', 'split_any', 'split_by',
  193. 'sprint', 'sprintf', 'sq_abs', 'sq_add', 'sq_and', 'sq_and_bits',
  194. 'sq_arccos', 'sq_arcsin', 'sq_arctan', 'sq_atom', 'sq_ceil', 'sq_cmp',
  195. 'sq_cos', 'sq_div', 'sq_even', 'sq_eq', 'sq_floor', 'sq_floor_div',
  196. 'sq_ge', 'sq_gt', 'sq_int', 'sq_le', 'sq_log', 'sq_log10', 'sq_log2',
  197. 'sq_lt', 'sq_max', 'sq_min', 'sq_mod', 'sq_mul', 'sq_ne', 'sq_not',
  198. 'sq_not_bits', 'sq_odd', 'sq_or', 'sq_or_bits', 'sq_power', 'sq_rand',
  199. 'sq_remainder', 'sq_rmdr', 'sq_rnd', 'sq_round', 'sq_seq', 'sq_sign',
  200. 'sq_sin', 'sq_sqrt', 'sq_str', 'sq_sub', 'sq_tan', 'sq_trunc',
  201. 'sq_uminus', 'sq_xor', 'sq_xor_bits', 'sqrt', 'square_free',
  202. 'stack_empty', 'stack_size', 'substitute', 'substitute_all', 'sum',
  203. 'tail', 'tan', 'test_equal', 'test_fail', 'test_false',
  204. 'test_not_equal', 'test_pass', 'test_summary', 'test_true',
  205. 'text_color', 'throw', 'time', 'timedate_diff', 'timedelta',
  206. 'to_integer', 'to_number', 'to_rgb', 'to_string', 'traverse_dict',
  207. 'traverse_dict_partial_key', 'trim', 'trim_head', 'trim_tail', 'trunc',
  208. 'tagset', 'tagstart', 'typeof', 'unique', 'unix_dict', 'upper',
  209. 'utf8_to_utf32', 'utf32_to_utf8', 'version', 'vlookup', 'vslice',
  210. 'wglGetProcAddress', 'wildcard_file', 'wildcard_match', 'with_rho',
  211. 'with_theta', 'xml_new_doc', 'xml_new_element', 'xml_set_attribute',
  212. 'xml_sprint', 'xor_bits', 'xor_bitsu',
  213. 'accept', 'allocate', 'allocate_string', 'allow_break', 'ARM',
  214. 'atom_to_float80', 'c_func', 'c_proc', 'call_back', 'chdir',
  215. 'check_break', 'clearDib', 'close', 'closesocket', 'console',
  216. 'copy_file', 'create', 'create_directory', 'create_thread',
  217. 'curl_easy_cleanup', 'curl_easy_get_file', 'curl_easy_init',
  218. 'curl_easy_perform', 'curl_easy_perform_ex', 'curl_easy_setopt',
  219. 'curl_easy_strerror', 'curl_global_cleanup', 'curl_global_init',
  220. 'curl_slist_append', 'curl_slist_free_all', 'current_dir', 'cursor',
  221. 'define_c_func', 'define_c_proc', 'delete', 'delete_cs', 'delete_file',
  222. 'dir', 'DLL', 'drawDib', 'drawShadedPolygonToDib', 'ELF32', 'ELF64',
  223. 'enter_cs', 'eval', 'exit_thread', 'free', 'file_exists', 'final',
  224. 'float80_to_atom', 'format', 'get_bytes', 'get_file_date',
  225. 'get_file_size', 'get_file_type', 'get_interpreter', 'get_key',
  226. 'get_socket_error', 'get_text', 'get_thread_exitcode', 'get_thread_id',
  227. 'getc', 'getenv', 'gets', 'getsockaddr', 'glBegin', 'glCallList',
  228. 'glFrustum', 'glGenLists', 'glGetString', 'glLight', 'glMaterial',
  229. 'glNewList', 'glNormal', 'glPopMatrix', 'glPushMatrix', 'glRotate',
  230. 'glEnd', 'glEndList', 'glTexImage2D', 'goto', 'GUI', 'icons', 'ilASM',
  231. 'include_files', 'include_paths', 'init_cs', 'ip_to_string',
  232. 'IupConfig', 'IupConfigDialogClosed', 'IupConfigDialogShow',
  233. 'IupConfigGetVariableInt', 'IupConfigLoad', 'IupConfigSave',
  234. 'IupConfigSetVariableInt', 'IupExitLoop', 'IupFileDlg', 'IupFileList',
  235. 'IupGLSwapBuffers', 'IupHelp', 'IupLoopStep', 'IupMainLoop',
  236. 'IupNormalizer', 'IupPlot', 'IupPlotAdd', 'IupPlotBegin', 'IupPlotEnd',
  237. 'IupPlotInsert', 'IupSaveImage', 'IupTreeGetUserId', 'IupUser',
  238. 'IupVersion', 'IupVersionDate', 'IupVersionNumber', 'IupVersionShow',
  239. 'killDib', 'leave_cs', 'listen', 'manifest', 'mem_copy', 'mem_set',
  240. 'mpfr_gamma', 'mpfr_printf', 'mpfr_sprintf', 'mpz_export', 'mpz_import',
  241. 'namespace', 'new', 'newDib', 'open', 'open_dll', 'PE32', 'PE64',
  242. 'peek', 'peek_string', 'peek1s', 'peek1u', 'peek2s', 'peek2u', 'peek4s',
  243. 'peek4u', 'peek8s', 'peek8u', 'peekNS', 'peekns', 'peeknu', 'poke',
  244. 'poke2', 'poke4', 'poke8', 'pokeN', 'poke_string', 'poke_wstring',
  245. 'position', 'progress', 'prompt_number', 'prompt_string', 'read_file',
  246. 'read_lines', 'recv', 'resume_thread', 'seek', 'select', 'send',
  247. 'setHandler', 'shutdown', 'sleep', 'SO', 'sockaddr_in', 'socket',
  248. 'split_path', 'suspend_thread', 'system', 'system_exec', 'system_open',
  249. 'system_wait', 'task_clock_start', 'task_clock_stop', 'task_create',
  250. 'task_delay', 'task_list', 'task_schedule', 'task_self', 'task_status',
  251. 'task_suspend', 'task_yield', 'thread_safe_string', 'try_cs',
  252. 'utf8_to_utf16', 'utf16_to_utf8', 'utf16_to_utf32', 'utf32_to_utf16',
  253. 'video_config', 'WSACleanup', 'wait_thread', 'walk_dir', 'where',
  254. 'write_lines', 'wait_key'
  255. )
  256. constants = (
  257. 'ANY_QUEUE', 'ASCENDING', 'BLACK', 'BLOCK_CURSOR', 'BLUE',
  258. 'BRIGHT_CYAN', 'BRIGHT_BLUE', 'BRIGHT_GREEN', 'BRIGHT_MAGENTA',
  259. 'BRIGHT_RED', 'BRIGHT_WHITE', 'BROWN', 'C_DWORD', 'C_INT', 'C_POINTER',
  260. 'C_USHORT', 'C_WORD', 'CD_AMBER', 'CD_BLACK', 'CD_BLUE', 'CD_BOLD',
  261. 'CD_BOLD_ITALIC', 'CD_BOX', 'CD_CENTER', 'CD_CIRCLE', 'CD_CLOSED_LINES',
  262. 'CD_CONTINUOUS', 'CD_CUSTOM', 'CD_CYAN', 'CD_DARK_BLUE', 'CD_DARK_CYAN',
  263. 'CD_DARK_GRAY', 'CD_DARK_GREY', 'CD_DARK_GREEN', 'CD_DARK_MAGENTA',
  264. 'CD_DARK_RED', 'CD_DARK_YELLOW', 'CD_DASH_DOT', 'CD_DASH_DOT_DOT',
  265. 'CD_DASHED', 'CD_DBUFFER', 'CD_DEG2RAD', 'CD_DIAMOND', 'CD_DOTTED',
  266. 'CD_EAST', 'CD_EVENODD', 'CD_FILL', 'CD_GL', 'CD_GRAY', 'CD_GREY',
  267. 'CD_GREEN', 'CD_HATCH', 'CD_HOLLOW', 'CD_HOLLOW_BOX',
  268. 'CD_HOLLOW_CIRCLE', 'CD_HOLLOW_DIAMOND', 'CD_INDIGO', 'CD_ITALIC',
  269. 'CD_IUP', 'CD_IUPDBUFFER', 'CD_LIGHT_BLUE', 'CD_LIGHT_GRAY',
  270. 'CD_LIGHT_GREY', 'CD_LIGHT_GREEN', 'CD_LIGHT_PARCHMENT', 'CD_MAGENTA',
  271. 'CD_NAVY', 'CD_NORTH', 'CD_NORTH_EAST', 'CD_NORTH_WEST', 'CD_OLIVE',
  272. 'CD_OPEN_LINES', 'CD_ORANGE', 'CD_PARCHMENT', 'CD_PATTERN',
  273. 'CD_PRINTER', 'CD_PURPLE', 'CD_PLAIN', 'CD_PLUS', 'CD_QUERY',
  274. 'CD_RAD2DEG', 'CD_RED', 'CD_SILVER', 'CD_SOLID', 'CD_SOUTH_EAST',
  275. 'CD_SOUTH_WEST', 'CD_STAR', 'CD_STIPPLE', 'CD_STRIKEOUT',
  276. 'CD_UNDERLINE', 'CD_WEST', 'CD_WHITE', 'CD_WINDING', 'CD_VIOLET',
  277. 'CD_X', 'CD_YELLOW', 'CURLE_OK', 'CURLOPT_MAIL_FROM',
  278. 'CURLOPT_MAIL_RCPT', 'CURLOPT_PASSWORD', 'CURLOPT_READDATA',
  279. 'CURLOPT_READFUNCTION', 'CURLOPT_SSL_VERIFYPEER',
  280. 'CURLOPT_SSL_VERIFYHOST', 'CURLOPT_UPLOAD', 'CURLOPT_URL',
  281. 'CURLOPT_USE_SSL', 'CURLOPT_USERNAME', 'CURLOPT_VERBOSE',
  282. 'CURLOPT_WRITEFUNCTION', 'CURLUSESSL_ALL', 'CYAN', 'D_NAME',
  283. 'D_ATTRIBUTES', 'D_SIZE', 'D_YEAR', 'D_MONTH', 'D_DAY', 'D_HOUR',
  284. 'D_MINUTE', 'D_SECOND', 'D_CREATION', 'D_LASTACCESS', 'D_MODIFICATION',
  285. 'DT_YEAR', 'DT_MONTH', 'DT_DAY', 'DT_HOUR', 'DT_MINUTE', 'DT_SECOND',
  286. 'DT_DOW', 'DT_MSEC', 'DT_DOY', 'DT_GMT', 'EULER', 'E_CODE', 'E_ADDR',
  287. 'E_LINE', 'E_RTN', 'E_NAME', 'E_FILE', 'E_PATH', 'E_USER', 'false',
  288. 'False', 'FALSE', 'FIFO_QUEUE', 'FILETYPE_DIRECTORY', 'FILETYPE_FILE',
  289. 'GET_EOF', 'GET_FAIL', 'GET_IGNORE', 'GET_SUCCESS',
  290. 'GL_AMBIENT_AND_DIFFUSE', 'GL_ARRAY_BUFFER', 'GL_CLAMP',
  291. 'GL_CLAMP_TO_BORDER', 'GL_CLAMP_TO_EDGE', 'GL_COLOR_BUFFER_BIT',
  292. 'GL_COMPILE', 'GL_COMPILE_STATUS', 'GL_CULL_FACE',
  293. 'GL_DEPTH_BUFFER_BIT', 'GL_DEPTH_TEST', 'GL_EXTENSIONS', 'GL_FLAT',
  294. 'GL_FLOAT', 'GL_FRAGMENT_SHADER', 'GL_FRONT', 'GL_LIGHT0',
  295. 'GL_LIGHTING', 'GL_LINEAR', 'GL_LINK_STATUS', 'GL_MODELVIEW',
  296. 'GL_NEAREST', 'GL_NO_ERROR', 'GL_NORMALIZE', 'GL_POSITION',
  297. 'GL_PROJECTION', 'GL_QUAD_STRIP', 'GL_QUADS', 'GL_RENDERER',
  298. 'GL_REPEAT', 'GL_RGB', 'GL_RGBA', 'GL_SMOOTH', 'GL_STATIC_DRAW',
  299. 'GL_TEXTURE_2D', 'GL_TEXTURE_MAG_FILTER', 'GL_TEXTURE_MIN_FILTER',
  300. 'GL_TEXTURE_WRAP_S', 'GL_TEXTURE_WRAP_T', 'GL_TRIANGLES',
  301. 'GL_UNSIGNED_BYTE', 'GL_VENDOR', 'GL_VERSION', 'GL_VERTEX_SHADER',
  302. 'GRAY', 'GREEN', 'GT_LF_STRIPPED', 'GT_WHOLE_FILE', 'INVLN10',
  303. 'IUP_CLOSE', 'IUP_CONTINUE', 'IUP_DEFAULT', 'IUP_BLACK', 'IUP_BLUE',
  304. 'IUP_BUTTON1', 'IUP_BUTTON3', 'IUP_CENTER', 'IUP_CYAN', 'IUP_DARK_BLUE',
  305. 'IUP_DARK_CYAN', 'IUP_DARK_GRAY', 'IUP_DARK_GREY', 'IUP_DARK_GREEN',
  306. 'IUP_DARK_MAGENTA', 'IUP_DARK_RED', 'IUP_GRAY', 'IUP_GREY', 'IUP_GREEN',
  307. 'IUP_IGNORE', 'IUP_INDIGO', 'IUP_MAGENTA', 'IUP_MASK_INT',
  308. 'IUP_MASK_UINT', 'IUP_MOUSEPOS', 'IUP_NAVY', 'IUP_OLIVE', 'IUP_RECTEXT',
  309. 'IUP_RED', 'IUP_LIGHT_BLUE', 'IUP_LIGHT_GRAY', 'IUP_LIGHT_GREY',
  310. 'IUP_LIGHT_GREEN', 'IUP_ORANGE', 'IUP_PARCHMENT', 'IUP_PURPLE',
  311. 'IUP_SILVER', 'IUP_TEAL', 'IUP_VIOLET', 'IUP_WHITE', 'IUP_YELLOW',
  312. 'K_BS', 'K_cA', 'K_cC', 'K_cD', 'K_cF5', 'K_cK', 'K_cM', 'K_cN', 'K_cO',
  313. 'K_cP', 'K_cR', 'K_cS', 'K_cT', 'K_cW', 'K_CR', 'K_DEL', 'K_DOWN',
  314. 'K_END', 'K_ESC', 'K_F1', 'K_F2', 'K_F3', 'K_F4', 'K_F5', 'K_F6',
  315. 'K_F7', 'K_F8', 'K_F9', 'K_F10', 'K_F11', 'K_F12', 'K_HOME', 'K_INS',
  316. 'K_LEFT', 'K_MIDDLE', 'K_PGDN', 'K_PGUP', 'K_RIGHT', 'K_SP', 'K_TAB',
  317. 'K_UP', 'K_h', 'K_i', 'K_j', 'K_p', 'K_r', 'K_s', 'JS', 'LIFO_QUEUE',
  318. 'LINUX', 'MAX_HEAP', 'MAGENTA', 'MIN_HEAP', 'Nan', 'NO_CURSOR', 'null',
  319. 'NULL', 'PI', 'pp_Ascii', 'pp_Brkt', 'pp_Date', 'pp_File', 'pp_FltFmt',
  320. 'pp_Indent', 'pp_IntCh', 'pp_IntFmt', 'pp_Maxlen', 'pp_Nest',
  321. 'pp_Pause', 'pp_Q22', 'pp_StrFmt', 'RED', 'SEEK_OK', 'SLASH',
  322. 'TEST_ABORT', 'TEST_CRASH', 'TEST_PAUSE', 'TEST_PAUSE_FAIL',
  323. 'TEST_QUIET', 'TEST_SHOW_ALL', 'TEST_SHOW_FAILED', 'TEST_SUMMARY',
  324. 'true', 'True', 'TRUE', 'VC_SCRNLINES', 'WHITE', 'WINDOWS', 'YELLOW'
  325. )
  326. tokens = {
  327. 'root': [
  328. (r"\s+", Whitespace),
  329. (r'/\*|--/\*|#\[', Comment.Multiline, 'comment'),
  330. (r'(?://|--|#!).*$', Comment.Single),
  331. #Alt:
  332. # (r'//.*$|--.*$|#!.*$', Comment.Single),
  333. (r'"([^"\\]|\\.)*"', String.Other),
  334. (r'\'[^\']*\'', String.Other),
  335. (r'`[^`]*`', String.Other),
  336. (words(types, prefix=r'\b', suffix=r'\b'), Name.Function),
  337. (words(routines, prefix=r'\b', suffix=r'\b'), Name.Function),
  338. (words(preproc, prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
  339. (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
  340. (words(constants, prefix=r'\b', suffix=r'\b'), Name.Constant),
  341. # Aside: Phix only supports/uses the ascii/non-unicode tilde
  342. (r'!=|==|<<|>>|:=|[-~+/*%=<>&^|\.(){},?:\[\]$\\;#]', Operator),
  343. (r'[\w-]+', Text)
  344. ],
  345. 'comment': [
  346. (r'[^*/#]+', Comment.Multiline),
  347. (r'/\*|#\[', Comment.Multiline, '#push'),
  348. (r'\*/|#\]', Comment.Multiline, '#pop'),
  349. (r'[*/#]', Comment.Multiline)
  350. ]
  351. }