home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / Software / TemaCD / SuperIDE / Super.exe / _SETUP.1 / PasScript.lng (.txt) < prev    next >
LaTeX Document  |  1998-12-12  |  21KB  |  351 lines

  1.  * TSyntaxMemoParser Script
  2.  * ------------------------
  3.  * Author  :          David Brock
  4.  * Date    :          October 18 1997
  5.  * Language:          Object Pascal
  6. //--------------------------------------------------------------------------------------------------------------------
  7. // Macro definitions. Parameters may be specified and the replacement text terminates with the end of
  8. // line (watch trailing blanks).
  9. #define pt_DEFAULT                  0
  10. #define pt_COMMENT_LINE             1
  11. #define pt_IDENTIFIER               2
  12. #define pt_STRING                   3
  13. #define pt_NUMBER                   4
  14. #define pt_COMMENT                  5
  15. #define pt_HEXNUMBER                6
  16. #define pt_RESERVED                 7
  17. #define pt_COMMENT_BRACE            8
  18. #define pt_COMMENT_STAR             9
  19. #define pt_SYMBOL                   10
  20. #define pt_CHAR_DECIMAL             11
  21. #define pt_CHAR_HEX                 12
  22. #define pt_SEMICOLON                20
  23. #define pt_PROPERTY                 21
  24. #define pt_DEFAULT_TOKEN            22
  25. #define pt_READ                     23
  26. #define pt_WRITE                    24
  27. #define pt_STORED                   25
  28. #define pt_EXPORTS                  26
  29. #define pt_NAME                     27
  30. #define pt_INDEX                    28
  31. #define pt_RESIDENT                 29
  32. #define _non_alpha_                 '[^_A-Za-z0-9]'
  33. #define _all_chars_                 '[\x00-\xFF]'
  34. #define _dec_digit_                 '[0-9]'
  35. #define _hex_digit_                 '[a-fA-F0-9]'
  36. #define _no_chars_                  '[]'
  37. #define _dont_care_                 _all_chars_
  38. #define _DEFAULT_BACKGROUND         clWhite
  39. #define _DEFAULT_FOREGROUND         clBlack
  40. #define ss_START                    0
  41. #define ss_PROPERTY                 1
  42. #define ss_EXPORTS                  2
  43. //--------------------------------------------------------------------------------------------------------------------
  44. // %%language section
  45. // Header section. Describes the textual name of the language, case sensitivity and options used by the language.
  46. %%language
  47. Name                      = 'Object Pascal'
  48. Case                      = __INSENSITIVE
  49. Options                   = __DEFAULT_OPTIONS
  50. WordWrapColumn            = _EDGE
  51. Gutter                    = _DEFAULT_GUTTER
  52. Anchor                    = _DEFAULT_START_ANCHOR
  53. MarginWidth               = 8
  54. MarginColor               = [*]clWhite
  55. GutterColor               = [*]clYellow
  56. SelTextColor              = [*]clWhite
  57. SelTextBack               = [*]clBlue
  58. ExampleText               = '(* Syntax Highlighting *)\n\
  59.                             \program test;\n\
  60.                             \var a: string;\n\
  61.                             \    b: integer;\n\
  62.                             \begin\n\
  63.                             \  b := 0;\n\
  64.                             \  a := \'\';\n\
  65.                             \  while b < 10 do begin\n\
  66.                             \    a := a + IntoToStr(b);\n\
  67.                             \    inc(b);\n\
  68.                             \   end;\n\
  69.                             \end.\n'
  70. EditableStyles              ('Reserved word', pt_RESERVED),
  71.                             ('Comment',       pt_COMMENT),
  72.                             ('Identifier',    pt_IDENTIFIER),
  73.                             ('String',        pt_STRING),
  74.                             ('Number',        pt_NUMBER),
  75.                             ('Symbols',       pt_SYMBOL),
  76.                             ('Default',       pt_DEFAULT)
  77. //--------------------------------------------------------------------------------------------------------------------
  78. // %%words section
  79. // Used to specify simple languge keywords. These are constant value lexemes that always contain the same characters
  80. // and only require the end style to be specified. The words present here will always be tried first. If they fail
  81. // then the entries in the %%tokens section will be allowed to try a match.
  82. // %%words table entries have 3 columns:
  83. //     Column 1          Quoted string giving the characters that make up the word
  84. //     Column 2          Quoted string that specifies how the word is terminated
  85. //     Column 3          Token value returned when word is recognised
  86. %%words
  87. '\/\/'                  _dont_care_                 pt_COMMENT_LINE
  88. '{'                     _dont_care_                 pt_COMMENT_BRACE
  89. '(*'                    _dont_care_                 pt_COMMENT_STAR
  90. ':='                    _dont_care_                 pt_SYMBOL
  91. '+'                     _dont_care_                 pt_SYMBOL
  92. '-'                     _dont_care_                 pt_SYMBOL
  93. '*'                     _dont_care_                 pt_SYMBOL
  94. '\/'                    _dont_care_                 pt_SYMBOL
  95. '='                     _dont_care_                 pt_SYMBOL
  96. '<>'                    _dont_care_                 pt_SYMBOL
  97. '<'                     _dont_care_                 pt_SYMBOL
  98. '>'                     _dont_care_                 pt_SYMBOL
  99. '<='                    _dont_care_                 pt_SYMBOL
  100. '>='                    _dont_care_                 pt_SYMBOL
  101. '('                     _dont_care_                 pt_SYMBOL
  102. ')'                     _dont_care_                 pt_SYMBOL
  103. '['                     _dont_care_                 pt_SYMBOL
  104. ']'                     _dont_care_                 pt_SYMBOL
  105. '.'                     _dont_care_                 pt_SYMBOL
  106. '..'                    _dont_care_                 pt_SYMBOL
  107. '^'                     _dont_care_                 pt_SYMBOL
  108. ','                     _dont_care_                 pt_SYMBOL
  109. ';'                     _dont_care_                 pt_SEMICOLON       [ss_START ss_PROPERTY]
  110. ':'                     _dont_care_                 pt_SYMBOL
  111. '@'                     _dont_care_                 pt_SYMBOL
  112. '#'                     _dec_digit_                 pt_CHAR_DECIMAL
  113. '#$'                    _hex_digit_                 pt_CHAR_HEX
  114. // TSyntaxMemo v2 introduced keyword tables. These are sets of common language
  115. // keywords (normally reserved words in the source language) that share a common
  116. // lexeme definition.
  117. // Keyword tables are separated by the active states of the parser. It is possible
  118. // to specify a set of states that must be present for a given keyword table to
  119. // be used. If no state specification is given then the keyword table will be
  120. // used in all cases.
  121. // Keyword tables may be changed at run-time by specifying the state(s) in which
  122. // the keywords are valid via the DefineKeywordTable method.
  123. %%kwtables
  124. ForState [ss_PROPERTY] endswith _non_alpha_
  125.   ( pt_DEFAULT_TOKEN is 'default'
  126.     pt_READ          is 'read'
  127.     pt_STORED        is 'stored'
  128.     pt_WRITE         is 'write')
  129. ForState [ss_EXPORTS] endswith _non_alpha_
  130.   ( pt_INDEX         is 'index'
  131.     pt_NAME          is 'name'
  132.     pt_RESIDENT      is 'resident')
  133. // Default keyword table
  134.     ForState [] endswith _non_alpha_
  135.       ( pt_RESERVED  is 'and', 'array', 'as', 'asm', 'absolute', 'abstract', 'assembler', 'at', 'automated',
  136.                         'begin',
  137.                         'case', 'const', 'class', 'constructor', 'cdecl',
  138.                         'div', 'do', 'downto', 'destructor', 'dispid', 'dynamic',
  139.                         'else', 'end', 'except', 'external',
  140.                         'false', 'file', 'for', 'forward', 'function', 'finalization', 'finally',
  141.                         'goto',
  142.                         'if', 'in', 'implementation', 'interface', 'inherited', 'initialization', 'inline', 'is',
  143.                         'label', 'library',
  144.                         'mod', 'message',
  145.                         'nil', 'not', 'nodefault',
  146.                         'of', 'or', 'on', 'object', 'override',
  147.                         'procedure', 'program', 'packed', 'pascal', 'private', 'protected', 'public', 'published',
  148.                         'record', 'repeat', 'raise', 'read', 'register', 'resident', 'resourcestring',
  149.                         'set', 'string', 'shl', 'shr', 'stdcall',
  150.                         'then', 'to', 'true', 'type', 'threadvar', 'try',
  151.                         'until', 'unit', 'uses',
  152.                         'var', 'virtual',
  153.                         'while', 'with',
  154.                         'xor'
  155.         pt_EXPORTS   is 'exports'
  156.         pt_PROPERTY  is 'property')
  157. //--------------------------------------------------------------------------------------------------------------------
  158. // %%handler section
  159. // The %%handler section gives rules to be applied once an entry in the %%words table has been recognised. Normally
  160. // no further processing is required but sometimes a token starts with a fixed set of characters but may be followed
  161. // by a character class rather than a known sequence.
  162. // %%handler table entries have 4 columns:
  163. //     Column 1          Token value to be processed
  164. //     Column 2          Character specifier that follows recognised word
  165. //     Column 3          Quoted string specifying end sequence
  166. //     Column 4          Whether end sequence is part of lexeme
  167. // The <character specifier> is defined as:
  168. //     Column 2          A single character specifier or pre-defined system character macro:
  169. //                         _PASCAL_CHAR         Pascal style character specifier
  170. //                         _C_CHAR              C style character specifier
  171. //                       If the lexeme can optionally have these characters then append '?' to the end
  172. //                       of the quoted string.
  173. //     Column 3          Up to 2 characters may be given as a sequence to terminate the lexeme.
  174. //                       Characters are specified using a simplified regular expression. If this
  175. //                       string is empty then the lexeme will never be matched.
  176. %%handler
  177. pt_COMMENT_LINE           '[^\n]'?                    '\n'           _discard_
  178. pt_COMMENT_BRACE          '[^}]'?                     '}'            _use_
  179. pt_COMMENT_STAR           _all_chars_?                '*)'           _use_
  180. pt_CHAR_DECIMAL           _dec_digit_                 '[^0-9]'       _discard_
  181. pt_CHAR_HEX               _hex_digit_                 '[^a-fA-F0-9]' _discard_
  182. //--------------------------------------------------------------------------------------------------------------------
  183. // %%tokens section
  184. // Used to specify how to recognise non-fixed lexemes. Non-fixed lexemes are only tried if the table entries in the
  185. // %%words section have failed. The non-fixed lexeme is defiened by 5 columns as below:
  186. //     Column 1          Token value
  187. //     Column 2          Single start character specifier
  188. //     Column 3          Single contains character specifier
  189. //     Column 4          End sequence specifier
  190. //     Column 5          Whether end sequence is part of lexeme
  191. // Pre-defined token styles are implemented. If used they should be specified in Column 2. The implemented ones
  192. // are:
  193. //  __STD_PASCALSTRING   Pascal string -- starts with ' ands with ' and uses '' to represent
  194. //                       ' within a string. Does not extend beywond end of line.
  195. //  __STD_IDENTIFIER     Standard identifier. Starts with [_a-zA-Z], contains [_a-zA-Z0-9] and ends with
  196. //                       a non-alpha numeric character that is not part of the lexeme
  197. //  __STD_NUMBER_OR_FP   Integer or floating point constant of syntax:
  198. //                           <Digit String> [ '.' <Digit string> ] [ e|E [+-] <Digit string> ]
  199. %%tokens
  200. pt_HEXNUMBER            '$'                         '[0-9a-fA-F]'       '[^0-9a-fA-F]'        _discard_
  201. pt_STRING               __STD_PASCALSTRING
  202. pt_IDENTIFIER           __STD_IDENTIFIER    [ss_START ss_PROPERTY]
  203. pt_NUMBER               __STD_NUMBER_OR_FP
  204. pt_DEFAULT              '[\s\t\n]'                  '[\s\t\n]'?         '[^\s\t\n]'           _discard_
  205. //--------------------------------------------------------------------------------------------------------------------
  206. // %%effects section
  207. // Used to specify the default colors and font styles used for each token
  208. //     Column 1          Token value
  209. //     Column 2          Font styles
  210. //     Column 3          Foreground color
  211. //     Column 4          Background color
  212. //     Column 5          Optional column specifying whether map entry is a 'hotspot'
  213. // Columns 1-4 must be completed for all rows, Column 5 defaults to non-hotspot.
  214. %%effects
  215. #ifdef ver200
  216. // Version 2 introduced the overlay of a default color scheme for effects. When active an effect
  217. // will use the colors in effect slot zero (the default color scheme).
  218. // To specify effects that use the default color scheme to override their normal colors, append
  219. // an asterisk to the end of the color value in either the foreground or background column or both.
  220. pt_DEFAULT              []                          _DEFAULT_FOREGROUND*        _DEFAULT_BACKGROUND*
  221. pt_IDENTIFIER           []                          _DEFAULT_FOREGROUND*        _DEFAULT_BACKGROUND*
  222. pt_STRING               [fsItalic]                  _DEFAULT_FOREGROUND*        _DEFAULT_BACKGROUND*
  223. pt_COMMENT              [fsItalic]                  clBlue                      _DEFAULT_BACKGROUND*
  224. pt_RESERVED             [fsBold]                    _DEFAULT_FOREGROUND*        _DEFAULT_BACKGROUND*
  225. pt_NUMBER               []                          clGreen                     _DEFAULT_BACKGROUND*
  226. pt_SYMBOL               []                          _DEFAULT_FOREGROUND*        _DEFAULT_BACKGROUND*
  227. #else
  228. pt_DEFAULT              []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  229. pt_IDENTIFIER           []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  230. pt_STRING               [fsItalic]                  _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  231. pt_COMMENT              [fsItalic]                  clBlue                      _DEFAULT_BACKGROUND
  232. pt_RESERVED             [fsBold]                    _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  233. pt_NUMBER               []                          clGreen                     _DEFAULT_BACKGROUND
  234. pt_SYMBOL               []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  235. #endif
  236. //--------------------------------------------------------------------------------------------------------------------
  237. // %%map section
  238. // Used to specify which entry in the %%effects table each token value uses. By default all token values map onto
  239. // __DEFAULT_TOKEN which is defined as zero. Table has 2 columns:
  240. //     Column 1          Recognised token value
  241. //     Column 2          Map table entry (i.e. %%effects table entry)
  242. // Normally the %%map table consists of identical value entries.
  243. %%map
  244. pt_IDENTIFIER           pt_IDENTIFIER
  245. pt_STRING               pt_STRING
  246. pt_HEXNUMBER            pt_NUMBER
  247. pt_NUMBER               pt_NUMBER
  248. pt_COMMENT              pt_COMMENT
  249. pt_COMMENT_LINE         pt_COMMENT
  250. pt_COMMENT_STAR         pt_COMMENT
  251. pt_COMMENT_BRACE        pt_COMMENT
  252. pt_RESERVED             pt_RESERVED
  253. pt_SYMBOL               pt_SYMBOL
  254. pt_SEMICOLON            pt_SYMBOL
  255. pt_PROPERTY             pt_RESERVED
  256. pt_READ                 pt_RESERVED
  257. pt_WRITE                pt_RESERVED
  258. pt_DEFAULT_TOKEN        pt_RESERVED
  259. pt_STORED               pt_RESERVED
  260. pt_EXPORTS              pt_RESERVED
  261. pt_NAME                 pt_RESERVED
  262. pt_INDEX                pt_RESERVED
  263. pt_RESIDENT             pt_RESERVED
  264. pt_CHAR_DECIMAL         pt_STRING
  265. pt_CHAR_HEX             pt_STRING
  266. %%states
  267. pt_PROPERTY             (+[ss_PROPERTY] -[ss_START])
  268. pt_SEMICOLON            (+[ss_START]    -[ss_PROPERTY ss_EXPORTS])
  269. pt_EXPORTS              (+[ss_EXPORTS])
  270. // v2 specific key assignments separated by conditional compilation
  271. %%keys
  272. caLEFT                  ([] Left)                     'Cursor Left'
  273. caRIGHT                 ([] Right)                    'Cursor Right'
  274. caLINEHOME              ([] Home)                     'Line start'
  275. caLINEEND               ([] End)                      'Line end'
  276. caUP                    ([] Up)                       'Line up'
  277. caDOWN                  ([] Down)                     'Line down'
  278. caPAGEUP                ([] PgUp)                     'Page up'
  279. caPAGEDOWN              ([] PgDn)                     'Page down'
  280. caWORDLEFT              ([Ctrl] Left)                 'Word left'
  281. caWORDRIGHT             ([Ctrl] Right)                'Word right'
  282. caDOCSTART              ([Ctrl] Home)                 'Document start'
  283. caDOCEND                ([Ctrl] End)                  'Document end'
  284. caCUT                   ([Ctrl] 'X')                  'Cut to clipboard'
  285. caCOPY                  ([Ctrl] 'C'     |
  286.                          [Ctrl]  INSERT)              'Copy to clipboard'
  287. caPASTE                 ([Ctrl] 'V'     |
  288.                          [Shift] INSERT)              'Paste from clipboard'
  289. caDELETE                ([] Delete)                   'Delete at cursor'
  290. caBACKSPACE             ([] Backspace)                'Delete before cursor'
  291. caBLOCKIND              ([Ctrl] 'K', 'I')             'Indent block'
  292. caBLOCKUND              ([Ctrl] 'K', 'U')             'Un-Indent block'
  293. caINSTOGGLE             ([] Insert)                   'Toggle insert / override mode'
  294. caSETBOOKMARK0          ([Ctrl] 'K', '0')             'Set bookmark 0'
  295. caSETBOOKMARK1          ([Ctrl] 'K', '1')             'Set bookmark 1'
  296. caSETBOOKMARK2          ([Ctrl] 'K', '2')             'Set bookmark 2'
  297. caSETBOOKMARK3          ([Ctrl] 'K', '3')             'Set bookmark 3'
  298. caSETBOOKMARK4          ([Ctrl] 'K', '4')             'Set bookmark 4'
  299. caSETBOOKMARK5          ([Ctrl] 'K', '5')             'Set bookmark 5'
  300. caSETBOOKMARK6          ([Ctrl] 'K', '6')             'Set bookmark 6'
  301. caSETBOOKMARK7          ([Ctrl] 'K', '7')             'Set bookmark 7'
  302. caSETBOOKMARK8          ([Ctrl] 'K', '8')             'Set bookmark 8'
  303. caSETBOOKMARK9          ([Ctrl] 'K', '9')             'Set bookmark 9'
  304. caGOTOBOOKMARK0         ([Ctrl] 'Q', '0')             'Goto bookmark 0'
  305. caGOTOBOOKMARK1         ([Ctrl] 'Q', '1')             'Goto bookmark 1'
  306. caGOTOBOOKMARK2         ([Ctrl] 'Q', '2')             'Goto bookmark 2'
  307. caGOTOBOOKMARK3         ([Ctrl] 'Q', '3')             'Goto bookmark 3'
  308. caGOTOBOOKMARK4         ([Ctrl] 'Q', '4')             'Goto bookmark 4'
  309. caGOTOBOOKMARK5         ([Ctrl] 'Q', '5')             'Goto bookmark 5'
  310. caGOTOBOOKMARK6         ([Ctrl] 'Q', '6')             'Goto bookmark 6'
  311. caGOTOBOOKMARK7         ([Ctrl] 'Q', '7')             'Goto bookmark 7'
  312. caGOTOBOOKMARK8         ([Ctrl] 'Q', '8')             'Goto bookmark 8'
  313. caGOTOBOOKMARK9         ([Ctrl] 'Q', '9')             'Goto bookmark 9'
  314. caUNDO                  ([Ctrl] 'Z')                  'Undo'
  315. caREDO                  ([Ctrl Shift] 'Z')            'Redo'
  316. caPRINTSEL              ([CTRL] 'K', 'P')             'Print selection'
  317. // Auto-replace specifiers
  318. // Format:
  319. //       ActionKeys = <string>
  320. //       <source string> = <replacement string>
  321. // Notes: If ActionKeys is not specified then it will default to ';,:.=[]\n\t\s'
  322. %%autoreplace           ActionKeys    = ';,:.=()[]\{Return}\{Tab}\{Space}'
  323.                         'teh'         = 'the'
  324.                         '(c)'         = '
  325.                         '(r)'         = '
  326.                         '(tm)'        = '
  327. // Code-template specifiers
  328. // Format:
  329. //       Hotkey = <Key specifier>
  330. //       <template short name>  [ <template description> ] <template value>
  331. // Notes: Within the <template value> specifier, the position of the first '|' (vertical bar) character indicates
  332. //        the position of the caret after the replacement has taken place. If there is no '|' character then the
  333. //        caret will be at the end of the template
  334. //        If Hotkey is not specified then it will default to CTRL J
  335. %%templates
  336. Hotkey =  ([Ctrl] 'J')
  337. 'headgp' ( 'Procedure header - general' ) = '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\
  338.                                             \//\n\
  339.                                             \//  @procedure    |\n\
  340.                                             \//  @author       David Brock - dbrock@cqm.co.uk\n\
  341.                                             \//\n\
  342.                                             \//\n\
  343.                                             \//\n\
  344.                                             \///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\
  345.                                             procedure '
  346. 'casee' ( 'Case with else clause' )       = 'case | of\n\
  347.                                             \   :\n\
  348.                                             \   :\n\
  349.                                             \  else\n\
  350.                                             \ end;\n'
  351.