1 /* Invisible Vector Library
2 * simple FlexBox-based TUI engine
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 3 of the License ONLY.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 module iv
.egeditor
.highlighters
/*is aliced*/;
21 import iv
.egeditor
.editor
;
24 // ////////////////////////////////////////////////////////////////////////// //
27 HiText
, // dunno what, just a text
30 HiCommentMulti
, // kwidx: level; 0: non-nesting
31 HiCommentDirective
, // pascal directive
35 HiChar
, // starting, ending, text
54 HiPunct
, // some punctuation token
60 HiRegExp
, // js inline regexp
70 private enum HiBodySpecialMark
= 253; // sorry; end user will never see this
73 public bool hiIsComment() (in auto ref GapBuffer
.HighState hs
) nothrow {
75 case HiCommentOneLine
:
77 case HiCommentDirective
:
86 // ////////////////////////////////////////////////////////////////////////// //
87 public class EditorHLExt
: EditorHL
{
89 alias HS
= GapBuffer
.HighState
;
90 alias Opt
= EdHiTokens
.Opt
;
94 int validLines
; // how much lines was ever highlighted?
97 this (EdHiTokens atk
) { tks
= atk
; super(); }
99 // return `true` if next line was fucked
100 private final bool redoLine (int ls
, int le
) {
101 if (gb
.hi(ls
).kwtype
== 0) {
102 auto est
= gb
.hi(le
);
103 if (ls
< gb
.textsize
) rehighlightLine(ls
, le
);
104 // need to fix next line?
105 if (le
+1 < gb
.textsize
&& est
!= gb
.hi(le
)) {
106 gb
.hi(le
+1).kwtype
= 0;
113 // return true if highlighting for this line was changed
114 override bool fixLine (int line
) {
115 if (validLines
== 0) {
117 if (gb
.textsize
> 0) rehighlightLine(0, lc
.lineend(0));
119 if (line
== 0) return true;
122 if (line
>= validLines
) {
124 auto spos
= lc
.line2pos(validLines
);
125 while (line
>= validLines
) {
126 if (true/*gb.hi(spos).kwtype == 0*/) {
127 if (validLines
== line
) res
= true;
128 auto epos
= lc
.lineend(validLines
);
129 auto est
= gb
.hi(epos
);
130 if (spos
< gb
.textsize
) rehighlightLine(spos
, epos
);
131 // need to fix next line?
132 if (epos
+1 < gb
.textsize
&& est
!= gb
.hi(epos
)) gb
.hi(epos
+1).kwtype
= 0;
135 spos
= lc
.line2pos(validLines
+1);
140 auto ls
= lc
.line2pos(line
);
141 auto stt
= gb
.hi(ls
).kwtype
;
143 auto le
= lc
.lineend(line
);
144 if (redoLine(ls
, le
)) validLines
= line
+1; // should check next lines
151 // mark line as "need rehighlighting" (and possibly other text too)
152 // wasInsDel: some lines was inserted/deleted down the text
153 override void lineChanged (int line
, bool wasInsDel
) {
154 if (line
>= validLines
) return; // nothing to do
155 gb
.hi(lc
.line2pos(line
)).kwtype
= 0; // "rehighlight" flag
156 if (wasInsDel
) validLines
= line
; // rehighlight the following text
159 // this is *inclusive* range
160 protected void rehighlightLine (int ls
, int le
) {
162 immutable opt
= this.tks
.options
;
165 // return: 0: error; 1: normal; >1: escape (length)
166 int skipStrChar(bool allowEol
, bool allowEsc
) () {
167 import std
.ascii
: isHexDigit
;
168 if (spos
>= gb
.textsize
) return 0;
170 if (ch
== '\n') { static if (allowEol
) return 1; else return 0; }
171 static if (allowEsc
) {
174 if (ch
== 0) return 1;
175 if (ch
== '\n') { static if (allowEol
) return 2; else return 1; }
177 if (ch
== 'x' || ch
== 'X') hexd
= 2;
178 else if (ch
== 'u' || ch
== 'U') hexd
= 4;
179 if (hexd
== 0) return 2; // not a hex escape
180 foreach (immutable n
; 0..hexd
) {
182 if (!ch
.isHexDigit
) return n
+2;
190 // take ending state for the previous line
191 HS st
= (ls
> 0 ? gb
.hi(ls
-1) : HS(HiText
));
196 bool seenNonBlank
= false; // comments are blanks
197 bool inPreprocessor
= false;
200 if (st
.kwtype
== HiPreprocessor
) inPreprocessor
= true;
202 void skipNumMods () {
203 auto ch
= gb
[spos
+ofs
];
206 if (gb
[spos
+ofs
].tolower
== 'u') ++ofs
;
207 } else if (ch
== 'u' || ch
== 'U') {
209 if (gb
[spos
+ofs
] == 'L') ++ofs
;
210 } else if (ch
== 'f') {
215 mainloop
: while (spos
<= le
) {
216 // in double-quoted string?
217 if (st
.kwtype
== HiDQString || st
.kwtype
== HiDQStringSpecial
) {
220 auto len
= (opt
&Opt
.DQStringNoEscape ? skipStrChar
!(true, false)() : skipStrChar
!(true, true)());
221 if (len
== 0) { st
= HS(HiText
); continue mainloop
; }
224 gb
.hi(spos
++) = HS(HiDQString
);
225 if (gb
[spos
-1] == '"') { st
= HS(HiText
); continue mainloop
; }
228 foreach (immutable _
; 0..len
) gb
.hi(spos
++) = HS(HiDQStringSpecial
);
234 // in single-quoted string?
235 if (st
.kwtype
== HiSQString || st
.kwtype
== HiSQStringSpecial
) {
238 if ((opt
&Opt
.NumAsmHex
) && gb
[spos
] == '\n') {
239 gb
.hi(spos
++) = HS(HiText
);
243 auto len
= (opt
&Opt
.SQStringNoEscape ? skipStrChar
!(true, false)() : skipStrChar
!(true, true)());
244 if (len
== 0) { st
= HS(HiText
); continue mainloop
; }
247 gb
.hi(spos
++) = HS(HiSQString
);
248 if (gb
[spos
-1] == '\'') { st
= HS(HiText
); continue mainloop
; }
251 foreach (immutable _
; 0..len
) gb
.hi(spos
++) = HS(HiSQStringSpecial
);
254 if (opt
&Opt
.NumAsmHex
) st
= HS(HiText
); else st
= HS(HiSQString
);
257 // in backquoted string?
258 if (st
.kwtype
== HiBQString
) {
261 auto len
= skipStrChar
!(true, false)();
262 if (len
== 0) { st
= HS(HiText
); continue mainloop
; }
264 gb
.hi(spos
++) = HS(HiBQString
);
265 if (gb
[spos
-1] == '`') { st
= HS(HiText
); continue mainloop
; }
270 // in rackquoted string?
271 if (st
.kwtype
== HiRQString
) {
274 auto len
= skipStrChar
!(true, false)();
275 if (len
== 0) { st
= HS(HiText
); continue mainloop
; }
277 gb
.hi(spos
++) = HS(HiRQString
);
278 if (gb
[spos
-1] == '"') { st
= HS(HiText
); continue mainloop
; }
283 // in multiline comment?
284 if ((st
.kwtype
== HiCommentMulti
&& (st
.kwidx
== 0 ||
(opt
&Opt
.PascalComments
) != 0)) || st
.kwtype
== HiCommentDirective
) {
287 bool commentEnd
= false;
288 if (opt
&Opt
.PascalComments
) {
290 commentEnd
= (gb
[spos
-1] == '}');
292 commentEnd
= (gb
[spos
-2] == '*' && gb
[spos
-1] == ')');
295 commentEnd
= (gb
[spos
-2] == '*' && gb
[spos
-1] == '/');
304 // in nested multiline comment?
305 if (st
.kwtype
== HiCommentMulti
&& st
.kwidx
> 0 && (opt
&Opt
.PascalComments
) == 0) {
306 //FIXME: more than 255 levels aren't supported
307 ubyte level
= st
.kwidx
;
311 if (ch
== '+' && gb
[spos
+1] == '/') {
312 gb
.hi(spos
++) = HS(HiCommentMulti
, level
);
313 gb
.hi(spos
++) = HS(HiCommentMulti
, level
);
314 if (--level
== 0) { st
= HS(HiText
); continue mainloop
; }
315 } else if (ch
== '/' && gb
[spos
+1] == '+') {
317 gb
.hi(spos
++) = HS(HiCommentMulti
, level
);
318 gb
.hi(spos
++) = HS(HiCommentMulti
, level
);
320 gb
.hi(spos
++) = HS(HiCommentMulti
, level
);
323 st
= HS(HiCommentMulti
, level
);
327 // single-line comment?
328 if (ch
== '/' && (opt
&Opt
.CSingleComment
) && gb
[spos
+1] == '/') {
329 gb
.hi(spos
++) = HS(HiCommentOneLine
);
330 gb
.hi(spos
++) = HS(HiCommentOneLine
);
331 st
= HS(HiCommentOneLine
);
332 while (spos
<= le
) gb
.hi(spos
++) = st
;
335 // sql single-line comment?
336 if (ch
== '-' && (opt
&Opt
.SqlSingleComment
) && gb
[spos
+1] == '-') {
337 gb
.hi(spos
++) = HS(HiCommentOneLine
);
338 gb
.hi(spos
++) = HS(HiCommentOneLine
);
339 st
= HS(HiCommentOneLine
);
340 while (spos
<= le
) gb
.hi(spos
++) = st
;
343 // shell single-line comment?
344 if (ch
== '#' && (opt
&Opt
.ShellSingleComment
)) {
345 gb
.hi(spos
++) = HS(HiCommentOneLine
);
346 gb
.hi(spos
++) = HS(HiCommentOneLine
);
347 st
= HS(HiCommentOneLine
);
348 while (spos
<= le
) gb
.hi(spos
++) = st
;
351 // cougar single-line comment?
352 if (ch
== ';' && (opt
&Opt
.CougarSingleComment
)) {
353 gb
.hi(spos
++) = HS(HiCommentOneLine
);
354 gb
.hi(spos
++) = HS(HiCommentOneLine
);
355 st
= HS(HiCommentOneLine
);
356 while (spos
<= le
) gb
.hi(spos
++) = st
;
359 // C multiline comment?
360 if (ch
== '/' && (opt
&(Opt
.CMultiComment|Opt
.PascalComments
)) == Opt
.CMultiComment
&& gb
[spos
+1] == '*') {
361 gb
.hi(spos
++) = HS(HiCommentMulti
);
362 gb
.hi(spos
++) = HS(HiCommentMulti
);
363 st
= HS(HiCommentMulti
);
366 // Pascal multiline comment?
367 if (ch
== '(' && (opt
&(Opt
.CMultiComment|Opt
.PascalComments
)) == (Opt
.CMultiComment|Opt
.PascalComments
) && gb
[spos
+1] == '*') {
368 st
= HS((gb
[spos
+2] == '$' ? HiCommentDirective
: HiCommentMulti
), 1);
373 // Pascal multiline comment?
374 if (ch
== '{' && (opt
&(Opt
.CMultiComment|Opt
.PascalComments
)) == (Opt
.CMultiComment|Opt
.PascalComments
)) {
375 st
= HS((gb
[spos
+1] == '$' ? HiCommentDirective
: HiCommentMulti
), 0);
379 // nested multiline comment?
380 if (ch
== '/' && (opt
&Opt
.DNestedComment
) && gb
[spos
+1] == '+') {
381 st
= HS(HiCommentMulti
, 1);
387 if (!inPreprocessor
&& ch
== '#' && !seenNonBlank
&& (opt
&Opt
.CPreprocessor
)) inPreprocessor
= true;
388 if (inPreprocessor
) {
389 // in preprocessor; eol?
391 // check for continuation
392 if (spos
-1 >= ls
&& gb
[spos
-1] == '\\') {
394 st
= HS(HiPreprocessor
);
404 st
= HS(HiPreprocessor
);
409 if (ch
> ' ') seenNonBlank
= true;
411 if (ch
== '/' && (opt
&Opt
.JSRegExp
)) {
414 if (gb
[ep
] == '/') break;
415 if (gb
[ep
] == '\\' && ep
+1 <= le
) ++ep
;
421 while (spos
<= ep
) gb
.hi(spos
++) = st
;
430 // control char or non-ascii char?
431 if (ch
<= ' ' || ch
>= 127) {
437 if (ch
== '\'' && (opt
&Opt
.SQString
)) {
438 gb
.hi(spos
++) = HS(HiSQString
);
443 if (ch
== '"' && (opt
&Opt
.DQString
)) {
444 gb
.hi(spos
++) = HS(HiDQString
);
449 if (ch
== '`' && (opt
&Opt
.BQString
)) {
450 gb
.hi(spos
++) = HS(HiBQString
);
455 if (ch
== 'r' && (opt
&Opt
.RQString
) && gb
[spos
+1] == '"') {
456 gb
.hi(spos
++) = HS(HiRQString
);
457 gb
.hi(spos
++) = HS(HiRQString
);
462 if (ch
== '\'' && (opt
&Opt
.SQChar
)) {
465 auto len
= skipStrChar
!(false, true)();
466 if (len
> 0 && gb
[spos
+len
] == '\'') {
468 gb
.hi(spos
++) = HS(HiChar
);
469 st
= HS(len
== 1 ? HiChar
: HiCharSpecial
);
470 while (len
--) gb
.hi(spos
++) = st
;
471 gb
.hi(spos
++) = HS(HiChar
);
478 if (len
== 0 || gb
[spos
] == '\'') { gb
.hi(spos
++) = st
; continue mainloop
; }
479 while (len
-- > 0) gb
.hi(spos
++) = st
;
480 len
= skipStrChar
!(false, true)();
487 if (ch
== '#' && (opt
&Opt
.CougarCharLiteral
) /*&& (spos-1 < ls || gb[spos-1] == '\\')*/) {
490 auto len
= skipStrChar
!(true, true)();
492 st
= HS(HiCharSpecial
);
495 while (len
--) gb
.hi(spos
++) = st
;
501 if ((opt
&Opt
.MaximumTokens
) && gb
[spos
] == 'c') {
506 if (ch
!= 'a' && ch
!= 'd') break;
510 if (epos
<= le
&& cnt
> 1 && gb
[epos
] == 'r') {
512 if (ch
<= ' ' || ch
== '(' || ch
== ')' || ch
== ';' ||
513 (ch
== '/' && (gb
[epos
+1] == '*' || gb
[epos
+1] == '+' || gb
[epos
+1] == '/')))
516 foreach (immutable _
; spos
..epos
) gb
.hi(spos
++) = st
;
522 // identifier/keyword?
523 if (ch
.isalpha || ch
== '_') {
524 auto tmach
= tks
.start();
529 if (!(opt
&Opt
.MaximumTokens
)) {
530 if (ch
!= '_' && !ch
.isalnum
) break;
532 if (ch
<= ' ' || ch
== '(' || ch
== ')' || ch
== ';' ||
533 (ch
== '/' && (gb
[epos
+1] == '*' || gb
[epos
+1] == '+' || gb
[epos
+1] == '/')))
538 stx
= tmach
.advance(ch
);
541 if (epos
<= spos
&& spos
< le
) epos
= spos
+1;
545 if (stx
== HiBodySpecialMark
) {
548 while (xofs
< gb
.textsize
) {
550 if (ch
== '{') { st
= HS(HiSpecial
); break; }
554 } else if (opt
&Opt
.NumAsmHex
) {
556 if (epos
-spos
== 2 &&
557 (gb
[spos
] == 'a' || gb
[spos
] == 'A') &&
558 (gb
[spos
+1] == 'f' || gb
[spos
+1] == 'F') &&
562 } else if (spos
> 2 && epos
-spos
== 1 && (gb
[spos
] == 'C' || gb
[spos
] == 'c')) {
563 // "c" can be either condition, or regname
564 // if previous token ends with "r"(jr), "p"(jp), "l"(call), "t"(ret), use condition
566 while (ptp
> 0 && gb
[ptp
] != '\n' && gb
[ptp
] <= ' ') --ptp
;
567 if (gb
[ptp
] == 'r' || gb
[ptp
] == 'p' || gb
[ptp
] == 'l' || gb
[ptp
] == 't' ||
568 gb
[ptp
] == 'R' || gb
[ptp
] == 'P' || gb
[ptp
] == 'L' || gb
[ptp
] == 'T')
577 foreach (immutable _
; spos
..epos
) gb
.hi(spos
++) = st
;
582 if (auto base
= isBasedStart(spos
, basedNumSkip
)) {
583 bool au
= ((opt
&Opt
.NumAllowUnder
) != 0);
584 ofs
= basedNumSkip
; //(ch == '+' || ch == '-' ? 3 : 2);
585 while (spos
+ofs
<= le
) {
587 if (ch
.digitInBase(base
) >= 0 ||
(au
&& ch
== '_')) { ++ofs
; continue; }
592 if (gb
[spos
+ofs
].isalnum
) { gb
.hi(spos
++) = st
; continue mainloop
; }
595 foreach (immutable _
; 0..ofs
) gb
.hi(spos
++) = st
;
599 // decimal/floating number
600 if (isDecStart(spos
)) {
601 bool au
= (opt
&Opt
.NumAllowUnder
) != 0;
603 while (spos
+ofs
<= le
) {
605 if (ch
.isdigit ||
(au
&& ch
== '_')) { ++ofs
; continue; }
608 if (gb
[spos
+ofs
] == '.' && gb
[spos
+ofs
+1] != '.') {
610 if (isDecStart(spos
+ofs
)) {
612 while (spos
+ofs
<= le
&& (gb
[spos
+ofs
].isdigit ||
(au
&& gb
[spos
+ofs
] == '_'))) ++ofs
;
614 if (gb
[spos
+ofs
].tolower
== 'e' && isDecStart(spos
+ofs
+1)) {
616 while (spos
+ofs
<= le
&& (gb
[spos
+ofs
].isdigit ||
(au
&& gb
[spos
+ofs
] == '_'))) ++ofs
;
621 if (gb
[spos
+ofs
].isalnum
) { gb
.hi(spos
++) = st
; continue mainloop
; }
624 foreach (immutable _
; 0..ofs
) gb
.hi(spos
++) = st
;
629 if (tks
.canStartWith(ch
)) {
630 bool isdollar
= (ch
== '$');
631 auto tmach
= tks
.start();
635 while (epos
<= le
&& tmach
.canContinue
) {
636 if (auto tx
= tmach
.advance(gb
[epos
++])) {
637 lastlen
= cast(uint)(epos
-spos
);
641 if (lastlen
== 0 && isdollar
&& (opt
&Opt
.ShellSigil
) && spos
+1 < le
) goto sigil
;
648 foreach (immutable cp
; 0..lastlen
) gb
.hi(spos
++) = st
;
652 if (ch
== '$' && (opt
&Opt
.ShellSigil
) && spos
+1 < le
) {
656 if (gb
[spos
] == '{') {
670 if (ch
.isalnum || ch
== '.' || ch
== '_') {
686 // returns either 0 or "skip count"
687 int isGoodChar (int pos
) nothrow {
688 if (gb
[pos
] != '\'') return 0;
689 if (gb
[pos
+1] == '\\') {
691 if (ch
!= 'x' && ch
!= 'X') return (gb
[pos
+3] == '\'' ?
4 : 0);
692 if (!gb
[pos
+3].isxdigit
) return 0;
694 if (!ch
.isxdigit
) return (ch
== '\'' ?
5 : 0);
695 return (gb
[pos
+5] == '\'' ?
6 : 0);
696 } else if (gb
[pos
+2] == '\'') {
703 bool isDecStart (int pos
) nothrow {
705 if (ch
== '-' || ch
== '+') {
706 if (!(tks
.options
&Opt
.NumAllowSign
)) return false;
709 if (ch
.isdigit
) return true;
710 // floating can start with '.<digit>'
711 return (ch
== '.' && gb
[pos
+1].isdigit
);
715 int isBasedStart (int pos
, out int basedNumSkip
) nothrow {
717 if (ch
== '-' || ch
== '+') {
718 if (!(tks
.options
&Opt
.NumAllowSign
)) return 0;
720 basedNumSkip
= 1; // sign
722 // pascal $hex literal?
723 if ((tks
.options
&Opt
.NumPasHex
) && ch
== '$' && gb
[pos
].digitInBase(16) >= 0) {
724 basedNumSkip
+= 1; // dollar
728 if ((tks
.options
&Opt
.NumAsmHex
) && ch
== '#' && gb
[pos
].digitInBase(16) >= 0) {
729 basedNumSkip
+= 1; // hash
733 if ((tks
.options
&Opt
.NumAsmHex
) && ch
== '&' && gb
[pos
+1].digitInBase(16) >= 0) {
734 immutable char c1
= gb
[pos
];
735 if (c1
== 'h' || c1
== 'H') { basedNumSkip
+= 2; return 16; }
736 if (c1
== 'b' || c1
== 'B') { basedNumSkip
+= 2; return 2; }
737 if (c1
== 'o' || c1
== 'O') { basedNumSkip
+= 2; return 8; }
738 if (c1
== 'd' || c1
== 'D') { basedNumSkip
+= 2; return 10; }
740 if (ch
!= '0') return 0;
743 if (ch
== 'x' || ch
== 'X') base
= 16;
744 else if (ch
== 'o' || ch
== 'O') base
= 8;
745 else if (ch
== 'b' || ch
== 'B') base
= 2;
746 else if (ch
== 'd' || ch
== 'D') base
= 10;
748 if (!(tks
.options
&Opt
.Num0x
) && base
== 16) return 0;
749 if (!(tks
.options
&Opt
.Num0o
) && base
== 8) return 0;
750 if (!(tks
.options
&Opt
.Num0b
) && base
== 2) return 0;
752 if (!(tks
.options
&Opt
.Num0o
) && base
== 10) return 0;
753 basedNumSkip
+= 2; // 0n prefix
754 return (gb
[pos
].digitInBase(base
) >= 0 ? base
: 0);
759 // ////////////////////////////////////////////////////////////////////////// //
760 public class EditorHLTODO
: EditorHLExt
{
761 this () { super(null); }
763 protected override void rehighlightLine (int ls
, int le
) {
764 while (ls
<= le
&& gb
[ls
] <= ' ') gb
.hi(ls
++) = HS(HiText
);
765 if (le
-ls
+1 >= 3 && gb
[ls
] == '[' && gb
[ls
+2] == ']') {
766 auto st
= HS(HiNone
);
768 case '.': st
= HS(HiToDoOpen
); break;
769 case '!': st
= HS(HiToDoUrgent
); break;
770 case '+': st
= HS(HiToDoSemi
); break;
771 case '*': st
= HS(HiToDoDone
); break;
772 case '-': st
= HS(HiToDoDont
); break;
773 case '?': st
= HS(HiToDoUnsure
); break;
776 if (st
.kwtype
!= HiNone
) {
782 while (ls
<= le
) gb
.hi(ls
++) = HS(HiText
);
787 // ////////////////////////////////////////////////////////////////////////// //
788 public class EditorHLGitCommit
: EditorHLExt
{
789 this () { super(null); }
791 protected override void rehighlightLine (int ls
, int le
) {
792 while (ls
<= le
&& gb
[ls
] != '#') gb
.hi(ls
++) = HS(HiText
);
793 while (ls
<= le
) gb
.hi(ls
++) = HS(HiCommentOneLine
);
798 // ////////////////////////////////////////////////////////////////////////// //
799 struct TokenMachine
{
801 enum InvalidState
= 0;
804 static struct MachineNode
{
805 char ch
= 0; // current char
806 ubyte endstate
= InvalidState
; // if not ubyte.max, this is what we should have if this node is terminal
807 char firstch
; // in next array
809 @property int next (char ch
) const pure nothrow @trusted @nogc {
810 pragma(inline
, true);
811 return (ch
>= firstch
&& ch
< firstch
+nexta
.length ? nexta
.ptr
[ch
-firstch
] : 0);
813 void setNext (char ch
, int n
) nothrow @trusted {
815 auto optr
= nexta
.ptr
;
816 if (nexta
.length
== 0) {
821 } else if (ch
< firstch
) {
823 auto inclen
= firstch
-nfch
;
824 nexta
.length
+= inclen
;
825 foreach_reverse (immutable cc
; inclen
..nexta
.length
) nexta
.ptr
[cc
] = nexta
.ptr
[cc
-inclen
];
826 nexta
[0..inclen
] = 0;
829 if (ch
-firstch
>= nexta
.length
) nexta
.length
= ch
-firstch
+1;
831 nexta
[ch
-firstch
] = n
;
832 if (nexta
.ptr
!is optr
) {
833 import core
.memory
: GC
;
834 if (nexta
.ptr
is GC
.addrOf(nexta
.ptr
)) {
835 //conwriteln("resized, fixing flags...");
836 GC
.setAttr(nexta
.ptr
, GC
.BlkAttr
.NO_SCAN|GC
.BlkAttr
.NO_INTERIOR
); // less false positives
846 int minlen
= 0, maxlen
= 0; // token lengthes
847 bool casesens
= true;
850 int addMachineNode (MachineNode node
) {
851 if (mach
.length
>= int.max
) assert(0, "too many nodes in mach");
852 auto optr
= mach
.ptr
;
853 auto res
= cast(int)mach
.length
;
855 if (mach
.ptr
!is optr
) {
856 import core
.memory
: GC
;
857 if (mach
.ptr
is GC
.addrOf(mach
.ptr
)) {
858 //conwriteln("resized, fixing flags...");
859 GC
.setAttr(mach
.ptr
, GC
.BlkAttr
.NO_INTERIOR
); // less false positives
866 void addToken (string tok
, ubyte estate
) {
867 if (tok
.length
>= int.max
/8) assert(0, "wtf?!");
868 if (tok
.length
== 0) return;
869 if (minlen
== 0 || tok
.length
< minlen
) minlen
= cast(int)tok
.length
;
870 if (tok
.length
> maxlen
) maxlen
= cast(int)tok
.length
;
871 assert(estate
!= InvalidState
);
872 if (mach
.length
== 0) addMachineNode(MachineNode(0));
874 auto tst
= checkToken(tok
);
875 if (tst
!= InvalidState
) {
877 import core
.stdc
.stdio
: stderr
, fprintf
;
878 stderr
.fprintf("WARNING: CONFLICTING TOKEN: '%.*s' (%u:%u)\n", cast(uint)tok
.length
, tok
.ptr
, cast(uint)tst
, cast(uint)estate
);
884 foreach (char ch
; tok
) {
885 if (!casesens
&& ch
>= 'A' && ch
<= 'Z') ch
+= 32;
886 int nextnode
= mach
[lastnode
].next(ch
);
889 nextnode
= addMachineNode(MachineNode(ch
));
890 mach
[lastnode
].setNext(ch
, nextnode
);
894 assert(lastnode
> 0);
895 char lastch
= tok
[$-1];
896 assert(mach
[lastnode
].ch
== lastch
);
897 assert(mach
[lastnode
].endstate
== InvalidState
);
898 mach
[lastnode
].endstate
= estate
;
901 ubyte checkToken (const(char)[] tok
) const nothrow @trusted @nogc {
902 if (tok
.length
< minlen || tok
.length
> maxlen
) return InvalidState
;
905 foreach (char ch
; tok
) if ((node
= mach
.ptr
[node
].next(ch
)) == 0) return InvalidState
;
907 foreach (char ch
; tok
) {
908 if (ch
>= 'A' && ch
<= 'Z') ch
+= 32;
909 if ((node
= mach
.ptr
[node
].next(ch
)) == 0) return InvalidState
;
912 return mach
.ptr
[node
].endstate
;
915 auto start () const nothrow @trusted @nogc {
916 static struct Checker
{
918 const(TokenMachine
)* tmach
;
921 nothrow @trusted @nogc:
922 @property ubyte state () const { pragma(inline
, true); return (curnode
>= 0 ? tmach
.mach
.ptr
[curnode
].endstate
: InvalidState
); }
923 @property bool canContinue () const { pragma(inline
, true); return (curnode
>= 0); }
924 @property int mintklen () const { pragma(inline
, true); return tmach
.minlen
; }
925 @property int maxtklen () const { pragma(inline
, true); return tmach
.maxlen
; }
926 ubyte advance (char ch
) {
928 if (!tmach
.casesens
&& ch
>= 'A' && ch
<= 'Z') ch
+= 32;
929 if ((curnode
= tmach
.mach
.ptr
[curnode
].next(ch
)) == 0) {
933 return tmach
.mach
.ptr
[curnode
].endstate
;
940 return Checker(&this, 0);
945 // ////////////////////////////////////////////////////////////////////////// //
946 public abstract class EdHiTokens
{
949 static assert(NotFound
== TokenMachine
.InvalidState
);
951 // if `SqlSingleComment` is set, strings cannot has escapes
952 // BQString and RQString cannot have escapes, ever
953 // double-quited strings are processed iff NoStrings flag is NOT set
955 // number parsing options
959 NumAllowUnder
= 1U<<3,
960 NumAllowSign
= 1U<<4,
961 SQString
= 1U<<5, // can string be single-quoted?
962 DQString
= 1U<<6, // can string be double-quoted?
963 BQString
= 1U<<7, // allow D-style `...` strings
964 RQString
= 1U<<8, // allow D-style r"..." strings
965 SQChar
= 1U<<9, // allow single-quoted chars; escapes always allowed
967 DNestedComment
= 1U<<10, // allow `/+ ... +/` newsted comments
968 ShellSingleComment
= 1U<<11, // allow `# ` comments
969 CSingleComment
= 1U<<12, // allow `//` comments
970 CMultiComment
= 1U<<13, // allow `/* ... */` comments
971 SqlSingleComment
= 1U<<14, // allow `--` comments
973 CPreprocessor
= 1U<<15, // does this language use C preprocessor?
974 JSRegExp
= 1U<<16, // parse JS inline regexps?
975 ShellSigil
= 1U<<17, // parse shell sigils?
976 // token machine options
977 CaseInsensitive
= 1U<<18, // are tokens case-sensitive?
979 SQStringNoEscape
= 1U<<19, // no escapes are allowed in single-quoted strings
980 DQStringNoEscape
= 1U<<20, // no escapes are allowed in double-quoted strings
982 CougarSingleComment
= 1U<<21,
983 CougarCharLiteral
= 1U<<22,
984 MaximumTokens
= 1U<<23,
985 PascalComments
= 1U<<24,
987 NumAsmHex
= 1U<<26, // this also disables multiline strings
989 static assert(Opt
.max
<= uint.max
);
995 final void setOptions (uint opt
) {
997 tmach
.casesens
= ((opt
&Opt
.CaseInsensitive
) == 0);
1001 this (uint opt
) { setOptions(opt
); }
1004 void addToken (string tok
, ubyte estate
) {
1005 pragma(inline
, true);
1006 tmach
.addToken(tok
, estate
);
1009 bool canStartWith (char ch
) const nothrow @trusted @nogc {
1010 pragma(inline
, true);
1011 return (tmach
.mach
.ptr
[0].next(ch
) > 0);
1014 auto start () const nothrow @trusted @nogc {
1015 pragma(inline
, true);
1016 return tmach
.start();
1021 // ////////////////////////////////////////////////////////////////////////// //
1022 public class EdHiTokensD
: EdHiTokens
{
1036 //Opt.ShellSingleComment|
1039 //Opt.SqlSingleComment|
1040 //Opt.CPreprocessor|
1043 //Opt.CaseInsensitive|
1044 //Opt.SQStringNoEscape|
1045 //Opt.DQStringNoEscape|
1046 //Opt.CougarSingleComment|
1047 //Opt.CougarCharLiteral|
1048 //Opt.MaximumTokens|
1049 //Opt.PascalComments|
1055 addToken("body", /*HiSpecial*/HiBodySpecialMark
);
1057 addToken("this", HiInternal
);
1058 addToken("super", HiInternal
);
1060 addToken("assert", HiBuiltin
);
1061 addToken("new", HiBuiltin
);
1062 addToken("delete", HiBuiltin
);
1064 addToken("null", HiKeyword
);
1065 addToken("true", HiKeyword
);
1066 addToken("false", HiKeyword
);
1067 addToken("cast", HiKeyword
);
1068 addToken("throw", HiKeyword
);
1069 addToken("module", HiKeyword
);
1070 addToken("pragma", HiKeyword
);
1071 addToken("typeof", HiKeyword
);
1072 addToken("typeid", HiKeyword
);
1073 addToken("sizeof", HiKeyword
);
1074 addToken("template", HiKeyword
);
1076 addToken("void", HiType
);
1077 addToken("byte", HiType
);
1078 addToken("ubyte", HiType
);
1079 addToken("short", HiType
);
1080 addToken("ushort", HiType
);
1081 addToken("int", HiType
);
1082 addToken("uint", HiType
);
1083 addToken("long", HiType
);
1084 addToken("ulong", HiType
);
1085 addToken("cent", HiType
);
1086 addToken("ucent", HiType
);
1087 addToken("float", HiType
);
1088 addToken("double", HiType
);
1089 addToken("real", HiType
);
1090 addToken("bool", HiType
);
1091 addToken("char", HiType
);
1092 addToken("wchar", HiType
);
1093 addToken("dchar", HiType
);
1094 addToken("ifloat", HiType
);
1095 addToken("idouble", HiType
);
1096 addToken("ireal", HiType
);
1097 addToken("cfloat", HiType
);
1098 addToken("cdouble", HiType
);
1099 addToken("creal", HiType
);
1100 addToken("string", HiType
);
1101 addToken("usize", HiType
);
1102 addToken("uhash", HiType
);
1103 addToken("ssize", HiType
);
1104 addToken("size_t", HiInternal
);
1105 addToken("ptrdiff_t", HiInternal
);
1106 addToken("cstring", HiType
);
1108 addToken("delegate", HiKeyword
);
1109 addToken("function", HiKeyword
);
1110 addToken("is", HiKeyword
);
1111 addToken("if", HiKeyword
);
1112 addToken("else", HiKeyword
);
1113 addToken("while", HiKeyword
);
1114 addToken("for", HiKeyword
);
1115 addToken("do", HiKeyword
);
1116 addToken("switch", HiKeyword
);
1117 addToken("case", HiKeyword
);
1118 addToken("default", HiKeyword
);
1119 addToken("break", HiKeyword
);
1120 addToken("continue", HiKeyword
);
1121 addToken("synchronized", HiBuiltin
);
1122 addToken("return", HiKeyword
);
1123 addToken("goto", HiKeyword
);
1124 addToken("try", HiKeyword
);
1125 addToken("catch", HiKeyword
);
1126 addToken("finally", HiKeyword
);
1127 addToken("with", HiKeyword
);
1128 addToken("asm", HiKeyword
);
1129 addToken("foreach", HiKeyword
);
1130 addToken("foreach_reverse", HiKeyword
);
1131 addToken("scope", HiKeyword
);
1132 addToken("struct", HiKeyword
);
1133 addToken("class", HiKeyword
);
1134 addToken("interface", HiKeyword
);
1135 addToken("union", HiKeyword
);
1136 addToken("enum", HiKeyword
);
1137 addToken("mixin", HiKeyword
);
1138 addToken("static", HiKeyword
);
1139 addToken("final", HiKeyword
);
1140 addToken("const", HiKeyword
);
1141 addToken("alias", HiKeyword
);
1142 addToken("override", HiKeyword
);
1143 addToken("abstract", HiKeyword
);
1144 addToken("debug", HiKeyword
);
1145 addToken("deprecated", HiKeyword
);
1147 addToken("import", HiInternal
);
1149 addToken("in", HiSpecial
);
1150 addToken("out", HiSpecial
);
1151 addToken("inout", HiSpecial
);
1152 addToken("lazy", HiSpecial
);
1154 addToken("auto", HiType
);
1156 addToken("align", HiSpecial
);
1157 addToken("extern", HiSpecial
);
1158 addToken("private", HiSpecial
);
1159 addToken("package", HiSpecial
);
1160 addToken("protected", HiSpecial
);
1161 addToken("public", HiSpecial
);
1162 addToken("export", HiSpecial
);
1163 addToken("invariant", HiSpecial
);
1164 addToken("unittest", HiSpecial
);
1165 addToken("version", HiSpecial
);
1167 addToken("__argTypes", HiInternal
);
1168 addToken("__parameters", HiInternal
);
1170 addToken("ref", HiSpecial
);
1172 addToken("macro", HiInternal
);
1173 addToken("pure", HiInternal
);
1174 addToken("__gshared", HiInternal
);
1175 addToken("__traits", HiInternal
);
1176 addToken("__vector", HiInternal
);
1177 addToken("__overloadset", HiInternal
);
1178 addToken("__FILE__", HiInternal
);
1179 addToken("__FILE_FULL_PATH__", HiInternal
);
1180 addToken("__LINE__", HiInternal
);
1181 addToken("__MODULE__", HiInternal
);
1182 addToken("__FUNCTION__", HiInternal
);
1183 addToken("__PRETTY_FUNCTION__", HiInternal
);
1184 addToken("shared", HiInternal
);
1186 addToken("immutable", HiKeyword
);
1188 addToken("nothrow", HiUDA
);
1189 addToken("@nothrow", HiUDA
);
1190 addToken("@nogc", HiUDA
);
1191 addToken("@safe", HiUDA
);
1192 addToken("@system", HiUDA
);
1193 addToken("@trusted", HiUDA
);
1194 addToken("@property", HiUDA
);
1195 addToken("@disable", HiUDA
);
1197 addToken("{", HiPunct
);
1198 addToken("}", HiPunct
);
1199 addToken("(", HiPunct
);
1200 addToken(")", HiPunct
);
1201 addToken("[", HiPunct
);
1202 addToken("]", HiPunct
);
1203 addToken(";", HiSemi
);
1204 addToken(":", HiPunct
);
1205 addToken(",", HiPunct
);
1206 addToken(".", HiPunct
);
1207 addToken("^", HiPunct
);
1208 addToken("^=", HiPunct
);
1209 addToken("=", HiPunct
);
1210 addToken("=", HiPunct
);
1211 addToken("=", HiPunct
);
1212 addToken("<", HiPunct
);
1213 addToken(">", HiPunct
);
1214 addToken("<=", HiPunct
);
1215 addToken(">=", HiPunct
);
1216 addToken("==", HiPunct
);
1217 addToken("!=", HiPunct
);
1218 addToken("!<>=", HiPunct
);
1219 addToken("!<>", HiPunct
);
1220 addToken("<>", HiPunct
);
1221 addToken("<>=", HiPunct
);
1222 addToken("!>", HiPunct
);
1223 addToken("!>=", HiPunct
);
1224 addToken("!<", HiPunct
);
1225 addToken("!<=", HiPunct
);
1226 addToken("!", HiPunct
);
1227 addToken("<<", HiPunct
);
1228 addToken(">>", HiPunct
);
1229 addToken(">>>", HiPunct
);
1230 addToken("+", HiPunct
);
1231 addToken("-", HiPunct
);
1232 addToken("*", HiPunct
);
1233 addToken("/", HiPunct
);
1234 addToken("%", HiPunct
);
1235 addToken("..", HiPunct
);
1236 addToken("...", HiKeywordHi
);
1237 addToken("&", HiPunct
);
1238 addToken("&&", HiSpecial
);
1239 addToken("|", HiPunct
);
1240 addToken("||", HiSpecial
);
1241 addToken("[]", HiPunct
);
1242 addToken("&", HiPunct
);
1243 addToken("*", HiPunct
);
1244 addToken("~", HiPunct
);
1245 addToken("$", HiPunct
);
1246 addToken("++", HiPunct
);
1247 addToken("--", HiPunct
);
1248 addToken("++", HiPunct
);
1249 addToken("--", HiPunct
);
1250 addToken("?", HiPunct
);
1251 addToken("-", HiPunct
);
1252 addToken("+", HiPunct
);
1253 addToken("+=", HiPunct
);
1254 addToken("-=", HiPunct
);
1255 addToken("*=", HiPunct
);
1256 addToken("/=", HiPunct
);
1257 addToken("%=", HiPunct
);
1258 addToken("<<=", HiPunct
);
1259 addToken(">>=", HiPunct
);
1260 addToken(">>>=", HiPunct
);
1261 addToken("&=", HiPunct
);
1262 addToken("|=", HiPunct
);
1263 addToken("~=", HiPunct
);
1264 addToken("~", HiPunct
);
1265 //addToken("is", HiPunct);
1266 //addToken("!is", HiPunct);
1267 //addToken("@", HiPunct);
1268 addToken("^^", HiPunct
);
1269 addToken("^^=", HiPunct
);
1270 addToken("=>", HiPunct
);
1272 addToken("aliced", HiAliced
);
1277 // ////////////////////////////////////////////////////////////////////////// //
1278 public class EdHiTokensJS
: EdHiTokens
{
1284 //Opt.NumAllowUnder|
1291 //Opt.DNestedComment|
1292 //Opt.ShellSingleComment|
1295 //Opt.SqlSingleComment|
1296 //Opt.CPreprocessor|
1299 //Opt.CaseInsensitive|
1300 //Opt.SQStringNoEscape|
1301 //Opt.DQStringNoEscape|
1302 //Opt.CougarSingleComment|
1303 //Opt.CougarCharLiteral|
1304 //Opt.MaximumTokens|
1305 //Opt.PascalComments|
1310 addToken("arguments", HiKeyword
);
1311 addToken("break", HiKeyword
);
1312 addToken("callee", HiKeyword
);
1313 addToken("caller", HiKeyword
);
1314 addToken("case", HiKeyword
);
1315 addToken("catch", HiKeyword
);
1316 addToken("constructor", HiKeyword
);
1317 addToken("const", HiKeywordHi
);
1318 addToken("continue", HiKeyword
);
1319 addToken("default", HiKeyword
);
1320 addToken("delete", HiKeyword
);
1321 addToken("do", HiKeyword
);
1322 addToken("else", HiKeyword
);
1323 addToken("finally", HiKeyword
);
1324 addToken("for", HiKeyword
);
1325 addToken("function", HiKeyword
);
1326 addToken("get", HiKeywordHi
);
1327 addToken("if", HiKeyword
);
1328 addToken("instanceof", HiKeyword
);
1329 addToken("in", HiSpecial
);
1330 addToken("let", HiKeywordHi
);
1331 addToken("new", HiSpecial
);
1332 addToken("prototype", HiSpecial
);
1333 addToken("return", HiKeyword
);
1334 addToken("switch", HiKeyword
);
1335 addToken("this", HiSpecial
);
1336 addToken("throw", HiKeyword
);
1337 addToken("try", HiKeyword
);
1338 addToken("typeof", HiKeyword
);
1339 addToken("var", HiKeywordHi
);
1340 addToken("while", HiKeyword
);
1341 addToken("with", HiKeywordHi
);
1343 addToken("Array", HiKeywordHi
);
1344 addToken("Boolean", HiKeywordHi
);
1345 addToken("Date", HiKeywordHi
);
1346 addToken("Function", HiKeywordHi
);
1347 addToken("Math", HiKeywordHi
);
1348 addToken("Number", HiKeywordHi
);
1349 addToken("String", HiKeywordHi
);
1350 addToken("Object", HiKeywordHi
);
1351 addToken("RegExp", HiKeywordHi
);
1353 // Most common functions
1354 addToken("escape", HiBuiltin
);
1355 addToken("eval", HiBuiltin
);
1356 addToken("indexOf", HiKeywordHi
);
1357 addToken("isNaN", HiBuiltin
);
1358 addToken("toString", HiBuiltin
);
1359 addToken("unescape", HiBuiltin
);
1360 addToken("valueOf", HiBuiltin
);
1363 addToken("false", HiBuiltin
);
1364 addToken("null", HiBuiltin
);
1365 addToken("true", HiBuiltin
);
1366 addToken("undefined", HiBuiltin
);
1369 addToken(".", HiPunct
);
1370 addToken("*", HiPunct
);
1371 addToken("+", HiPunct
);
1372 addToken("-", HiPunct
);
1373 addToken("/", HiPunct
);
1374 addToken("%", HiPunct
);
1375 addToken("=", HiPunct
);
1376 addToken("!", HiPunct
);
1377 addToken("&", HiPunct
);
1378 addToken("|", HiPunct
);
1379 addToken("^", HiPunct
);
1380 addToken("~", HiPunct
);
1381 addToken(">", HiPunct
);
1382 addToken("<", HiPunct
);
1384 addToken("{", HiPunct
);
1385 addToken("}", HiPunct
);
1386 addToken("(", HiPunct
);
1387 addToken(")", HiPunct
);
1388 addToken("[", HiPunct
);
1389 addToken("]", HiPunct
);
1390 addToken(",", HiPunct
);
1391 addToken("?", HiPunct
);
1392 addToken(":", HiPunct
);
1393 addToken(";", HiSemi
);
1398 // ////////////////////////////////////////////////////////////////////////// //
1399 public class EdHiTokensC
: EdHiTokens
{
1405 //Opt.NumAllowUnder|
1412 //Opt.DNestedComment|
1413 //Opt.ShellSingleComment|
1416 //Opt.SqlSingleComment|
1420 //Opt.CaseInsensitive|
1421 //Opt.SQStringNoEscape|
1422 //Opt.DQStringNoEscape|
1423 //Opt.CougarSingleComment|
1424 //Opt.CougarCharLiteral|
1425 //Opt.MaximumTokens|
1426 //Opt.PascalComments|
1431 addToken("break", HiKeyword
);
1432 addToken("case", HiKeyword
);
1433 addToken("const", HiKeyword
);
1434 addToken("continue", HiKeyword
);
1435 addToken("do", HiKeyword
);
1436 addToken("else", HiKeyword
);
1437 addToken("enum", HiKeyword
);
1438 addToken("extern", HiKeyword
);
1439 addToken("for", HiKeyword
);
1440 addToken("goto", HiKeyword
);
1441 addToken("if", HiKeyword
);
1442 addToken("return", HiKeyword
);
1443 //addToken("short", HiKeyword);
1444 addToken("sizeof", HiKeyword
);
1445 addToken("static", HiKeyword
);
1446 addToken("struct", HiKeyword
);
1447 addToken("switch", HiKeyword
);
1448 addToken("typedef", HiKeyword
);
1449 addToken("union", HiKeyword
);
1450 addToken("volatile", HiKeyword
);
1451 addToken("while", HiKeyword
);
1452 addToken("asm", HiKeyword
);
1453 addToken("inline", HiKeyword
);
1454 addToken("...", HiKeyword
);
1455 addToken("class", HiKeyword
);
1456 addToken("protected", HiKeyword
);
1457 addToken("private", HiKeyword
);
1458 addToken("public", HiKeyword
);
1459 addToken("default", HiKeyword
);
1460 addToken("using", HiKeyword
);
1461 addToken("try", HiKeyword
);
1462 addToken("catch", HiKeyword
);
1463 addToken("throw", HiKeyword
);
1464 addToken("virtual", HiKeyword
);
1465 addToken("override", HiKeyword
);
1467 addToken("true", HiKeyword
);
1468 addToken("false", HiKeyword
);
1470 addToken("register", HiInternal
);
1472 addToken("template", HiKeyword
);
1473 addToken("typename", HiKeyword
);
1474 addToken("const_cast", HiKeywordHi
);
1475 addToken("static_cast", HiKeywordHi
);
1476 addToken("static_assert", HiKeywordHi
);
1477 addToken("dynamic_cast", HiKeywordHi
);
1478 addToken("operator", HiKeywordHi
);
1480 addToken("explicit", HiSpecial
);
1481 addToken("mutable", HiSpecial
);
1483 addToken("!", HiPunct
);
1484 addToken("%", HiPunct
);
1485 addToken("&&", HiSpecial
);
1486 addToken("&", HiPunct
);
1487 addToken("(", HiPunct
);
1488 addToken(")", HiPunct
);
1489 addToken("*", HiPunct
);
1490 addToken("+", HiPunct
);
1491 addToken(",", HiPunct
);
1492 addToken("-", HiPunct
);
1493 addToken("/", HiPunct
);
1494 addToken(":", HiPunct
);
1495 addToken(";", HiSemi
);
1496 addToken("<", HiPunct
);
1497 addToken("=", HiPunct
);
1498 addToken(">", HiPunct
);
1499 addToken("?", HiPunct
);
1500 addToken("[", HiPunct
);
1501 addToken("]", HiPunct
);
1502 addToken("^", HiPunct
);
1503 addToken("{", HiPunct
);
1504 addToken("||", HiSpecial
);
1505 addToken("|", HiPunct
);
1506 addToken("}", HiPunct
);
1507 addToken("~", HiPunct
);
1508 addToken(".", HiPunct
);
1509 addToken("->", HiInternal
);
1511 addToken("nullptr", HiInternal
);
1512 addToken("new", HiInternal
);
1513 addToken("delete", HiInternal
);
1514 addToken("this", HiInternal
);
1516 addToken("void", HiType
);
1517 addToken("short", HiType
);
1518 addToken("int", HiType
);
1519 addToken("long", HiType
);
1520 addToken("float", HiType
);
1521 addToken("double", HiType
);
1522 addToken("char", HiType
);
1523 addToken("wchar_t", HiType
);
1524 addToken("size_t", HiType
);
1525 addToken("ptrdiff_t", HiType
);
1526 addToken("signed", HiType
);
1527 addToken("unsigned", HiType
);
1528 addToken("auto", HiType
);
1529 addToken("bool", HiType
);
1531 addToken("truth", HiType
);
1536 // ////////////////////////////////////////////////////////////////////////// //
1537 public class EdHiTokensZS
: EdHiTokens
{
1543 //Opt.NumAllowUnder|
1550 //Opt.DNestedComment|
1551 //Opt.ShellSingleComment|
1554 //Opt.SqlSingleComment|
1558 Opt
.CaseInsensitive|
1559 //Opt.SQStringNoEscape|
1560 //Opt.DQStringNoEscape|
1561 //Opt.CougarSingleComment|
1562 //Opt.CougarCharLiteral|
1563 //Opt.MaximumTokens|
1564 //Opt.PascalComments|
1569 addToken("break", HiKeyword
);
1570 addToken("case", HiKeyword
);
1571 addToken("const", HiKeyword
);
1572 addToken("continue", HiKeyword
);
1573 addToken("do", HiKeyword
);
1574 addToken("else", HiKeyword
);
1575 addToken("enum", HiKeyword
);
1576 addToken("extern", HiKeyword
);
1577 addToken("for", HiKeyword
);
1578 addToken("goto", HiKeyword
);
1579 addToken("if", HiKeyword
);
1580 addToken("return", HiKeyword
);
1581 //addToken("short", HiKeyword);
1582 addToken("sizeof", HiKeyword
);
1583 addToken("static", HiKeyword
);
1584 addToken("struct", HiKeyword
);
1585 addToken("switch", HiKeyword
);
1586 addToken("typedef", HiKeyword
);
1587 addToken("union", HiKeyword
);
1588 addToken("volatile", HiKeyword
);
1589 addToken("while", HiKeyword
);
1590 addToken("asm", HiKeyword
);
1591 addToken("inline", HiKeyword
);
1592 addToken("...", HiKeyword
);
1593 addToken("class", HiKeyword
);
1594 addToken("protected", HiKeyword
);
1595 addToken("private", HiKeyword
);
1596 addToken("public", HiKeyword
);
1597 addToken("default", HiKeyword
);
1598 addToken("using", HiKeyword
);
1599 addToken("try", HiKeyword
);
1600 addToken("catch", HiKeyword
);
1601 addToken("throw", HiKeyword
);
1602 addToken("virtual", HiKeyword
);
1603 addToken("override", HiKeyword
);
1605 addToken("true", HiKeyword
);
1606 addToken("false", HiKeyword
);
1608 addToken("!", HiPunct
);
1609 addToken("%", HiPunct
);
1610 addToken("&&", HiSpecial
);
1611 addToken("&", HiPunct
);
1612 addToken("(", HiPunct
);
1613 addToken(")", HiPunct
);
1614 addToken("*", HiPunct
);
1615 addToken("+", HiPunct
);
1616 addToken(",", HiPunct
);
1617 addToken("-", HiPunct
);
1618 addToken("/", HiPunct
);
1619 addToken(":", HiPunct
);
1620 addToken(";", HiSemi
);
1621 addToken("<", HiPunct
);
1622 addToken("=", HiPunct
);
1623 addToken(">", HiPunct
);
1624 addToken("?", HiPunct
);
1625 addToken("[", HiPunct
);
1626 addToken("]", HiPunct
);
1627 addToken("^", HiPunct
);
1628 addToken("{", HiPunct
);
1629 addToken("||", HiSpecial
);
1630 addToken("|", HiPunct
);
1631 addToken("}", HiPunct
);
1632 addToken("~", HiPunct
);
1633 addToken(".", HiPunct
);
1634 addToken("->", HiInternal
);
1636 addToken("null", HiInternal
);
1637 addToken("new", HiInternal
);
1638 addToken("self", HiInternal
);
1639 addToken("super", HiInternal
);
1641 addToken("void", HiType
);
1642 addToken("short", HiType
);
1643 addToken("int", HiType
);
1644 addToken("long", HiType
);
1645 addToken("float", HiType
);
1646 addToken("double", HiType
);
1647 addToken("char", HiType
);
1648 addToken("let", HiType
);
1649 addToken("bool", HiType
);
1650 addToken("string", HiType
);
1651 addToken("name", HiType
);
1656 // ////////////////////////////////////////////////////////////////////////// //
1657 public class EdHiTokensVC
: EdHiTokens
{
1671 //Opt.ShellSingleComment|
1674 //Opt.SqlSingleComment|
1678 //Opt.CaseInsensitive|
1679 //Opt.SQStringNoEscape|
1680 //Opt.DQStringNoEscape|
1681 //Opt.CougarSingleComment|
1682 //Opt.CougarCharLiteral|
1683 //Opt.MaximumTokens|
1684 //Opt.PascalComments|
1689 addToken("assert", HiKeywordHi
);
1691 addToken("alias", HiKeyword
);
1692 addToken("auto", HiKeyword
);
1693 addToken("bitenum", HiKeyword
);
1694 addToken("break", HiKeyword
);
1695 addToken("case", HiKeyword
);
1696 addToken("cast", HiKeywordHi
);
1697 addToken("class", HiKeywordHi
);
1698 addToken("const", HiKeywordHi
);
1699 addToken("continue", HiKeyword
);
1700 addToken("default", HiKeyword
);
1701 addToken("delegate", HiKeyword
);
1702 addToken("do", HiKeyword
);
1703 addToken("else", HiKeyword
);
1704 addToken("enum", HiKeyword
);
1705 addToken("for", HiKeyword
);
1706 addToken("foreach", HiKeyword
);
1707 addToken("get", HiKeywordHi
);
1708 addToken("goto", HiKeyword
);
1709 addToken("if", HiKeyword
);
1710 addToken("import", HiInternal
);
1711 addToken("inline", HiInternal
); // not yet, so internal
1712 addToken("isa", HiSpecial
);
1713 addToken("return", HiKeyword
);
1714 addToken("scope", HiInternal
); // not yet, so internal
1715 addToken("set", HiKeywordHi
);
1716 addToken("sizeof", HiInternal
); // not yet, so internal
1717 addToken("struct", HiKeyword
);
1718 addToken("switch", HiKeyword
);
1719 addToken("while", HiKeyword
);
1721 addToken("abstract", HiInternal
);
1722 addToken("final", HiInternal
);
1723 addToken("iterator", HiInternal
);
1724 addToken("native", HiInternal
);
1725 addToken("override", HiKeyword
);
1726 addToken("private", HiKeyword
);
1727 addToken("protected", HiKeyword
);
1728 addToken("public", HiKeyword
);
1729 addToken("readonly", HiKeyword
);
1730 addToken("spawner", HiKeywordHi
);
1731 addToken("static", HiKeyword
);
1733 addToken("reliable", HiKeywordHi
);
1734 addToken("replication", HiKeywordHi
);
1735 addToken("states", HiKeywordHi
);
1736 addToken("transient", HiKeywordHi
);
1737 addToken("unreliable", HiKeywordHi
);
1738 addToken("defaultproperties", HiKeywordHi
);
1741 addToken("true", HiKeyword
);
1742 addToken("false", HiKeyword
);
1744 //addToken("none", HiUDA);
1746 addToken("ref", HiSpecial
);
1747 addToken("out", HiSpecial
);
1748 addToken("optional", HiSpecial
);
1750 addToken("...", HiKeywordHi
);
1751 addToken("->", HiInternal
);
1752 addToken("&&", HiSpecial
);
1753 addToken("||", HiSpecial
);
1754 addToken("..", HiPunct
);
1755 addToken("!", HiPunct
);
1756 addToken("%", HiPunct
);
1757 addToken("&", HiPunct
);
1758 addToken("$", HiSpecial
);
1759 addToken("(", HiPunct
);
1760 addToken(")", HiPunct
);
1761 addToken("*", HiPunct
);
1762 addToken("+", HiPunct
);
1763 addToken(",", HiPunct
);
1764 addToken("-", HiPunct
);
1765 addToken("/", HiPunct
);
1766 addToken(":", HiPunct
);
1767 addToken(";", HiSemi
);
1768 addToken("<", HiPunct
);
1769 addToken("=", HiPunct
);
1770 addToken(">", HiPunct
);
1771 addToken("?", HiPunct
);
1772 addToken("[", HiPunct
);
1773 addToken("]", HiPunct
);
1774 addToken("^", HiPunct
);
1775 addToken("{", HiPunct
);
1776 addToken("|", HiPunct
);
1777 addToken("}", HiPunct
);
1778 addToken("~", HiPunct
);
1779 addToken(".", HiPunct
);
1781 addToken("NULL", HiInternal
);
1782 addToken("null", HiInternal
);
1783 addToken("nullptr", HiInternal
);
1784 addToken("none", HiInternal
);
1785 addToken("self", HiInternal
);
1786 addToken("delete", HiInternal
);
1789 addToken("void", HiType
);
1790 addToken("int", HiType
);
1791 addToken("float", HiType
);
1792 addToken("bool", HiType
);
1793 addToken("string", HiType
);
1794 addToken("name", HiType
);
1795 addToken("vector", HiType
);
1796 addToken("ubyte", HiType
);
1797 addToken("array", HiType
);
1798 addToken("state", HiType
);
1799 addToken("dictionary", HiType
);
1802 addToken("byte", HiInternal
);
1803 addToken("uint", HiInternal
);
1808 // ////////////////////////////////////////////////////////////////////////// //
1809 public class EdHiTokensShell
: EdHiTokens
{
1815 //Opt.NumAllowUnder|
1822 //Opt.DNestedComment|
1823 Opt
.ShellSingleComment|
1824 //Opt.CSingleComment|
1825 //Opt.CMultiComment|
1826 //Opt.SqlSingleComment|
1827 //Opt.CPreprocessor|
1830 //Opt.CaseInsensitive|
1831 Opt
.SQStringNoEscape|
1832 //Opt.DQStringNoEscape|
1833 //Opt.CougarSingleComment|
1834 //Opt.CougarCharLiteral|
1835 //Opt.MaximumTokens|
1836 //Opt.PascalComments|
1841 addToken("{", HiPunct
);
1842 addToken("}", HiPunct
);
1844 addToken("$*", HiInternal
);
1845 addToken("$@", HiInternal
);
1846 addToken("$#", HiInternal
);
1847 addToken("$?", HiInternal
);
1848 addToken("$-", HiInternal
);
1849 addToken("$$", HiInternal
);
1850 addToken("$!", HiInternal
);
1851 addToken("$_", HiInternal
);
1853 addToken("2>&1", HiInternal
);
1854 addToken("2>&2", HiInternal
);
1855 addToken("2>", HiInternal
);
1856 addToken("1>", HiInternal
);
1858 addToken(";", HiSemi
);
1860 addToken("break", HiKeyword
);
1861 addToken("case", HiKeyword
);
1862 addToken("clear", HiKeyword
);
1863 addToken("continue", HiKeyword
);
1864 addToken("declare", HiKeyword
);
1865 addToken("done", HiKeyword
);
1866 addToken("do", HiKeyword
);
1867 addToken("elif", HiKeyword
);
1868 addToken("else", HiKeyword
);
1869 addToken("esac", HiKeyword
);
1870 addToken("exit", HiKeyword
);
1871 addToken("export", HiKeyword
);
1872 addToken("fi", HiKeyword
);
1873 addToken("for", HiKeyword
);
1874 addToken("getopts", HiKeyword
);
1875 addToken("if", HiKeyword
);
1876 addToken("in", HiKeyword
);
1877 addToken("read", HiKeyword
);
1878 addToken("return", HiKeyword
);
1879 addToken("select", HiKeyword
);
1880 addToken("shift", HiKeyword
);
1881 addToken("source", HiKeyword
);
1882 addToken("then", HiKeyword
);
1883 addToken("trap", HiKeyword
);
1884 addToken("until", HiKeyword
);
1885 addToken("unset", HiKeyword
);
1886 addToken("wait", HiKeyword
);
1887 addToken("while", HiKeyword
);
1892 // ////////////////////////////////////////////////////////////////////////// //
1893 public class EdHiTokensFrag
: EdHiTokens
{
1899 //Opt.NumAllowUnder|
1906 //Opt.DNestedComment|
1907 //Opt.ShellSingleComment|
1910 //Opt.SqlSingleComment|
1914 //Opt.CaseInsensitive|
1915 //Opt.SQStringNoEscape|
1916 //Opt.DQStringNoEscape|
1917 //Opt.CougarSingleComment|
1918 //Opt.CougarCharLiteral|
1919 //Opt.MaximumTokens|
1920 //Opt.PascalComments|
1925 addToken("break", HiKeyword
);
1926 addToken("case", HiKeyword
);
1927 addToken("const", HiKeyword
);
1928 addToken("continue", HiKeyword
);
1929 addToken("do", HiKeyword
);
1930 addToken("else", HiKeyword
);
1931 addToken("enum", HiKeyword
);
1932 addToken("for", HiKeyword
);
1933 addToken("goto", HiKeyword
);
1934 addToken("if", HiKeyword
);
1935 addToken("return", HiKeyword
);
1936 addToken("sizeof", HiKeyword
);
1937 addToken("struct", HiKeyword
);
1938 addToken("switch", HiKeyword
);
1939 addToken("union", HiKeyword
);
1940 addToken("while", HiKeyword
);
1942 addToken("!", HiPunct
);
1943 addToken("%", HiPunct
);
1944 addToken("&&", HiSpecial
);
1945 addToken("&", HiPunct
);
1946 addToken("(", HiPunct
);
1947 addToken(")", HiPunct
);
1948 addToken("*", HiPunct
);
1949 addToken("+", HiPunct
);
1950 addToken(",", HiPunct
);
1951 addToken("-", HiPunct
);
1952 addToken("/", HiPunct
);
1953 addToken(":", HiPunct
);
1954 addToken(";", HiSemi
);
1955 addToken("<", HiPunct
);
1956 addToken("=", HiPunct
);
1957 addToken(">", HiPunct
);
1958 addToken("?", HiPunct
);
1959 addToken("[", HiPunct
);
1960 addToken("]", HiPunct
);
1961 addToken("^", HiPunct
);
1962 addToken("{", HiPunct
);
1963 addToken("||", HiSpecial
);
1964 addToken("|", HiPunct
);
1965 addToken("}", HiPunct
);
1966 addToken("~", HiPunct
);
1967 addToken(".", HiPunct
);
1968 addToken("->", HiInternal
);
1970 addToken("uniform", HiInternal
);
1971 addToken("varying", HiInternal
);
1972 addToken("attribute", HiInternal
);
1974 addToken("precision", HiInternal
);
1976 addToken("gl_FragColor", HiInternal
);
1977 addToken("gl_FragData", HiInternal
);
1978 addToken("gl_FrontFacing", HiInternal
);
1979 addToken("gl_PointCoord", HiInternal
);
1980 addToken("gl_PointSize", HiInternal
);
1981 addToken("gl_Position", HiInternal
);
1982 addToken("gl_MaxVertexAttribs", HiInternal
);
1983 addToken("gl_MaxVertexUniformVectors", HiInternal
);
1984 addToken("gl_MaxVaryingVectors", HiInternal
);
1985 addToken("gl_MaxVertexTextureImageUnits", HiInternal
);
1986 addToken("gl_MaxCombinedTextureImageUnits", HiInternal
);
1987 addToken("gl_MaxFragmentUniformVectors", HiInternal
);
1988 addToken("gl_MaxDrawBuffers", HiInternal
);
1989 addToken("gl_Vertex", HiInternal
);
1990 addToken("gl_Normal", HiInternal
);
1991 addToken("gl_Color", HiInternal
);
1992 addToken("gl_FogCoodr", HiInternal
);
1993 addToken("gl_MultiTexCoord0", HiInternal
);
1994 addToken("gl_MultiTexCoord1", HiInternal
);
1995 addToken("gl_MultiTexCoord2", HiInternal
);
1996 addToken("gl_MultiTexCoord3", HiInternal
);
1997 addToken("gl_MultiTexCoord4", HiInternal
);
1998 addToken("gl_MultiTexCoord5", HiInternal
);
1999 addToken("gl_MultiTexCoord6", HiInternal
);
2000 addToken("gl_MultiTexCoord7", HiInternal
);
2002 addToken("layout", HiInternal
);
2003 addToken("location", HiInternal
);
2005 addToken("void", HiType
);
2006 addToken("int", HiType
);
2007 addToken("bool", HiType
);
2008 addToken("unsigneg", HiType
);
2009 addToken("float", HiType
);
2010 addToken("double", HiType
);
2011 addToken("vec1", HiType
);
2012 addToken("vec2", HiType
);
2013 addToken("vec3", HiType
);
2014 addToken("vec4", HiType
);
2015 addToken("bvec1", HiType
);
2016 addToken("bvec2", HiType
);
2017 addToken("bvec3", HiType
);
2018 addToken("bvec4", HiType
);
2019 addToken("ivec1", HiType
);
2020 addToken("ivec2", HiType
);
2021 addToken("ivec3", HiType
);
2022 addToken("ivec4", HiType
);
2023 addToken("uvec1", HiType
);
2024 addToken("uvec2", HiType
);
2025 addToken("uvec3", HiType
);
2026 addToken("uvec4", HiType
);
2027 addToken("dvec1", HiType
);
2028 addToken("dvec2", HiType
);
2029 addToken("dvec3", HiType
);
2030 addToken("dvec4", HiType
);
2032 addToken("in", HiSpecial
);
2033 addToken("out", HiSpecial
);
2034 addToken("inout", HiSpecial
);
2039 // ////////////////////////////////////////////////////////////////////////// //
2040 public class EdHiTokensSQL
: EdHiTokens
{
2046 //Opt.NumAllowUnder|
2053 //Opt.DNestedComment|
2054 //Opt.ShellSingleComment|
2055 //Opt.CSingleComment|
2056 Opt
.SqlSingleComment|
2058 //Opt.CPreprocessor|
2061 Opt
.CaseInsensitive|
2062 Opt
.SQStringNoEscape|
2063 Opt
.DQStringNoEscape|
2064 //Opt.CougarSingleComment|
2065 //Opt.CougarCharLiteral|
2066 //Opt.MaximumTokens|
2067 //Opt.PascalComments|
2072 addToken("abort", HiKeyword
);
2073 addToken("absolute", HiKeyword
);
2074 addToken("action", HiKeyword
);
2075 addToken("ada", HiKeyword
);
2076 addToken("add", HiKeyword
);
2077 addToken("all", HiKeyword
);
2078 addToken("allocate", HiKeyword
);
2079 addToken("alter", HiKeyword
);
2080 addToken("and", HiKeyword
);
2081 addToken("any", HiKeyword
);
2082 addToken("are", HiKeyword
);
2083 addToken("as", HiKeyword
);
2084 addToken("asc", HiKeyword
);
2085 addToken("assertion", HiKeyword
);
2086 addToken("at", HiKeyword
);
2087 addToken("authorization", HiKeyword
);
2088 addToken("auto_increment", HiKeyword
);
2089 addToken("begin", HiKeyword
);
2090 addToken("between", HiKeyword
);
2091 addToken("bigint", HiKeyword
);
2092 addToken("bit", HiKeyword
);
2093 addToken("bit_length", HiKeyword
);
2094 addToken("blob", HiKeyword
);
2095 addToken("both", HiKeyword
);
2096 addToken("by", HiKeyword
);
2097 addToken("cascade", HiKeyword
);
2098 addToken("cascaded", HiKeyword
);
2099 addToken("case", HiKeyword
);
2100 addToken("cast", HiKeyword
);
2101 addToken("catalog", HiKeyword
);
2102 addToken("char", HiKeyword
);
2103 addToken("char_length", HiKeyword
);
2104 addToken("character", HiKeyword
);
2105 addToken("character_length", HiKeyword
);
2106 addToken("check", HiKeyword
);
2107 addToken("close", HiKeyword
);
2108 addToken("coalesce", HiKeyword
);
2109 addToken("collate", HiKeyword
);
2110 addToken("collation", HiKeyword
);
2111 addToken("column", HiKeyword
);
2112 addToken("commit", HiKeyword
);
2113 addToken("compile", HiKeyword
);
2114 addToken("connect", HiKeyword
);
2115 addToken("connection", HiKeyword
);
2116 addToken("constraint", HiKeyword
);
2117 addToken("constraint", HiKeyword
);
2118 addToken("constraints", HiKeyword
);
2119 addToken("continue", HiKeyword
);
2120 addToken("copy", HiKeyword
);
2121 addToken("corresponding", HiKeyword
);
2122 addToken("create", HiKeyword
);
2123 addToken("cross", HiKeyword
);
2124 addToken("current", HiKeyword
);
2125 addToken("current_date", HiKeyword
);
2126 addToken("current_time", HiKeyword
);
2127 addToken("current_timestamp", HiKeyword
);
2128 addToken("current_user", HiKeyword
);
2129 addToken("cursor", HiKeyword
);
2130 addToken("database", HiKeyword
);
2131 addToken("date", HiKeyword
);
2132 addToken("datetime", HiKeyword
);
2133 addToken("day", HiKeyword
);
2134 addToken("deallocate", HiKeyword
);
2135 addToken("dec", HiKeyword
);
2136 addToken("decimal", HiKeyword
);
2137 addToken("declare", HiKeyword
);
2138 addToken("default", HiKeyword
);
2139 addToken("deferrable", HiKeyword
);
2140 addToken("deferred", HiKeyword
);
2141 addToken("delete", HiKeyword
);
2142 addToken("desc", HiKeyword
);
2143 addToken("describe", HiKeyword
);
2144 addToken("descriptor", HiKeyword
);
2145 addToken("diagnostics", HiKeyword
);
2146 addToken("disconnect", HiKeyword
);
2147 addToken("distinct", HiKeyword
);
2148 addToken("domain", HiKeyword
);
2149 addToken("double", HiKeyword
);
2150 addToken("drop", HiKeyword
);
2151 addToken("else", HiKeyword
);
2152 addToken("encoding", HiKeyword
);
2153 addToken("end", HiKeyword
);
2154 addToken("end-exec", HiKeyword
);
2155 addToken("enum", HiKeyword
);
2156 addToken("escape", HiKeyword
);
2157 addToken("except", HiKeyword
);
2158 addToken("exception", HiKeyword
);
2159 addToken("exec", HiKeyword
);
2160 addToken("execute", HiKeyword
);
2161 addToken("exists", HiKeyword
);
2162 addToken("external", HiKeyword
);
2163 addToken("extract", HiKeyword
);
2164 addToken("false", HiKeyword
);
2165 addToken("fetch", HiKeyword
);
2166 addToken("first", HiKeyword
);
2167 addToken("float", HiKeyword
);
2168 addToken("for", HiKeyword
);
2169 addToken("foreign", HiKeyword
);
2170 addToken("fortran", HiKeyword
);
2171 addToken("found", HiKeyword
);
2172 addToken("from", HiKeyword
);
2173 addToken("full", HiKeyword
);
2174 addToken("get", HiKeyword
);
2175 addToken("global", HiKeyword
);
2176 addToken("go", HiKeyword
);
2177 addToken("goto", HiKeyword
);
2178 addToken("grant", HiKeyword
);
2179 addToken("group", HiKeyword
);
2180 addToken("having", HiKeyword
);
2181 addToken("hour", HiKeyword
);
2182 addToken("identity", HiKeyword
);
2183 addToken("if", HiKeyword
);
2184 addToken("immediate", HiKeyword
);
2185 addToken("in", HiKeyword
);
2186 addToken("include", HiKeyword
);
2187 addToken("index", HiKeyword
);
2188 addToken("indicator", HiKeyword
);
2189 addToken("initially", HiKeyword
);
2190 addToken("inner", HiKeyword
);
2191 addToken("input", HiKeyword
);
2192 addToken("insensitive", HiKeyword
);
2193 addToken("insert", HiKeyword
);
2194 addToken("int", HiKeyword
);
2195 addToken("integer", HiKeyword
);
2196 addToken("intersect", HiKeyword
);
2197 addToken("interval", HiKeyword
);
2198 addToken("into", HiKeyword
);
2199 addToken("is", HiKeyword
);
2200 addToken("isolation", HiKeyword
);
2201 addToken("join", HiKeyword
);
2202 addToken("key", HiKeyword
);
2203 addToken("key", HiKeyword
);
2204 addToken("language", HiKeyword
);
2205 addToken("last", HiKeyword
);
2206 addToken("leading", HiKeyword
);
2207 addToken("left", HiKeyword
);
2208 addToken("level", HiKeyword
);
2209 addToken("like", HiKeyword
);
2210 addToken("local", HiKeyword
);
2211 addToken("lock", HiKeyword
);
2212 addToken("longblob", HiKeyword
);
2213 addToken("longtext", HiKeyword
);
2214 addToken("loop", HiKeyword
);
2215 addToken("match", HiKeyword
);
2216 addToken("mediumblob", HiKeyword
);
2217 addToken("mediumint", HiKeyword
);
2218 addToken("mediumtext", HiKeyword
);
2219 addToken("merge", HiKeyword
);
2220 addToken("minute", HiKeyword
);
2221 addToken("minus", HiKeyword
);
2222 addToken("module", HiKeyword
);
2223 addToken("month", HiKeyword
);
2224 addToken("names", HiKeyword
);
2225 addToken("national", HiKeyword
);
2226 addToken("natural", HiKeyword
);
2227 addToken("nchar", HiKeyword
);
2228 addToken("next", HiKeyword
);
2229 addToken("no", HiKeyword
);
2230 addToken("none", HiKeyword
);
2231 addToken("not", HiKeyword
);
2232 addToken("null", HiKeyword
);
2233 addToken("nullif", HiKeyword
);
2234 addToken("numeric", HiKeyword
);
2235 addToken("octet_length", HiKeyword
);
2236 addToken("of", HiKeyword
);
2237 addToken("offline", HiKeyword
);
2238 addToken("on", HiKeyword
);
2239 addToken("online", HiKeyword
);
2240 addToken("only", HiKeyword
);
2241 addToken("open", HiKeyword
);
2242 addToken("option", HiKeyword
);
2243 addToken("or", HiKeyword
);
2244 addToken("order", HiKeyword
);
2245 addToken("outer", HiKeyword
);
2246 addToken("output", HiKeyword
);
2247 addToken("overlaps", HiKeyword
);
2248 addToken("pad", HiKeyword
);
2249 addToken("partial", HiKeyword
);
2250 addToken("pascal", HiKeyword
);
2251 addToken("position", HiKeyword
);
2252 addToken("precision", HiKeyword
);
2253 addToken("prepare", HiKeyword
);
2254 addToken("preserve", HiKeyword
);
2255 addToken("primary", HiKeyword
);
2256 addToken("primary", HiKeyword
);
2257 addToken("prior", HiKeyword
);
2258 addToken("privileges", HiKeyword
);
2259 addToken("procedure", HiKeyword
);
2260 addToken("public", HiKeyword
);
2261 addToken("read", HiKeyword
);
2262 addToken("real", HiKeyword
);
2263 addToken("rebuild", HiKeyword
);
2264 addToken("references", HiKeyword
);
2265 addToken("relative", HiKeyword
);
2266 addToken("replace", HiKeyword
);
2267 addToken("restrict", HiKeyword
);
2268 addToken("revoke", HiKeyword
);
2269 addToken("right", HiKeyword
);
2270 addToken("rollback", HiKeyword
);
2271 addToken("rows", HiKeyword
);
2272 addToken("schema", HiKeyword
);
2273 addToken("scroll", HiKeyword
);
2274 addToken("second", HiKeyword
);
2275 addToken("section", HiKeyword
);
2276 addToken("select", HiKeyword
);
2277 addToken("sequence", HiKeyword
);
2278 addToken("session", HiKeyword
);
2279 addToken("session_user", HiKeyword
);
2280 addToken("set", HiKeyword
);
2281 addToken("size", HiKeyword
);
2282 addToken("smallint", HiKeyword
);
2283 addToken("some", HiKeyword
);
2284 addToken("space", HiKeyword
);
2285 addToken("sql", HiKeyword
);
2286 addToken("sqlca", HiKeyword
);
2287 addToken("sqlstate", HiKeyword
);
2288 addToken("sqlwarning", HiKeyword
);
2289 addToken("substring", HiKeyword
);
2290 addToken("system_user", HiKeyword
);
2291 addToken("table", HiKeyword
);
2292 addToken("tablespace", HiKeyword
);
2293 addToken("template", HiKeyword
);
2294 addToken("temporary", HiKeyword
);
2295 addToken("text", HiKeyword
);
2296 addToken("then", HiKeyword
);
2297 addToken("time", HiKeyword
);
2298 addToken("truncate", HiKeyword
);
2299 addToken("timestamp", HiKeyword
);
2300 addToken("timezone_hour", HiKeyword
);
2301 addToken("timezone_minute", HiKeyword
);
2302 addToken("tinyblob", HiKeyword
);
2303 addToken("tinyint", HiKeyword
);
2304 addToken("tinytext", HiKeyword
);
2305 addToken("to", HiKeyword
);
2306 addToken("trailing", HiKeyword
);
2307 addToken("transaction", HiKeyword
);
2308 addToken("translation", HiKeyword
);
2309 addToken("trigger", HiKeyword
);
2310 addToken("trim", HiKeyword
);
2311 addToken("true", HiKeyword
);
2312 addToken("type", HiKeyword
);
2313 addToken("union", HiKeyword
);
2314 addToken("unique", HiKeyword
);
2315 addToken("unknown", HiKeyword
);
2316 addToken("unsigned", HiKeyword
);
2317 addToken("update", HiKeyword
);
2318 addToken("usage", HiKeyword
);
2319 addToken("use", HiKeyword
);
2320 addToken("user", HiKeyword
);
2321 addToken("using", HiKeyword
);
2322 addToken("value", HiKeyword
);
2323 addToken("values", HiKeyword
);
2324 addToken("varchar", HiKeyword
);
2325 addToken("varying", HiKeyword
);
2326 addToken("view", HiKeyword
);
2327 addToken("when", HiKeyword
);
2328 addToken("whenever", HiKeyword
);
2329 addToken("where", HiKeyword
);
2330 addToken("while", HiKeyword
);
2331 addToken("with", HiKeyword
);
2332 addToken("work", HiKeyword
);
2333 addToken("write", HiKeyword
);
2334 addToken("year", HiKeyword
);
2335 addToken("zone", HiKeyword
);
2338 addToken("cache", HiKeywordHi
);
2339 addToken("increment", HiKeywordHi
);
2340 addToken("maxvalue", HiKeywordHi
);
2341 addToken("minvalue", HiKeywordHi
);
2342 addToken("start", HiKeywordHi
);
2344 addToken(">", HiPunct
);
2345 addToken("<", HiPunct
);
2346 addToken("+", HiPunct
);
2347 addToken("-", HiPunct
);
2348 addToken("*", HiPunct
);
2349 addToken("/", HiPunct
);
2350 addToken("%", HiPunct
);
2351 addToken("=", HiPunct
);
2352 addToken("(", HiPunct
);
2353 addToken(")", HiPunct
);
2354 addToken(",", HiPunct
);
2355 addToken(";", HiPunct
);
2356 addToken(".", HiPunct
); // was white
2361 // ////////////////////////////////////////////////////////////////////////// //
2362 public class EdHiTokensHtml
: EdHiTokens
{
2368 //Opt.NumAllowUnder|
2375 //Opt.DNestedComment|
2376 //Opt.ShellSingleComment|
2377 //Opt.CSingleComment|
2378 //Opt.CMultiComment|
2379 //Opt.SqlSingleComment|
2380 //Opt.CPreprocessor|
2383 Opt
.CaseInsensitive|
2384 Opt
.SQStringNoEscape|
2385 Opt
.DQStringNoEscape|
2386 //Opt.CougarSingleComment|
2387 //Opt.CougarCharLiteral|
2388 //Opt.MaximumTokens|
2389 //Opt.PascalComments|
2394 addToken("a", HiSpecial
);
2395 addToken("abbr", HiSpecial
);
2396 addToken("address", HiSpecial
);
2397 addToken("applet", HiSpecial
);
2398 addToken("area", HiSpecial
);
2399 addToken("article", HiSpecial
);
2400 addToken("aside", HiSpecial
);
2401 addToken("audio", HiSpecial
);
2402 addToken("b", HiSpecial
);
2403 addToken("base", HiSpecial
);
2404 addToken("basefont", HiSpecial
);
2405 addToken("bdi", HiSpecial
);
2406 addToken("bdo", HiSpecial
);
2407 addToken("bgsound", HiSpecial
);
2408 addToken("big", HiSpecial
);
2409 addToken("blockquote", HiSpecial
);
2410 addToken("body", HiSpecial
);
2411 addToken("br", HiSpecial
);
2412 addToken("button", HiSpecial
);
2413 addToken("canvas", HiSpecial
);
2414 addToken("caption", HiSpecial
);
2415 addToken("center", HiSpecial
);
2416 addToken("cite", HiSpecial
);
2417 addToken("code", HiSpecial
);
2418 addToken("col", HiSpecial
);
2419 addToken("colgroup", HiSpecial
);
2420 addToken("command", HiSpecial
);
2421 addToken("data", HiSpecial
);
2422 addToken("datalist", HiSpecial
);
2423 addToken("dd", HiSpecial
);
2424 addToken("del", HiSpecial
);
2425 addToken("details", HiSpecial
);
2426 addToken("dfn", HiSpecial
);
2427 addToken("dialog", HiSpecial
);
2428 addToken("dir", HiSpecial
);
2429 addToken("div", HiSpecial
);
2430 addToken("dl", HiSpecial
);
2431 addToken("dt", HiSpecial
);
2432 addToken("em", HiSpecial
);
2433 addToken("embed", HiSpecial
);
2434 addToken("fieldset", HiSpecial
);
2435 addToken("figcaption", HiSpecial
);
2436 addToken("figure", HiSpecial
);
2437 addToken("font", HiSpecial
);
2438 addToken("footer", HiSpecial
);
2439 addToken("form", HiSpecial
);
2440 addToken("frame", HiSpecial
);
2441 addToken("frameset", HiSpecial
);
2442 addToken("h1", HiSpecial
);
2443 addToken("h2", HiSpecial
);
2444 addToken("h3", HiSpecial
);
2445 addToken("h4", HiSpecial
);
2446 addToken("h5", HiSpecial
);
2447 addToken("h6", HiSpecial
);
2448 addToken("head", HiSpecial
);
2449 addToken("header", HiSpecial
);
2450 addToken("hgroup", HiSpecial
);
2451 addToken("hr", HiSpecial
);
2452 addToken("html", HiSpecial
);
2453 addToken("i", HiSpecial
);
2454 addToken("iframe", HiSpecial
);
2455 addToken("image", HiSpecial
);
2456 addToken("img", HiSpecial
);
2457 addToken("input", HiSpecial
);
2458 addToken("ins", HiSpecial
);
2459 addToken("kbd", HiSpecial
);
2460 addToken("keygen", HiSpecial
);
2461 addToken("label", HiSpecial
);
2462 addToken("legend", HiSpecial
);
2463 addToken("li", HiSpecial
);
2464 addToken("link", HiSpecial
);
2465 addToken("listing", HiSpecial
);
2466 addToken("main", HiSpecial
);
2467 addToken("map", HiSpecial
);
2468 addToken("mark", HiSpecial
);
2469 addToken("marquee", HiSpecial
);
2470 addToken("math", HiSpecial
);
2471 addToken("mathml", HiSpecial
);
2472 addToken("menu", HiSpecial
);
2473 addToken("menuitem", HiSpecial
);
2474 addToken("meta", HiSpecial
);
2475 addToken("meter", HiSpecial
);
2476 addToken("nav", HiSpecial
);
2477 addToken("nobr", HiSpecial
);
2478 addToken("noembed", HiSpecial
);
2479 addToken("noframes", HiSpecial
);
2480 addToken("noscript", HiSpecial
);
2481 addToken("object", HiSpecial
);
2482 addToken("ol", HiSpecial
);
2483 addToken("optgroup", HiSpecial
);
2484 addToken("option", HiSpecial
);
2485 addToken("output", HiSpecial
);
2486 addToken("p", HiSpecial
);
2487 addToken("param", HiSpecial
);
2488 addToken("picture", HiSpecial
);
2489 addToken("plaintext", HiSpecial
);
2490 addToken("pre", HiSpecial
);
2491 addToken("progress", HiSpecial
);
2492 addToken("q", HiSpecial
);
2493 addToken("rb", HiSpecial
);
2494 addToken("rp", HiSpecial
);
2495 addToken("rt", HiSpecial
);
2496 addToken("rtc", HiSpecial
);
2497 addToken("ruby", HiSpecial
);
2498 addToken("s", HiSpecial
);
2499 addToken("samp", HiSpecial
);
2500 addToken("script", HiSpecial
);
2501 addToken("section", HiSpecial
);
2502 addToken("select", HiSpecial
);
2503 addToken("slot", HiSpecial
);
2504 addToken("small", HiSpecial
);
2505 addToken("source", HiSpecial
);
2506 addToken("span", HiSpecial
);
2507 addToken("strike", HiSpecial
);
2508 addToken("strong", HiSpecial
);
2509 addToken("style", HiSpecial
);
2510 addToken("sub", HiSpecial
);
2511 addToken("summary", HiSpecial
);
2512 addToken("sup", HiSpecial
);
2513 addToken("svg", HiSpecial
);
2514 addToken("table", HiSpecial
);
2515 addToken("tbody", HiSpecial
);
2516 addToken("td", HiSpecial
);
2517 addToken("template", HiSpecial
);
2518 addToken("textarea", HiSpecial
);
2519 addToken("tfoot", HiSpecial
);
2520 addToken("th", HiSpecial
);
2521 addToken("thead", HiSpecial
);
2522 addToken("time", HiSpecial
);
2523 addToken("title", HiSpecial
);
2524 addToken("tr", HiSpecial
);
2525 addToken("track", HiSpecial
);
2526 addToken("tt", HiSpecial
);
2527 addToken("u", HiSpecial
);
2528 addToken("ul", HiSpecial
);
2529 addToken("var", HiSpecial
);
2530 addToken("video", HiSpecial
);
2531 addToken("wbr", HiSpecial
);
2532 addToken("xmp", HiSpecial
);
2537 // ////////////////////////////////////////////////////////////////////////// //
2538 public class EdHiTokensCougar
: EdHiTokens
{
2544 //Opt.NumAllowUnder|
2552 //Opt.ShellSingleComment|
2555 //Opt.SqlSingleComment|
2556 //Opt.CPreprocessor|
2559 //Opt.CaseInsensitive|
2560 //Opt.SQStringNoEscape|
2561 //Opt.DQStringNoEscape|
2562 Opt
.CougarSingleComment|
2563 Opt
.CougarCharLiteral|
2565 //Opt.PascalComments|
2570 addToken("nil", HiType
);
2571 addToken("true", HiType
);
2572 addToken("PI", HiType
);
2574 addToken("quote", HiKeyword
);
2575 addToken("lambda", HiBuiltin
);
2576 addToken("defun", HiKeyword
);
2577 addToken("define", HiKeyword
);
2578 addToken("car", HiKeyword
);
2579 addToken("cdr", HiKeyword
);
2580 addToken("mk-list", HiKeyword
);
2581 addToken("set-car!", HiInternal
);
2582 addToken("set-cdr!", HiInternal
);
2583 addToken("cons", HiKeyword
);
2584 addToken("while", HiKeyword
);
2585 addToken("break", HiKeywordHi
);
2586 addToken("continue", HiKeywordHi
);
2587 addToken("set!", HiInternal
);
2588 addToken("gset!", HiInternal
);
2589 addToken("begin", HiKeyword
);
2590 addToken("return", HiKeywordHi
);
2591 addToken("if", HiKeyword
);
2592 addToken("cond", HiKeyword
);
2593 addToken("and", HiKeyword
);
2594 addToken("or", HiKeyword
);
2595 addToken("not", HiKeyword
);
2596 addToken("let", HiKeywordHi
);
2597 addToken("let*", HiKeywordHi
);
2598 addToken("else", HiSpecial
);
2599 addToken("case", HiKeyword
);
2601 addToken("apply", HiKeyword
);
2602 addToken("call", HiKeyword
);
2604 addToken("eq?", HiSpecial
);
2605 addToken("nil?", HiSpecial
);
2606 addToken("number?", HiSpecial
);
2607 addToken("symbol?", HiSpecial
);
2608 addToken("cons?", HiSpecial
);
2609 addToken("lambda?", HiSpecial
);
2610 addToken("array?", HiSpecial
);
2611 addToken("string?", HiSpecial
);
2612 addToken("cons-or-nil?", HiSpecial
);
2615 addToken("min", HiKeyword
);
2616 addToken("max", HiKeyword
);
2619 addToken("sqrt", HiKeyword
);
2620 addToken("abs", HiKeyword
);
2622 addToken("sin", HiKeyword
);
2623 addToken("cos", HiKeyword
);
2624 addToken("tan", HiKeyword
);
2625 addToken("atan", HiKeyword
);
2626 addToken("floor", HiKeyword
);
2627 addToken("ceil", HiKeyword
);
2628 addToken("trunc", HiKeyword
);
2630 addToken("atan2", HiKeyword
);
2632 addToken("new-array", HiKeyword
);
2633 addToken("new-string", HiKeyword
);
2634 addToken("length", HiKeyword
);
2635 addToken("slice", HiKeyword
);
2636 addToken("a-get", HiKeyword
);
2637 addToken("a-set!", HiInternal
);
2640 addToken("=", HiPunct
);
2641 addToken("==", HiPunct
);
2642 addToken("<>", HiPunct
);
2643 addToken("!=", HiPunct
);
2644 addToken(">", HiPunct
);
2645 addToken("<", HiPunct
);
2646 addToken(">=", HiPunct
);
2647 addToken("<=", HiPunct
);
2649 addToken("+", HiPunct
);
2650 addToken("-", HiPunct
);
2651 addToken("*", HiPunct
);
2652 addToken("/", HiPunct
);
2653 addToken("%", HiPunct
);
2655 addToken("(", HiPunct
);
2656 addToken(")", HiPunct
);
2657 addToken("{", HiPunct
);
2658 addToken("}", HiPunct
);
2659 addToken("[", HiPunct
);
2660 addToken("]", HiPunct
);
2662 addToken(".", HiInternal
);
2663 addToken("'", HiInternal
);
2668 // ////////////////////////////////////////////////////////////////////////// //
2669 public class EdHiTokensPas
: EdHiTokens
{
2675 //Opt.NumAllowUnder|
2683 //Opt.ShellSingleComment|
2686 //Opt.SqlSingleComment|
2687 //Opt.CPreprocessor|
2690 Opt
.CaseInsensitive|
2691 Opt
.SQStringNoEscape|
2692 //Opt.DQStringNoEscape|
2693 //Opt.CougarSingleComment|
2694 //Opt.CougarCharLiteral|
2695 //Opt.MaximumTokens|
2701 addToken("absolute", HiKeyword
);
2702 addToken("abstract", HiKeyword
);
2703 addToken("and", HiSpecial
);
2704 addToken("array", HiKeyword
);
2705 addToken("as", HiSpecial
);
2706 addToken("asm", HiKeyword
);
2707 addToken("assembler", HiKeyword
);
2708 addToken("begin", HiKeyword
);
2709 addToken("break", HiKeyword
);
2710 addToken("case", HiKeyword
);
2711 addToken("cdecl", HiKeywordHi
);
2712 addToken("class", HiKeywordHi
);
2713 addToken("const", HiKeywordHi
);
2714 addToken("constref", HiSpecial
);
2715 addToken("constructor", HiKeywordHi
);
2716 addToken("continue", HiKeywordHi
);
2717 addToken("destructor", HiKeywordHi
);
2718 addToken("dispid", HiKeyword
);
2719 addToken("dispinterface", HiKeyword
);
2720 addToken("dispose", HiKeyword
);
2721 addToken("div", HiSpecial
);
2722 addToken("do", HiKeyword
);
2723 addToken("downto", HiKeyword
);
2724 addToken("dynamic", HiKeyword
);
2725 addToken("else", HiKeyword
);
2726 addToken("end", HiKeyword
);
2727 addToken("except", HiKeyword
);
2728 addToken("exit", HiKeywordHi
);
2729 addToken("export", HiKeyword
);
2730 addToken("exports", HiKeyword
);
2731 addToken("external", HiKeywordHi
);
2732 addToken("fail", HiKeyword
);
2733 addToken("false", HiKeywordHi
);
2734 addToken("far", HiKeyword
);
2735 addToken("file", HiKeywordHi
);
2736 addToken("finalisation", HiKeywordHi
);
2737 addToken("finally", HiKeyword
);
2738 addToken("for", HiKeyword
);
2739 addToken("forward", HiKeywordHi
);
2740 addToken("function", HiKeyword
);
2741 addToken("generic", HiKeywordHi
);
2742 addToken("goto", HiKeyword
);
2743 addToken("if", HiKeyword
);
2744 addToken("implementation", HiKeywordHi
);
2745 addToken("in", HiSpecial
);
2746 addToken("inherited", HiSpecial
);
2747 addToken("initialization", HiKeywordHi
);
2748 addToken("inline", HiKeywordHi
);
2749 addToken("interface", HiKeyword
);
2750 addToken("interrupt", HiInternal
);
2751 addToken("is", HiSpecial
);
2752 addToken("label", HiKeywordHi
);
2753 addToken("library", HiKeyword
);
2754 addToken("mod", HiSpecial
);
2755 addToken("near", HiInternal
);
2756 addToken("new", HiKeyword
);
2757 addToken("nil", HiKeywordHi
);
2758 addToken("not", HiSpecial
);
2759 addToken("object", HiKeywordHi
);
2760 addToken("of", HiKeyword
);
2761 addToken("on", HiKeyword
);
2762 addToken("operator", HiKeywordHi
);
2763 addToken("or", HiSpecial
);
2764 addToken("otherwise", HiSpecial
);
2765 addToken("out", HiSpecial
);
2766 addToken("overload", HiKeywordHi
);
2767 addToken("override", HiKeywordHi
);
2768 addToken("packed", HiKeyword
);
2769 addToken("pascal", HiKeywordHi
);
2770 addToken("private", HiKeyword
);
2771 addToken("procedure", HiKeyword
);
2772 addToken("program", HiKeyword
);
2773 addToken("property", HiKeyword
);
2774 addToken("protected", HiKeyword
);
2775 addToken("public", HiKeyword
);
2776 addToken("published", HiKeyword
);
2777 addToken("raise", HiKeyword
);
2778 addToken("read", HiKeyword
);
2779 addToken("readonly", HiKeyword
);
2780 addToken("record", HiKeywordHi
);
2781 addToken("register", HiKeywordHi
);
2782 addToken("repeat", HiKeyword
);
2783 addToken("safecall", HiKeywordHi
);
2784 addToken("self", HiInternal
);
2785 addToken("set", HiSpecial
);
2786 addToken("shl", HiSpecial
);
2787 addToken("shr", HiSpecial
);
2788 addToken("sizeof", HiKeywordHi
);
2789 addToken("specialize", HiKeywordHi
);
2790 addToken("static", HiKeywordHi
);
2791 addToken("stdcall", HiKeywordHi
);
2792 addToken("strict", HiKeywordHi
);
2793 addToken("then", HiKeyword
);
2794 addToken("to", HiKeyword
);
2795 addToken("true", HiKeywordHi
);
2796 addToken("try", HiKeyword
);
2797 addToken("type", HiKeyword
);
2798 addToken("unit", HiKeyword
);
2799 addToken("until", HiKeyword
);
2800 addToken("uses", HiInternal
);
2801 addToken("var", HiKeyword
);
2802 addToken("virtual", HiKeywordHi
);
2803 addToken("while", HiKeyword
);
2804 addToken("with", HiKeyword
);
2805 addToken("write", HiKeyword
);
2806 addToken("writeln", HiKeyword
);
2807 addToken("xor", HiSpecial
);
2808 addToken("..", HiKeyword
);
2810 addToken("result", HiKeywordHi
);
2812 addToken(">", HiPunct
);
2813 addToken("<", HiPunct
);
2814 addToken("+", HiPunct
);
2815 addToken("-", HiPunct
);
2816 addToken("*", HiPunct
);
2817 addToken("/", HiPunct
);
2818 addToken("%", HiPunct
);
2819 addToken("=", HiPunct
);
2820 addToken("[", HiPunct
);
2821 addToken("]", HiPunct
);
2822 addToken("(", HiPunct
);
2823 addToken(")", HiPunct
);
2824 addToken(",", HiPunct
);
2825 addToken(".", HiPunct
);
2826 addToken(":", HiPunct
);
2827 addToken(";", HiSemi
);
2828 addToken(":=", HiPunct
);
2829 addToken("<=", HiPunct
);
2830 addToken(">=", HiPunct
);
2831 addToken("<>", HiPunct
);
2832 addToken("@", HiKeyword
);
2834 addToken("Char", HiType
);
2835 addToken("AnsiChar", HiType
);
2836 addToken("WideChar", HiType
);
2837 addToken("Boolean", HiType
);
2839 addToken("ShortInt", HiType
);
2840 addToken("SmallInt", HiType
);
2841 addToken("Integer", HiType
);
2842 addToken("LongInt", HiType
);
2843 addToken("Int64", HiType
);
2844 addToken("UInt64", HiType
);
2846 addToken("Byte", HiType
);
2847 addToken("Word", HiType
);
2848 addToken("LongWord", HiType
);
2849 addToken("DWord", HiType
);
2850 addToken("Cardinal", HiType
);
2852 addToken("Single", HiType
);
2853 addToken("Double", HiType
);
2854 addToken("Extended", HiType
);
2855 addToken("Real", HiType
);
2857 addToken("String", HiType
);
2858 addToken("ShortString", HiType
);
2859 addToken("AnsiString", HiType
);
2860 addToken("WideString", HiType
);
2862 addToken("Pointer", HiType
);
2863 addToken("Variant", HiType
);
2868 // ////////////////////////////////////////////////////////////////////////// //
2869 public class EdHiTokensMES
: EdHiTokens
{
2883 //Opt.ShellSingleComment|
2886 //Opt.SqlSingleComment|
2887 //Opt.CPreprocessor|
2890 //Opt.CaseInsensitive|
2891 //Opt.SQStringNoEscape|
2892 //Opt.DQStringNoEscape|
2893 //Opt.CougarSingleComment|
2894 //Opt.CougarCharLiteral|
2895 //Opt.MaximumTokens|
2896 //Opt.PascalComments|
2901 addToken("this", HiInternal
);
2902 addToken("method", HiInternal
);
2903 addToken("builtin", HiInternal
);
2904 addToken("field", HiInternal
);
2906 addToken("assert", HiBuiltin
);
2907 addToken("new", HiBuiltin
);
2908 //addToken("delete", HiBuiltin);
2910 addToken("null", HiKeyword
);
2911 addToken("true", HiKeyword
);
2912 addToken("false", HiKeyword
);
2913 addToken("cast", HiKeyword
);
2914 //addToken("throw", HiKeyword);
2915 addToken("module", HiKeyword
);
2916 //addToken("typeof", HiKeyword);
2917 //addToken("typeid", HiKeyword);
2918 addToken("sizeof", HiKeyword
);
2920 addToken("void", HiType
);
2921 addToken("int", HiType
);
2922 addToken("bool", HiType
);
2923 addToken("string", HiType
);
2924 addToken("Actor", HiType
);
2926 addToken("function", HiKeyword
);
2927 addToken("is", HiKeyword
);
2928 addToken("if", HiKeyword
);
2929 addToken("else", HiKeyword
);
2930 addToken("while", HiKeyword
);
2931 addToken("for", HiKeyword
);
2932 addToken("default", HiKeyword
);
2933 addToken("break", HiKeyword
);
2934 addToken("continue", HiKeyword
);
2935 addToken("return", HiKeyword
);
2936 addToken("struct", HiKeyword
);
2937 addToken("enum", HiKeyword
);
2938 addToken("const", HiKeyword
);
2939 addToken("alias", HiKeyword
);
2940 addToken("static", HiKeyword
);
2942 addToken("import", HiInternal
);
2944 addToken("auto", HiType
);
2946 addToken("private", HiSpecial
);
2947 addToken("public", HiSpecial
);
2949 addToken("__argTypes", HiInternal
);
2950 addToken("__parameters", HiInternal
);
2952 addToken("ref", HiSpecial
);
2954 addToken("{", HiPunct
);
2955 addToken("}", HiPunct
);
2956 addToken("(", HiPunct
);
2957 addToken(")", HiPunct
);
2958 addToken("[", HiPunct
);
2959 addToken("]", HiPunct
);
2960 addToken(";", HiSemi
);
2961 addToken(":", HiPunct
);
2962 addToken(",", HiPunct
);
2963 addToken(".", HiPunct
);
2964 addToken("^", HiPunct
);
2965 addToken("^=", HiPunct
);
2966 addToken("=", HiPunct
);
2967 addToken("=", HiPunct
);
2968 addToken("=", HiPunct
);
2969 addToken("<", HiPunct
);
2970 addToken(">", HiPunct
);
2971 addToken("<=", HiPunct
);
2972 addToken(">=", HiPunct
);
2973 addToken("==", HiPunct
);
2974 addToken("!=", HiPunct
);
2975 addToken("<>", HiPunct
);
2976 addToken("<>=", HiPunct
);
2977 addToken("<<", HiPunct
);
2978 addToken(">>", HiPunct
);
2979 //addToken(">>>", HiPunct);
2980 addToken("+", HiPunct
);
2981 addToken("-", HiPunct
);
2982 addToken("*", HiPunct
);
2983 addToken("/", HiPunct
);
2984 addToken("%", HiPunct
);
2985 addToken("..", HiPunct
);
2986 addToken("...", HiPunct
);
2987 addToken("&", HiPunct
);
2988 addToken("&&", HiSpecial
);
2989 addToken("|", HiPunct
);
2990 addToken("||", HiSpecial
);
2991 addToken("[]", HiPunct
);
2992 addToken("&", HiPunct
);
2993 addToken("*", HiPunct
);
2994 addToken("~", HiPunct
);
2995 addToken("$", HiPunct
);
2996 addToken("++", HiPunct
);
2997 addToken("--", HiPunct
);
2998 addToken("++", HiPunct
);
2999 addToken("--", HiPunct
);
3000 addToken("?", HiPunct
);
3001 addToken("-", HiPunct
);
3002 addToken("+", HiPunct
);
3003 addToken("+=", HiPunct
);
3004 addToken("-=", HiPunct
);
3005 addToken("*=", HiPunct
);
3006 addToken("/=", HiPunct
);
3007 addToken("%=", HiPunct
);
3008 addToken("<<=", HiPunct
);
3009 addToken(">>=", HiPunct
);
3010 //addToken(">>>=", HiPunct);
3011 addToken("&=", HiPunct
);
3012 addToken("|=", HiPunct
);
3013 addToken("~=", HiPunct
);
3014 addToken("~", HiPunct
);
3015 //addToken("is", HiPunct);
3016 //addToken("!is", HiPunct);
3017 //addToken("@", HiPunct);
3022 // ////////////////////////////////////////////////////////////////////////// //
3023 public class EdHiTokensZAS
: EdHiTokens
{
3034 Opt
.CaseInsensitive|
3035 Opt
.CougarSingleComment|
3037 //Opt.MaximumTokens|
3041 addToken("adc", HiKeyword
);
3042 addToken("add", HiKeyword
);
3043 addToken("and", HiKeyword
);
3044 addToken("bit", HiKeyword
);
3045 addToken("call", HiKeyword
);
3046 addToken("ccf", HiKeyword
);
3047 addToken("cp", HiKeyword
);
3048 addToken("cpd", HiKeyword
);
3050 addToken("cpdr", HiKeyword
);
3051 addToken("cpi", HiKeyword
);
3052 addToken("cpir", HiKeyword
);
3053 addToken("cpl", HiKeyword
);
3054 addToken("daa", HiKeyword
);
3055 addToken("dec", HiKeyword
);
3056 addToken("di", HiKeyword
);
3057 addToken("djnz", HiKeyword
);
3059 addToken("ei", HiKeyword
);
3060 addToken("ex", HiKeyword
);
3061 addToken("exx", HiKeyword
);
3062 addToken("halt", HiKeyword
);
3063 addToken("im", HiKeyword
);
3064 addToken("in", HiKeyword
);
3065 addToken("inc", HiKeyword
);
3066 addToken("ind", HiKeyword
);
3068 addToken("indr", HiKeyword
);
3069 addToken("ini", HiKeyword
);
3070 addToken("inir", HiKeyword
);
3071 addToken("jp", HiKeyword
);
3072 addToken("jr", HiKeyword
);
3073 addToken("ld", HiKeyword
);
3074 addToken("ldd", HiKeyword
);
3075 addToken("lddr", HiKeyword
);
3077 addToken("ldi", HiKeyword
);
3078 addToken("ldir", HiKeyword
);
3079 addToken("neg", HiKeyword
);
3080 addToken("nop", HiKeyword
);
3081 addToken("or", HiKeyword
);
3082 addToken("otdr", HiKeyword
);
3083 addToken("otir", HiKeyword
);
3084 addToken("out", HiKeyword
);
3086 addToken("outd", HiKeyword
);
3087 addToken("outi", HiKeyword
);
3088 addToken("pop", HiKeyword
);
3089 addToken("push", HiKeyword
);
3090 addToken("res", HiKeyword
);
3091 addToken("ret", HiKeyword
);
3092 addToken("reti", HiKeyword
);
3093 addToken("retn", HiKeyword
);
3095 addToken("rl", HiKeyword
);
3096 addToken("rla", HiKeyword
);
3097 addToken("rlc", HiKeyword
);
3098 addToken("rlca", HiKeyword
);
3099 addToken("rld", HiKeyword
);
3100 addToken("rr", HiKeyword
);
3101 addToken("rra", HiKeyword
);
3102 addToken("rrc", HiKeyword
);
3104 addToken("rrca", HiKeyword
);
3105 addToken("rrd", HiKeyword
);
3106 addToken("rst", HiKeyword
);
3107 addToken("sbc", HiKeyword
);
3108 addToken("scf", HiKeyword
);
3109 addToken("set", HiKeyword
);
3110 addToken("sla", HiKeyword
);
3111 addToken("sli", HiKeyword
);
3113 addToken("sll", HiKeyword
);
3114 addToken("sra", HiKeyword
);
3115 addToken("srl", HiKeyword
);
3116 addToken("sub", HiKeyword
);
3117 addToken("xor", HiKeyword
);
3118 addToken("xslt", HiKeyword
);
3119 addToken("nopx", HiKeyword
);
3120 addToken("nopy", HiKeyword
);
3124 addToken("ldix", HiKeyword);
3125 addToken("ldws", HiKeyword);
3126 addToken("ldirx", HiKeyword);
3127 addToken("lddx", HiKeyword);
3129 addToken("lddrx", HiKeyword);
3130 addToken("ldpirx", HiKeyword);
3131 addToken("outinb", HiKeyword);
3132 addToken("mul", HiKeyword);
3134 addToken("swapnib", HiKeyword);
3135 addToken("mirror", HiKeyword);
3136 addToken("nextreg", HiKeyword);
3137 addToken("pixeldn", HiKeyword);
3139 addToken("pixelad", HiKeyword);
3140 addToken("setae", HiKeyword);
3141 addToken("test", HiKeyword);
3142 addToken("bsla", HiKeyword);
3144 addToken("bsra", HiKeyword);
3145 addToken("bsrl", HiKeyword);
3146 addToken("bsrf", HiKeyword);
3147 addToken("brlc", HiKeyword);
3151 addToken("b", HiKeywordHi
);
3152 addToken("c", HiKeywordHi
);
3153 addToken("bc", HiKeywordHi
);
3154 addToken("d", HiKeywordHi
);
3155 addToken("e", HiKeywordHi
);
3156 addToken("de", HiKeywordHi
);
3157 addToken("h", HiKeywordHi
);
3158 addToken("l", HiKeywordHi
);
3159 addToken("hl", HiKeywordHi
);
3160 addToken("a", HiKeywordHi
);
3161 addToken("af", HiKeywordHi
);
3162 //addToken("af'", HiKeywordHi); // specially processed
3163 addToken("afx", HiKeywordHi
);
3164 addToken("sp", HiKeywordHi
);
3165 addToken("(hl)", HiKeywordHi
);
3166 addToken("ix", HiKeywordHi
);
3167 addToken("iy", HiKeywordHi
);
3168 addToken("ixl", HiKeywordHi
);
3169 addToken("iyl", HiKeywordHi
);
3170 addToken("ixh", HiKeywordHi
);
3171 addToken("iyh", HiKeywordHi
);
3173 /* jump conditions */
3175 addToken("nz", HiSpecial
);
3176 addToken("z", HiSpecial
);
3177 addToken("nc", HiSpecial
);
3178 //addToken("c", HiSpecial); // conflicts with register name; specially processed
3179 addToken("po", HiSpecial
);
3180 addToken("pe", HiSpecial
);
3181 addToken("p", HiSpecial
);
3182 addToken("m", HiSpecial
);
3184 addToken("display", HiInternal
);
3185 addToken("display0", HiInternal
);
3186 addToken("displaya", HiInternal
);
3187 addToken("disphex", HiInternal
);
3188 addToken("disphex0", HiInternal
);
3189 addToken("disphexa", HiInternal
);
3191 addToken("deffmt", HiInternal
);
3192 addToken("$model", HiInternal
);
3193 addToken("macro", HiInternal
);
3194 addToken("endm", HiInternal
);
3195 addToken("org", HiInternal
);
3196 addToken("disp", HiInternal
);
3197 addToken("enddisp", HiInternal
);
3198 addToken("phase", HiInternal
);
3199 addToken("dephase", HiInternal
);
3200 addToken("unphase", HiInternal
);
3201 addToken("align", HiInternal
);
3202 addToken("dispalign", HiInternal
);
3203 addToken("phasealign", HiInternal
);
3204 addToken("ent", HiInternal
);
3205 addToken("clr", HiInternal
);
3206 addToken("reserve", HiInternal
);
3207 addToken("include", HiInternal
);
3208 addToken("incbin", HiInternal
);
3209 addToken("module", HiInternal
);
3210 addToken("endmodule", HiInternal
);
3211 addToken("dup", HiInternal
);
3212 addToken("edup", HiInternal
);
3213 addToken("if", HiInternal
);
3214 addToken("ifx", HiInternal
);
3215 addToken("else", HiInternal
);
3216 addToken("elseif", HiInternal
);
3217 addToken("elseifx", HiInternal
);
3218 addToken("endif", HiInternal
);
3219 addToken("defincr", HiInternal
);
3220 addToken("defb", HiInternal
);
3221 addToken("db", HiInternal
);
3222 addToken("defw", HiInternal
);
3223 addToken("dw", HiInternal
);
3224 addToken("defr", HiInternal
);
3225 addToken("dr", HiInternal
);
3226 addToken("defs", HiInternal
);
3227 addToken("ds", HiInternal
);
3228 addToken("defm", HiInternal
);
3229 addToken("dm", HiInternal
);
3230 addToken("defz", HiInternal
);
3231 addToken("dz", HiInternal
);
3232 addToken("defx", HiInternal
);
3233 addToken("dx", HiInternal
);
3234 addToken("defc", HiInternal
);
3235 addToken("dc", HiInternal
);
3236 addToken("$error", HiInternal
);
3237 addToken("$warning", HiInternal
);
3238 addToken("$printf", HiInternal
);
3239 addToken("$printf0", HiInternal
);
3240 addToken("$printfa", HiInternal
);
3241 addToken("$mathmode", HiInternal
);
3243 addToken("{", HiPunct
);
3244 addToken("}", HiPunct
);
3245 addToken("(", HiPunct
);
3246 addToken(")", HiPunct
);
3247 addToken("[", HiPunct
);
3248 addToken("]", HiPunct
);
3249 addToken(";", HiSemi
);
3250 addToken(":", HiPunct
);
3251 addToken(",", HiPunct
);
3252 addToken(".", HiPunct
);
3253 addToken("^", HiPunct
);
3254 addToken("^=", HiPunct
);
3255 addToken("=", HiPunct
);
3256 addToken("=", HiPunct
);
3257 addToken("=", HiPunct
);
3258 addToken("<", HiPunct
);
3259 addToken(">", HiPunct
);
3260 addToken("<=", HiPunct
);
3261 addToken(">=", HiPunct
);
3262 addToken("==", HiPunct
);
3263 addToken("!=", HiPunct
);
3264 addToken("<>", HiPunct
);
3265 addToken("<>=", HiPunct
);
3266 addToken("<<", HiPunct
);
3267 addToken(">>", HiPunct
);
3268 addToken(">>>", HiPunct
);
3269 addToken("+", HiPunct
);
3270 addToken("-", HiPunct
);
3271 addToken("*", HiPunct
);
3272 addToken("/", HiPunct
);
3273 addToken("%", HiPunct
);
3274 addToken("..", HiPunct
);
3275 addToken("...", HiPunct
);
3276 addToken("&", HiPunct
);
3277 addToken("&&", HiSpecial
);
3278 addToken("|", HiPunct
);
3279 addToken("||", HiSpecial
);
3280 addToken("[]", HiPunct
);
3281 addToken("&", HiPunct
);
3282 addToken("*", HiPunct
);
3283 addToken("~", HiPunct
);
3284 addToken("$", HiPunct
);
3285 addToken("++", HiPunct
);
3286 addToken("--", HiPunct
);
3287 addToken("++", HiPunct
);
3288 addToken("--", HiPunct
);
3289 addToken("?", HiPunct
);
3290 addToken("-", HiPunct
);
3291 addToken("+", HiPunct
);
3292 addToken("+=", HiPunct
);
3293 addToken("-=", HiPunct
);
3294 addToken("*=", HiPunct
);
3295 addToken("/=", HiPunct
);
3296 addToken("%=", HiPunct
);
3297 addToken("<<=", HiPunct
);
3298 addToken(">>=", HiPunct
);
3299 //addToken(">>>=", HiPunct);
3300 addToken("&=", HiPunct
);
3301 addToken("|=", HiPunct
);
3302 addToken("~=", HiPunct
);
3303 addToken("~", HiPunct
);
3304 //addToken("is", HiPunct);
3305 //addToken("!is", HiPunct);
3306 //addToken("@", HiPunct);
3311 // ////////////////////////////////////////////////////////////////////////// //
3312 // new higlighter instance for the file with the given extension
3313 public EditorHL
getHiglighterObjectFor (const(char)[] ext
, const(char)[] fullname
) {
3314 auto xname
= fullname
;
3315 auto lslpos
= xname
.lastIndexOf('/');
3316 if (lslpos
>= 0) xname
= xname
[lslpos
+1..$];
3317 if (ext
.strEquCI(".d")) {
3318 __gshared EdHiTokensD toksd
;
3319 if (toksd
is null) toksd
= new EdHiTokensD();
3320 return new EditorHLExt(toksd
);
3322 if (ext
.strEquCI(".js") || ext
.strEquCI(".jsm")) {
3323 __gshared EdHiTokensJS toksjs
;
3324 if (toksjs
is null) toksjs
= new EdHiTokensJS();
3325 return new EditorHLExt(toksjs
);
3327 if (ext
.strEquCI(".c") || ext
.strEquCI(".cpp") ||
3328 ext
.strEquCI(".h") || ext
.strEquCI(".hpp") ||
3329 ext
.strEquCI(".hxx") || ext
.strEquCI(".cxx") ||
3330 ext
.strEquCI(".cc"))
3332 __gshared EdHiTokensC toksc
;
3333 if (toksc
is null) toksc
= new EdHiTokensC();
3334 return new EditorHLExt(toksc
);
3336 if (xname
.strEquCI("zscript.txt") || xname
.strEquCI("actor.txt")) {
3337 __gshared EdHiTokensZS tokszs
;
3338 if (tokszs
is null) tokszs
= new EdHiTokensZS();
3339 return new EditorHLExt(tokszs
);
3341 if (ext
.strEquCI(".uc") || ext
.strEquCI(".vc")) {
3342 __gshared EdHiTokensVC toksvc
;
3343 if (toksvc
is null) toksvc
= new EdHiTokensVC();
3344 return new EditorHLExt(toksvc
);
3346 if (ext
.strEquCI(".frag") || ext
.strEquCI(".vert") ||
3347 ext
.strEquCI(".shad") || ext
.strEquCI(".shader") ||
3348 ext
.strEquCI(".fs") || ext
.strEquCI(".vs"))
3350 __gshared EdHiTokensFrag tokf
;
3351 if (tokf
is null) tokf
= new EdHiTokensFrag();
3352 return new EditorHLExt(tokf
);
3354 if (ext
.strEquCI(".sh") || ext
.strEquCI(".profile")) {
3355 __gshared EdHiTokensShell tokssh
;
3356 if (tokssh
is null) tokssh
= new EdHiTokensShell();
3357 return new EditorHLExt(tokssh
);
3359 if (ext
.strEquCI(".htm") || ext
.strEquCI(".html")) {
3360 __gshared EdHiTokensHtml tokshtml
;
3361 if (tokshtml
is null) tokshtml
= new EdHiTokensHtml();
3362 return new EditorHLExt(tokshtml
);
3364 if (ext
.strEquCI(".sql")) {
3365 __gshared EdHiTokensSQL toksql
;
3366 if (toksql
is null) toksql
= new EdHiTokensSQL();
3367 return new EditorHLExt(toksql
);
3369 if (ext
.strEquCI(".lsp") || ext
.strEquCI(".cgr")) {
3370 __gshared EdHiTokensCougar tokcougar
;
3371 if (tokcougar
is null) tokcougar
= new EdHiTokensCougar();
3372 return new EditorHLExt(tokcougar
);
3374 if (ext
.strEquCI(".pas") || ext
.strEquCI(".pp") || ext
.strEquCI(".inc") || ext
.strEquCI(".dpr")) {
3375 __gshared EdHiTokensPas tokpas
;
3376 if (tokpas
is null) tokpas
= new EdHiTokensPas();
3377 return new EditorHLExt(tokpas
);
3379 if (ext
.strEquCI(".mes")) {
3380 __gshared EdHiTokensMES toksmes
;
3381 if (toksmes
is null) toksmes
= new EdHiTokensMES();
3382 return new EditorHLExt(toksmes
);
3384 if (ext
.strEquCI(".zas") || ext
.strEquCI(".a80")) {
3385 __gshared EdHiTokensZAS tokszas
;
3386 if (tokszas
is null) tokszas
= new EdHiTokensZAS();
3387 return new EditorHLExt(tokszas
);
3389 auto bnpos
= fullname
.length
;
3390 while (bnpos
> 0 && fullname
.ptr
[bnpos
-1] != '/') --bnpos
;
3391 auto name
= fullname
[bnpos
..$];
3392 if (name
== "TODO") return new EditorHLTODO();
3393 if (name
== "COMMIT_EDITMSG") return new EditorHLGitCommit();
3394 if (name
.startsWith("ci-comment-")) return new EditorHLGitCommit(); // fossil commit message