home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 January / pcwk_01_1999.iso / Top100sh / Comm / Jterm106 / _SETUP.1 / JTermScript.txt (.txt) < prev    next >
LaTeX Document  |  1998-07-21  |  18KB  |  292 lines

  1. #define pt_DEFAULT                  0
  2. #define pt_COMMENT_LINE             1
  3. #define pt_IDENTIFIER               2
  4. #define pt_STRING                   3
  5. #define pt_NUMBER                   4
  6. #define pt_COMMENT                  5
  7. #define pt_HEXNUMBER                6
  8. #define pt_RESERVED                 7
  9. #define pt_COMMENT_BRACE            8
  10. #define pt_COMMENT_STAR             9
  11. #define pt_SYMBOL                   10
  12. #define pt_CHAR_DECIMAL             11
  13. #define pt_CHAR_HEX                 12
  14. #define pt_SEMICOLON                20
  15. #define pt_PROPERTY                 21
  16. #define pt_DEFAULT_TOKEN            22
  17. #define pt_READ                     23
  18. #define pt_WRITE                    24
  19. #define pt_STORED                   25
  20. #define pt_EXPORTS                  26
  21. #define pt_NAME                     27
  22. #define pt_INDEX                    28
  23. #define pt_RESIDENT                 29
  24. #define _non_alpha_                 '[^_A-Za-z0-9]'
  25. #define _all_chars_                 '[\x00-\xFF]'
  26. #define _dec_digit_                 '[0-9]'
  27. #define _hex_digit_                 '[a-fA-F0-9]'
  28. #define _no_chars_                  '[]'
  29. #define _dont_care_                 _all_chars_
  30. #define _DEFAULT_BACKGROUND         clWhite
  31. #define _DEFAULT_FOREGROUND         clBlack
  32. #define ss_START                    0
  33. #define ss_PROPERTY                 1
  34. #define ss_EXPORTS                  2
  35. //--------------------------------------------------------------------------------------------------------------------
  36. // %%language section
  37. // Header section. Describes the textual name of the language, case sensitivity and options used by the language.
  38. %%language
  39. Name                      = 'J-Term Pro Script'
  40. Case                      = __INSENSITIVE
  41. Options                   = __DEFAULT_OPTIONS
  42. WordWrapColumn            = _EDGE
  43. Gutter                    = _DEFAULT_GUTTER
  44. Anchor                    = _DEFAULT_START_ANCHOR
  45. ExampleText               = 'var a: string;\n\
  46.                             \    b: integer;\n\
  47.                             \begin\n\
  48.                             \  b := 0;\n\
  49.                             \  a := \'\';\n\
  50.                             \  while b < 10 do begin\n\
  51.                             \    a := a + IntoToStr(b);\n\
  52.                             \    inc(b);\n\
  53.                             \   end;\n\
  54.                             \end.\n'
  55. EditableStyles              ('Reserved word', pt_RESERVED),
  56.                             ('Comment',       pt_COMMENT),
  57.                             ('Identifier',    pt_IDENTIFIER),
  58.                             ('String',        pt_STRING),
  59.                             ('Number',        pt_NUMBER),
  60.                             ('Symbols',       pt_SYMBOL),
  61.                             ('Default',       pt_DEFAULT)
  62. //--------------------------------------------------------------------------------------------------------------------
  63. // %%words section
  64. // Used to specify simple languge keywords. These are constant value lexemes that always contain the same characters
  65. // and only require the end style to be specified. The words present here will always be tried first. If they fail
  66. // then the entries in the %%tokens section will be allowed to try a match.
  67. // %%words table entries have 3 columns:
  68. //     Column 1          Quoted string giving the characters that make up the word
  69. //     Column 2          Quoted string that specifies how the word is terminated
  70. //     Column 3          Token value returned when word is recognised
  71. %%words
  72. '\/\/'                  _dont_care_                 pt_COMMENT_LINE
  73. '{'                     _dont_care_                 pt_COMMENT_BRACE
  74. '(*'                    _dont_care_                 pt_COMMENT_STAR
  75. ':='                    _dont_care_                 pt_SYMBOL
  76. '+'                     _dont_care_                 pt_SYMBOL
  77. '-'                     _dont_care_                 pt_SYMBOL
  78. '*'                     _dont_care_                 pt_SYMBOL
  79. '\/'                    _dont_care_                 pt_SYMBOL
  80. '='                     _dont_care_                 pt_SYMBOL
  81. '<>'                    _dont_care_                 pt_SYMBOL
  82. '<'                     _dont_care_                 pt_SYMBOL
  83. '>'                     _dont_care_                 pt_SYMBOL
  84. '<='                    _dont_care_                 pt_SYMBOL
  85. '>='                    _dont_care_                 pt_SYMBOL
  86. '('                     _dont_care_                 pt_SYMBOL
  87. ')'                     _dont_care_                 pt_SYMBOL
  88. '['                     _dont_care_                 pt_SYMBOL
  89. ']'                     _dont_care_                 pt_SYMBOL
  90. '.'                     _dont_care_                 pt_SYMBOL
  91. '..'                    _dont_care_                 pt_SYMBOL
  92. '^'                     _dont_care_                 pt_SYMBOL
  93. ','                     _dont_care_                 pt_SYMBOL
  94. ';'                     _dont_care_                 pt_SEMICOLON       [ss_START ss_PROPERTY]
  95. ':'                     _dont_care_                 pt_SYMBOL
  96. '@'                     _dont_care_                 pt_SYMBOL
  97. '#'                     _dec_digit_                 pt_CHAR_DECIMAL
  98. '#$'                    _hex_digit_                 pt_CHAR_HEX
  99. 'and'                   _non_alpha_                 pt_RESERVED
  100. 'array'                 _non_alpha_                 pt_RESERVED
  101. 'begin'                 _non_alpha_                 pt_RESERVED
  102. 'case'                  _non_alpha_                 pt_RESERVED
  103. 'const'                 _non_alpha_                 pt_RESERVED
  104. 'div'                   _non_alpha_                 pt_RESERVED
  105. 'do'                    _non_alpha_                 pt_RESERVED
  106. 'downto'                _non_alpha_                 pt_RESERVED
  107. 'else'                  _non_alpha_                 pt_RESERVED
  108. 'end'                   _non_alpha_                 pt_RESERVED
  109. 'false'                 _non_alpha_                 pt_RESERVED
  110. 'file'                  _non_alpha_                 pt_RESERVED
  111. 'for'                   _non_alpha_                 pt_RESERVED
  112. 'forward'               _non_alpha_                 pt_RESERVED
  113. 'function'              _non_alpha_                 pt_RESERVED
  114. 'goto'                  _non_alpha_                 pt_RESERVED
  115. 'if'                    _non_alpha_                 pt_RESERVED
  116. 'in'                    _non_alpha_                 pt_RESERVED
  117. 'label'                 _non_alpha_                 pt_RESERVED
  118. 'mod'                   _non_alpha_                 pt_RESERVED
  119. 'nil'                   _non_alpha_                 pt_RESERVED
  120. 'not'                   _non_alpha_                 pt_RESERVED
  121. 'of'                    _non_alpha_                 pt_RESERVED
  122. 'or'                    _non_alpha_                 pt_RESERVED
  123. 'procedure'             _non_alpha_                 pt_RESERVED
  124. 'program'               _non_alpha_                 pt_RESERVED
  125. 'record'                _non_alpha_                 pt_RESERVED
  126. 'repeat'                _non_alpha_                 pt_RESERVED
  127. 'set'                   _non_alpha_                 pt_RESERVED
  128. 'string'                _non_alpha_                 pt_RESERVED
  129. 'then'                  _non_alpha_                 pt_RESERVED
  130. 'to'                    _non_alpha_                 pt_RESERVED
  131. 'true'                  _non_alpha_                 pt_RESERVED
  132. 'type'                  _non_alpha_                 pt_RESERVED
  133. 'until'                 _non_alpha_                 pt_RESERVED
  134. 'var'                   _non_alpha_                 pt_RESERVED
  135. 'while'                 _non_alpha_                 pt_RESERVED
  136. 'with'                  _non_alpha_                 pt_RESERVED
  137. 'packed'                _non_alpha_                 pt_RESERVED
  138. 'implementation'        _non_alpha_                 pt_RESERVED
  139. 'interface'             _non_alpha_                 pt_RESERVED
  140. 'unit'                  _non_alpha_                 pt_RESERVED
  141. 'uses'                  _non_alpha_                 pt_RESERVED
  142. 'as'                    _non_alpha_                 pt_RESERVED
  143. 'on'                    _non_alpha_                 pt_RESERVED
  144. 'asm'                   _non_alpha_                 pt_RESERVED
  145. 'class'                 _non_alpha_                 pt_RESERVED
  146. 'constructor'           _non_alpha_                 pt_RESERVED
  147. 'destructor'            _non_alpha_                 pt_RESERVED
  148. 'except'                _non_alpha_                 pt_RESERVED
  149. 'exports'               _non_alpha_                 pt_EXPORTS
  150. 'finalization'          _non_alpha_                 pt_RESERVED
  151. 'finally'               _non_alpha_                 pt_RESERVED
  152. 'inherited'             _non_alpha_                 pt_RESERVED
  153. 'initialization'        _non_alpha_                 pt_RESERVED
  154. 'inline'                _non_alpha_                 pt_RESERVED
  155. 'is'                    _non_alpha_                 pt_RESERVED
  156. 'library'               _non_alpha_                 pt_RESERVED
  157. 'object'                _non_alpha_                 pt_RESERVED
  158. 'property'              _non_alpha_                 pt_PROPERTY
  159. 'raise'                 _non_alpha_                 pt_RESERVED
  160. 'shl'                   _non_alpha_                 pt_RESERVED
  161. 'shr'                   _non_alpha_                 pt_RESERVED
  162. 'threadvar'             _non_alpha_                 pt_RESERVED
  163. 'try'                   _non_alpha_                 pt_RESERVED
  164. 'xor'                   _non_alpha_                 pt_RESERVED
  165. 'absolute'              _non_alpha_                 pt_RESERVED
  166. 'abstract'              _non_alpha_                 pt_RESERVED
  167. 'assembler'             _non_alpha_                 pt_RESERVED
  168. 'at'                    _non_alpha_                 pt_RESERVED
  169. 'automated'             _non_alpha_                 pt_RESERVED
  170. 'cdecl'                 _non_alpha_                 pt_RESERVED
  171. 'default'               _non_alpha_                 pt_DEFAULT_TOKEN [ss_PROPERTY]
  172. 'dispid'                _non_alpha_                 pt_RESERVED
  173. 'dynamic'               _non_alpha_                 pt_RESERVED
  174. 'external'              _non_alpha_                 pt_RESERVED
  175. 'index'                 _non_alpha_                 pt_INDEX       [ss_EXPORTS]
  176. 'message'               _non_alpha_                 pt_RESERVED
  177. 'name'                  _non_alpha_                 pt_NAME        [ss_EXPORTS]
  178. 'nodefault'             _non_alpha_                 pt_RESERVED
  179. 'override'              _non_alpha_                 pt_RESERVED
  180. 'pascal'                _non_alpha_                 pt_RESERVED
  181. 'private'               _non_alpha_                 pt_RESERVED
  182. 'protected'             _non_alpha_                 pt_RESERVED
  183. 'public'                _non_alpha_                 pt_RESERVED
  184. 'published'             _non_alpha_                 pt_RESERVED
  185. 'read'                  _non_alpha_                 pt_READ        [ss_PROPERTY]
  186. 'register'              _non_alpha_                 pt_RESERVED
  187. 'resident'              _non_alpha_                 pt_RESIDENT    [ss_EXPORTS]
  188. 'resourcestring'        _non_alpha_                 pt_RESERVED
  189. 'stdcall'               _non_alpha_                 pt_RESERVED
  190. 'stored'                _non_alpha_                 pt_STORED      [ss_PROPERTY]
  191. 'virtual'               _non_alpha_                 pt_RESERVED
  192. 'write'                 _non_alpha_                 pt_WRITE       [ss_PROPERTY]
  193. //--------------------------------------------------------------------------------------------------------------------
  194. // %%handler section
  195. // The %%handler section gives rules to be applied once an entry in the %%words table has been recognised. Normally
  196. // no further processing is required but sometimes a token starts with a fixed set of characters but may be followed
  197. // by a character class rather than a known sequence.
  198. // %%handler table entries have 4 columns:
  199. //     Column 1          Token value to be processed
  200. //     Column 2          Character specifier that follows recognised word
  201. //     Column 3          Quoted string specifying end sequence
  202. //     Column 4          Whether end sequence is part of lexeme
  203. // The <character specifier> is defined as:
  204. //     Column 2          A single character specifier or pre-defined system character macro:
  205. //                         _PASCAL_CHAR         Pascal style character specifier
  206. //                         _C_CHAR              C style character specifier
  207. //                       If the lexeme can optionally have these characters then append '?' to the end
  208. //                       of the quoted string.
  209. //     Column 3          Up to 2 characters may be given as a sequence to terminate the lexeme.
  210. //                       Characters are specified using a simplified regular expression. If this
  211. //                       string is empty then the lexeme will never be matched.
  212. %%handler
  213. pt_COMMENT_LINE           '[^\n]'?                    '\n'           _discard_
  214. pt_COMMENT_BRACE          '[^}]'?                     '}'            _use_
  215. pt_COMMENT_STAR           _all_chars_?                '*)'           _use_
  216. pt_CHAR_DECIMAL           _dec_digit_                 '[^0-9]'       _discard_
  217. pt_CHAR_HEX               _hex_digit_                 '[^a-fA-F0-9]' _discard_
  218. //--------------------------------------------------------------------------------------------------------------------
  219. // %%tokens section
  220. // Used to specify how to recognise non-fixed lexemes. Non-fixed lexemes are only tried if the table entries in the
  221. // %%words section have failed. The non-fixed lexeme is defiened by 5 columns as below:
  222. //     Column 1          Token value
  223. //     Column 2          Single start character specifier
  224. //     Column 3          Single contains character specifier
  225. //     Column 4          End sequence specifier
  226. //     Column 5          Whether end sequence is part of lexeme
  227. // Pre-defined token styles are implemented. If used they should be specified in Column 2. The implemented ones
  228. // are:
  229. //  __STD_PASCALSTRING   Pascal string -- starts with ' ands with ' and uses '' to represent
  230. //                       ' within a string. Does not extend beywond end of line.
  231. //  __STD_IDENTIFIER     Standard identifier. Starts with [_a-zA-Z], contains [_a-zA-Z0-9] and ends with
  232. //                       a non-alpha numeric character that is not part of the lexeme
  233. //  __STD_NUMBER_OR_FP   Integer or floating point constant of syntax:
  234. //                           <Digit String> [ '.' <Digit string> ] [ e|E [+-] <Digit string> ]
  235. %%tokens
  236. pt_HEXNUMBER            '$'                         '[0-9a-fA-F]'       '[^0-9a-fA-F]'        _discard_
  237. pt_STRING               __STD_PASCALSTRING
  238. pt_IDENTIFIER           __STD_IDENTIFIER
  239. pt_NUMBER               __STD_NUMBER_OR_FP
  240. pt_DEFAULT              '[\s\t\n]'                  '[\s\t\n]'          '[^\s\t\n]'           _discard_
  241. //--------------------------------------------------------------------------------------------------------------------
  242. // %%effects section
  243. // Used to specify the default colors and font styles used for each token
  244. //     Column 1          Token value
  245. //     Column 2          Font styles
  246. //     Column 3          Foreground color
  247. //     Column 4          Background color
  248. //     Column 5          Optional column specifying whether map entry is a 'hotspot'
  249. // Columns 1-4 must be completed for all rows, Column 5 defaults to non-hotspot.
  250. %%effects
  251. pt_DEFAULT              []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  252. pt_IDENTIFIER           []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  253. pt_STRING               []                          clMaroon                    _DEFAULT_BACKGROUND
  254. pt_COMMENT              [fsItalic]                  clPurple                    _DEFAULT_BACKGROUND
  255. pt_RESERVED             [fsBold]                    clNavy                      _DEFAULT_BACKGROUND
  256. pt_NUMBER               []                          clGreen                     _DEFAULT_BACKGROUND
  257. pt_SYMBOL               []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  258. //--------------------------------------------------------------------------------------------------------------------
  259. // %%map section
  260. // Used to specify which entry in the %%effects table each token value uses. By default all token values map onto
  261. // __DEFAULT_TOKEN which is defined as zero. Table has 2 columns:
  262. //     Column 1          Recognised token value
  263. //     Column 2          Map table entry (i.e. %%effects table entry)
  264. // Normally the %%map table consists of identical value entries.
  265. %%map
  266. pt_IDENTIFIER           pt_IDENTIFIER
  267. pt_STRING               pt_STRING
  268. pt_HEXNUMBER            pt_NUMBER
  269. pt_NUMBER               pt_NUMBER
  270. pt_COMMENT              pt_COMMENT
  271. pt_COMMENT_LINE         pt_COMMENT
  272. pt_COMMENT_STAR         pt_COMMENT
  273. pt_COMMENT_BRACE        pt_COMMENT
  274. pt_RESERVED             pt_RESERVED
  275. pt_SYMBOL               pt_SYMBOL
  276. pt_SEMICOLON            pt_SYMBOL
  277. pt_PROPERTY             pt_RESERVED
  278. pt_READ                 pt_RESERVED
  279. pt_WRITE                pt_RESERVED
  280. pt_DEFAULT_TOKEN        pt_RESERVED
  281. pt_STORED               pt_RESERVED
  282. pt_EXPORTS              pt_RESERVED
  283. pt_NAME                 pt_RESERVED
  284. pt_INDEX                pt_RESERVED
  285. pt_RESIDENT             pt_RESERVED
  286. pt_CHAR_DECIMAL         pt_STRING
  287. pt_CHAR_HEX             pt_STRING
  288. %%states
  289. pt_PROPERTY             (+[ss_PROPERTY] -[ss_START])
  290. pt_SEMICOLON            (+[ss_START]    -[ss_PROPERTY ss_EXPORTS])
  291. pt_EXPORTS              (+[ss_EXPORTS])
  292.