1/*
2Language: Delphi
3*/
4
5hljs.LANGUAGES.delphi = function(){
6  var DELPHI_KEYWORDS = {'and': 1, 'safecall': 1, 'cdecl': 1, 'then': 1, 'string': 1, 'exports': 1, 'library': 1, 'not': 1, 'pascal': 1, 'set': 1, 'virtual': 1, 'file': 1, 'in': 1, 'array': 1, 'label': 1, 'packed': 1, 'end.': 1, 'index': 1, 'while': 1, 'const': 1, 'raise': 1, 'for': 1, 'to': 1, 'implementation': 1, 'with': 1, 'except': 1, 'overload': 1, 'destructor': 1, 'downto': 1, 'finally': 1, 'program': 1, 'exit': 1, 'unit': 1, 'inherited': 1, 'override': 1, 'if': 1, 'type': 1, 'until': 1, 'function': 1, 'do': 1, 'begin': 1, 'repeat': 1, 'goto': 1, 'nil': 1, 'far': 1, 'initialization': 1, 'object': 1, 'else': 1, 'var': 1, 'uses': 1, 'external': 1, 'resourcestring': 1, 'interface': 1, 'end': 1, 'finalization': 1, 'class': 1, 'asm': 1, 'mod': 1, 'case': 1, 'on': 1, 'shr': 1, 'shl': 1, 'of': 1, 'register': 1, 'xorwrite': 1, 'threadvar': 1, 'try': 1, 'record': 1, 'near': 1, 'stored': 1, 'constructor': 1, 'stdcall': 1, 'inline': 1, 'div': 1, 'out': 1, 'or': 1, 'procedure': 1};
7  var DELPHI_CLASS_KEYWORDS = {'safecall': 1, 'stdcall': 1, 'pascal': 1, 'stored': 1, 'const': 1, 'implementation': 1, 'finalization': 1, 'except': 1, 'to': 1, 'finally': 1, 'program': 1, 'inherited': 1, 'override': 1, 'then': 1, 'exports': 1, 'string': 1, 'read': 1, 'not': 1, 'mod': 1, 'shr': 1, 'try': 1, 'div': 1, 'shl': 1, 'set': 1, 'library': 1, 'message': 1, 'packed': 1, 'index': 1, 'for': 1, 'near': 1, 'overload': 1, 'label': 1, 'downto': 1, 'exit': 1, 'public': 1, 'goto': 1, 'interface': 1, 'asm': 1, 'on': 1, 'of': 1, 'constructor': 1, 'or': 1, 'private': 1, 'array': 1, 'unit': 1, 'raise': 1, 'destructor': 1, 'var': 1, 'type': 1, 'until': 1, 'function': 1, 'else': 1, 'external': 1, 'with': 1, 'case': 1, 'default': 1, 'record': 1, 'while': 1, 'protected': 1, 'property': 1, 'procedure': 1, 'published': 1, 'and': 1, 'cdecl': 1, 'do': 1, 'threadvar': 1, 'file': 1, 'in': 1, 'if': 1, 'end': 1, 'virtual': 1, 'write': 1, 'far': 1, 'out': 1, 'begin': 1, 'repeat': 1, 'nil': 1, 'initialization': 1, 'object': 1, 'uses': 1, 'resourcestring': 1, 'class': 1, 'register': 1, 'xorwrite': 1, 'inline': 1, 'static': 1};
8  return {
9    defaultMode: {
10      lexems: [hljs.IDENT_RE],
11      illegal: '("|\\$[G-Zg-z]|\\/\\*|</)',
12      contains: ['comment', 'string', 'number', 'function', 'class'],
13      keywords: DELPHI_KEYWORDS
14    },
15    case_insensitive: true,
16    modes: [
17      {
18        className: 'comment',
19        begin: '{', end: '}',
20        relevance: 0
21      },
22      {
23        className: 'comment',
24        begin: '\\(\\*', end: '\\*\\)',
25        relevance: 10
26      },
27      hljs.C_LINE_COMMENT_MODE,
28      {
29        className: 'number',
30        begin: hljs.NUMBER_RE, end: '^',
31        relevance: 0
32      },
33      {
34        className: 'string',
35        begin: '\'', end: '\'',
36        contains: ['quote'],
37        relevance: 0
38      },
39      {
40        className: 'string',
41        begin: '(#\\d+)+', end: '^'
42      },
43      {
44        className: 'quote',
45        begin: '\'\'', end: '^', noMarkup: true
46      },
47      {
48        className: 'function',
49        begin: 'function\\b', end: '[:;]',
50        lexems: [hljs.IDENT_RE],
51        keywords: {'function': 1},
52        contains: ['title', 'params', 'comment'],
53        relevance: 0
54      },
55      {
56        className: 'function',
57        begin: '(procedure|constructor|destructor)\\b', end: ';',
58        lexems: [hljs.IDENT_RE],
59        keywords: {'constructor': 1, 'destructor': 1, 'procedure': 1},
60        contains: ['title', 'params', 'comment'],
61        relevance: 10
62      },
63      {
64        className: 'title',
65        begin: hljs.IDENT_RE, end: '^'
66      },
67      {
68        className: 'params',
69        begin: '\\(', end: '\\)',
70        lexems: [hljs.IDENT_RE],
71        keywords: DELPHI_KEYWORDS,
72        contains: ['string']
73      },
74      {
75        className: 'class',
76        begin: '=\\bclass\\b', end: 'end;',
77        lexems: [hljs.IDENT_RE],
78        keywords: DELPHI_CLASS_KEYWORDS,
79        contains: ['string', 'comment', 'function']
80      }
81    ]
82  };
83}();
84