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 < prev    next >
Encoding:
Text File  |  1998-12-12  |  20.9 KB  |  433 lines

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