UNPKG

3.13 kBJavaScriptView Raw
1/*
2Language: Oxygene
3Author: Carlo Kok <ck@remobjects.com>
4Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century.
5Website: https://www.elementscompiler.com/elements/default.aspx
6*/
7
8function oxygene(hljs) {
9 const OXYGENE_KEYWORDS = {
10 $pattern: /\.?\w+/,
11 keyword:
12 'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue ' +
13 'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false ' +
14 'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited ' +
15 'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of ' +
16 'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly ' +
17 'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple ' +
18 'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal ' +
19 'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained'
20 };
21 const CURLY_COMMENT = hljs.COMMENT(
22 /\{/,
23 /\}/,
24 {
25 relevance: 0
26 }
27 );
28 const PAREN_COMMENT = hljs.COMMENT(
29 '\\(\\*',
30 '\\*\\)',
31 {
32 relevance: 10
33 }
34 );
35 const STRING = {
36 className: 'string',
37 begin: '\'',
38 end: '\'',
39 contains: [
40 {
41 begin: '\'\''
42 }
43 ]
44 };
45 const CHAR_STRING = {
46 className: 'string',
47 begin: '(#\\d+)+'
48 };
49 const FUNCTION = {
50 className: 'function',
51 beginKeywords: 'function constructor destructor procedure method',
52 end: '[:;]',
53 keywords: 'function constructor|10 destructor|10 procedure|10 method|10',
54 contains: [
55 hljs.TITLE_MODE,
56 {
57 className: 'params',
58 begin: '\\(',
59 end: '\\)',
60 keywords: OXYGENE_KEYWORDS,
61 contains: [
62 STRING,
63 CHAR_STRING
64 ]
65 },
66 CURLY_COMMENT,
67 PAREN_COMMENT
68 ]
69 };
70 return {
71 name: 'Oxygene',
72 case_insensitive: true,
73 keywords: OXYGENE_KEYWORDS,
74 illegal: '("|\\$[G-Zg-z]|\\/\\*|</|=>|->)',
75 contains: [
76 CURLY_COMMENT,
77 PAREN_COMMENT,
78 hljs.C_LINE_COMMENT_MODE,
79 STRING,
80 CHAR_STRING,
81 hljs.NUMBER_MODE,
82 FUNCTION,
83 {
84 className: 'class',
85 begin: '=\\bclass\\b',
86 end: 'end;',
87 keywords: OXYGENE_KEYWORDS,
88 contains: [
89 STRING,
90 CHAR_STRING,
91 CURLY_COMMENT,
92 PAREN_COMMENT,
93 hljs.C_LINE_COMMENT_MODE,
94 FUNCTION
95 ]
96 }
97 ]
98 };
99}
100
101export { oxygene as default };