| 1 | /* Delphi brush is contributed by Eddie Shipman */ |
| 2 | dp.sh.Brushes.Delphi = function() |
| 3 | { |
| 4 | var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + |
| 5 | 'case char class comp const constructor currency destructor div do double ' + |
| 6 | 'downto else end except exports extended false file finalization finally ' + |
| 7 | 'for function goto if implementation in inherited int64 initialization ' + |
| 8 | 'integer interface is label library longint longword mod nil not object ' + |
| 9 | 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + |
| 10 | 'pint64 pointer private procedure program property pshortstring pstring ' + |
| 11 | 'pvariant pwidechar pwidestring protected public published raise real real48 ' + |
| 12 | 'record repeat set shl shortint shortstring shr single smallint string then ' + |
| 13 | 'threadvar to true try type unit until uses val var varirnt while widechar ' + |
| 14 | 'widestring with word write writeln xor'; |
| 15 | |
| 16 | this.regexList = [ |
| 17 | { regex: new RegExp('\\(\\*[\\s\\S]*?\\*\\)', 'gm'), css: 'comment' }, // multiline comments (* *) |
| 18 | { regex: new RegExp('{(?!\\$)[\\s\\S]*?}', 'gm'), css: 'comment' }, // multiline comments { } |
| 19 | { regex: new RegExp('//.*$', 'gm'), css: 'comment' }, // one line |
| 20 | { regex: new RegExp('\'(?:\\.|[^\\\'\'])*\'', 'g'), css: 'string' }, // strings |
| 21 | { regex: new RegExp('\\{\\$[a-zA-Z]+ .+\\}', 'g'), css: 'directive' }, // Compiler Directives and Region tags |
| 22 | { regex: new RegExp('\\b[\\d\\.]+\\b', 'g'), css: 'number' }, // numbers 12345 |
| 23 | { regex: new RegExp('\\$[a-zA-Z0-9]+\\b', 'g'), css: 'number' }, // numbers $F5D3 |
| 24 | { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keyword |
| 25 | ]; |
| 26 | |
| 27 | this.CssClass = 'dp-delphi'; |
| 28 | } |
| 29 | |
| 30 | dp.sh.Brushes.Delphi.prototype = new dp.sh.Highlighter(); |
| 31 | dp.sh.Brushes.Delphi.Aliases = ['delphi', 'pascal']; |