KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

j.php 6.6KB

11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. /*************************************************************************************
  3. * j.php
  4. * --------
  5. * Author: Ric Sherlock (tikkanz@gmail.com)
  6. * Copyright: (c) 2009 Ric Sherlock
  7. * Release Version: 1.0.8.11
  8. * Date Started: 2009/11/10
  9. *
  10. * J language file for GeSHi.
  11. *
  12. * CHANGES
  13. * -------
  14. * 2010/07/18 (1.0.8.10)
  15. * - Infinity and negative infinity recognized as numbers
  16. * 2010/03/01 (1.0.8.8)
  17. * - Add support for label_xyz. and goto_xyz.
  18. * - Fix highlighting of for_i.
  19. * - Use alternative method for highlighting for_xyz. construct
  20. * 2010/02/14 (1.0.8.7)
  21. * - Add support for primitives
  22. * 2010/01/12 (1.0.2)
  23. * - Use HARDQUOTE for strings
  24. * - Highlight open quotes/incomplete strings
  25. * - Highlight multi-line comments that use Note
  26. * - Refinements for NUMBERS and Argument keywords
  27. * - Highlight infinity and neg. infinity using REGEXPS
  28. * - Highlight "for_myvar." style Control keyword using REGEXPS
  29. * 2009/12/14 (1.0.1)
  30. * - Regex for NUMBERS, SYMBOLS for () and turn off BRACKETS
  31. * 2009/11/12 (1.0.0)
  32. * - First Release
  33. *
  34. * TODO (updated 2010/01/27)
  35. * -------------------------
  36. * * combine keyword categories by using conditional regex statement in PARSER CONTROL?
  37. *************************************************************************************
  38. *
  39. * This file is part of GeSHi.
  40. *
  41. * GeSHi is free software; you can redistribute it and/or modify
  42. * it under the terms of the GNU General Public License as published by
  43. * the Free Software Foundation; either version 2 of the License, or
  44. * (at your option) any later version.
  45. *
  46. * GeSHi is distributed in the hope that it will be useful,
  47. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  48. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  49. * GNU General Public License for more details.
  50. *
  51. * You should have received a copy of the GNU General Public License
  52. * along with GeSHi; if not, write to the Free Software
  53. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  54. *
  55. ************************************************************************************/
  56. $language_data = array(
  57. 'LANG_NAME' => 'J',
  58. 'COMMENT_SINGLE' => array(),
  59. 'COMMENT_MULTI' => array(),
  60. 'COMMENT_REGEXP' => array(
  61. 1 => '/(?<!\w)NB\..*?$/m', //singleline comments NB.
  62. 2 => '/(?<=\bNote\b).*?$\s+\)(?:(?!\n)\s)*$/sm', //multiline comments in Note
  63. 3 => "/'[^']*?$/m" //incomplete strings/open quotes
  64. ),
  65. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  66. 'QUOTEMARKS' => array(),
  67. 'ESCAPE_CHAR' => '',
  68. 'HARDQUOTE' => array("'", "'"),
  69. 'HARDESCAPE' => array("'"),
  70. 'HARDCHAR' => "'",
  71. 'NUMBERS' => array(
  72. 0 => '\b(?:_?\d+(?:\.\d+)?(?:x|[bejprx]_?[\da-z]+(?:\.[\da-z]+)?)?|__?)(?![\w\.\:])',
  73. ),
  74. 'KEYWORDS' => array(
  75. //Control words
  76. 1 => array(
  77. 'assert.', 'break.', 'case.', 'catch.', 'catcht.', 'continue.', 'do.',
  78. 'else.', 'elseif.', 'end.', 'fcase.', 'for.', 'goto.', 'if.', 'label.',
  79. 'return.', 'select.', 'throw.', 'trap.', 'try.', 'while.', 'whilst.'
  80. ),
  81. //Arguments
  82. 2 => array(
  83. 'm', 'n', 'u', 'v', 'x', 'y'
  84. ),
  85. ),
  86. 'SYMBOLS' => array(
  87. //Punctuation
  88. 0 => array(
  89. '(', ')'
  90. )
  91. ),
  92. 'CASE_SENSITIVE' => array(
  93. GESHI_COMMENTS => false,
  94. 1 => true,
  95. 2 => true,
  96. //6 => true,
  97. //7 => true,
  98. //8 => true,
  99. ),
  100. 'STYLES' => array(
  101. 'KEYWORDS' => array(
  102. 1 => 'color: #0000ff; font-weight: bold;',
  103. 2 => 'color: #0000cc; font-weight: bold;',
  104. //6 => 'color: #000000; font-weight: bold;',
  105. //7 => 'color: #000000; font-weight: bold;',
  106. //8 => 'color: #000000; font-weight: bold;',
  107. ),
  108. 'COMMENTS' => array(
  109. 1 => 'color: #666666; font-style: italic;',
  110. 2 => 'color: #666666; font-style: italic; font-weight: bold;',
  111. 3 => 'color: #ff00ff; ', //open quote
  112. 'MULTI' => 'color: #666666; font-style: italic;'
  113. ),
  114. 'ESCAPE_CHAR' => array(
  115. 'HARD' => 'font-weight: bold;',
  116. 0 => '',
  117. ),
  118. 'BRACKETS' => array(
  119. 0 => 'color: #009900;'
  120. ),
  121. 'STRINGS' => array(
  122. 'HARD' => 'color: #ff0000;',
  123. 0 => 'color: #ff0000;',
  124. ),
  125. 'NUMBERS' => array(
  126. 0 => 'color: #009999; font-weight: bold;'
  127. ),
  128. 'METHODS' => array(
  129. ),
  130. 'SYMBOLS' => array(
  131. 0 => 'color: #009900; font-weight: bold;'
  132. ),
  133. 'REGEXPS' => array(
  134. 0 => 'color: #0000ff; font-weight: bold;', //for_xyz. - same as kw1
  135. ),
  136. 'SCRIPT' => array(
  137. )
  138. ),
  139. 'URLS' => array(
  140. 1 => '', //'http://www.jsoftware.com/help/dictionary/ctrl.htm',
  141. 2 => '',
  142. //6 => '', //'http://www.jsoftware.com/jwiki/Vocabulary',
  143. //7 => '', //'http://www.jsoftware.com/jwiki/Vocabulary',
  144. //8 => '', //'http://www.jsoftware.com/jwiki/Vocabulary',
  145. ),
  146. 'OOLANG' => false,
  147. 'OBJECT_SPLITTERS' => array(
  148. ),
  149. 'REGEXPS' => array(
  150. 0 => '\b(for|goto|label)_[a-zA-Z]\w*\.', //for_xyz. - should be kw1
  151. ),
  152. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  153. 'SCRIPT_DELIMITERS' => array(
  154. ),
  155. 'HIGHLIGHT_STRICT_BLOCK' => array(
  156. ),
  157. 'PARSER_CONTROL' => array(
  158. 'ENABLE_FLAGS' => array(
  159. 'BRACKETS' => GESHI_NEVER,
  160. ),
  161. 'NUMBERS' => array(
  162. 'PRECHECK_RX' => '#[\d_]#', // underscore is valid number
  163. ),
  164. 'KEYWORDS' => array(
  165. //Control words
  166. 2 => array(
  167. 'DISALLOWED_BEFORE' => '(?<!\w)',
  168. 'DISALLOWED_AFTER' => '(?![\w\.\:])',
  169. ),
  170. //Primtives starting with a symbol (except . or :)
  171. 6 => array(
  172. 'DISALLOWED_BEFORE' => '(?!K)', // effect should be to allow anything
  173. 'DISALLOWED_AFTER' => '(?=.*)',
  174. ),
  175. //Primtives starting with a letter
  176. 7 => array(
  177. 'DISALLOWED_BEFORE' => '(?<!\w)',
  178. 'DISALLOWED_AFTER' => '(?=.*)',
  179. ),
  180. //Primtives starting with symbol . or :
  181. 8 => array(
  182. 'DISALLOWED_BEFORE' => '(?<=\s)',
  183. 'DISALLOWED_AFTER' => '(?=.*)',
  184. ),
  185. )
  186. )
  187. );
  188. ?>