summaryrefslogtreecommitdiffstats
path: root/qt/qextscintillalexerhtml.cpp
blob: d634a2bd773581dbc7254fe71b5462dbb069dfe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
// This module implements the QextScintillaLexerHTML class.
//
// Copyright (c) 2006
// 	Riverbank Computing Limited <info@riverbankcomputing.co.uk>
// 
// This file is part of TQScintilla.
// 
// This copy of TQScintilla is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// TQScintilla is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
// details.
// 
// You should have received a copy of the GNU General Public License along with
// TQScintilla; see the file LICENSE.  If not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

#include <tqcolor.h>
#include <tqfont.h>
#include <tqsettings.h>

#include "qextscintillalexerhtml.h"
#include "qextscintillalexerjavascript.h"
#include "qextscintillalexerpython.h"


// The ctor.
QextScintillaLexerHTML::QextScintillaLexerHTML(TQObject *parent,
					       const char *name)
	: QextScintillaLexer(parent,name), fold_compact(TRUE),
	  fold_preproc(TRUE), case_sens_tags(FALSE)
{
}


// The dtor.
QextScintillaLexerHTML::~QextScintillaLexerHTML()
{
}


// Returns the language name.
const char *QextScintillaLexerHTML::language() const
{
	return "HTML";
}


// Returns the lexer name.
const char *QextScintillaLexerHTML::lexer() const
{
	return "hypertext";
}


// Return the string of characters that comprise a word.
const char *QextScintillaLexerHTML::wordCharacters() const
{
        return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-";
}


// Returns the foreground colour of the text for a style.
TQColor QextScintillaLexerHTML::color(int style) const
{
	switch (style)
	{
	case Default:
	case JavaScriptDefault:
	case JavaScriptWord:
	case JavaScriptSymbol:
	case ASPJavaScriptDefault:
	case ASPJavaScriptWord:
	case ASPJavaScriptSymbol:
	case VBScriptDefault:
	case ASPVBScriptDefault:
	case PHPOperator:
		return TQColor(0x00,0x00,0x00);

	case Tag:
	case XMLTagEnd:
	case Script:
	case SGMLDefault:
	case SGMLCommand:
	case VBScriptKeyword:
	case VBScriptIdentifier:
	case VBScriptUnclosedString:
	case ASPVBScriptKeyword:
	case ASPVBScriptIdentifier:
	case ASPVBScriptUnclosedString:
		return TQColor(0x00,0x00,0x80);

	case UnknownTag:
	case UnknownAttribute:
		return TQColor(0xff,0x00,0x00);

	case Attribute:
	case VBScriptNumber:
	case ASPVBScriptNumber:
		return TQColor(0x00,0x80,0x80);

	case HTMLNumber:
	case JavaScriptNumber:
	case ASPJavaScriptNumber:
	case PythonNumber:
	case PythonFunctionMethodName:
	case ASPPythonNumber:
	case ASPPythonFunctionMethodName:
		return TQColor(0x00,0x7f,0x7f);

	case HTMLDoubleQuotedString:
	case HTMLSingleQuotedString:
	case JavaScriptDoubleQuotedString:
	case JavaScriptSingleQuotedString:
	case ASPJavaScriptDoubleQuotedString:
	case ASPJavaScriptSingleQuotedString:
	case PythonDoubleQuotedString:
	case PythonSingleQuotedString:
	case ASPPythonDoubleQuotedString:
	case ASPPythonSingleQuotedString:
	case PHPKeyword:
		return TQColor(0x7f,0x00,0x7f);

	case OtherInTag:
	case Entity:
	case VBScriptString:
	case ASPVBScriptString:
		return TQColor(0x80,0x00,0x80);

	case HTMLComment:
	case SGMLComment:
		return TQColor(0x80,0x80,0x00);

	case XMLStart:
	case XMLEnd:
	case PHPStart:
	case PythonClassName:
	case ASPPythonClassName:
		return TQColor(0x00,0x00,0xff);

	case HTMLValue:
		return TQColor(0xff,0x00,0xff);

	case SGMLParameter:
		return TQColor(0x00,0x66,0x00);

	case SGMLDoubleQuotedString:
	case SGMLError:
		return TQColor(0x80,0x00,0x00);

	case SGMLSingleQuotedString:
		return TQColor(0x99,0x33,0x00);

	case SGMLSpecial:
		return TQColor(0x33,0x66,0xff);

	case SGMLEntity:
		return TQColor(0x33,0x33,0x33);

	case SGMLBlockDefault:
		return TQColor(0x00,0x00,0x66);

	case JavaScriptStart:
	case ASPJavaScriptStart:
		return TQColor(0x7f,0x7f,0x00);

	case JavaScriptComment:
	case JavaScriptCommentLine:
	case ASPJavaScriptComment:
	case ASPJavaScriptCommentLine:
	case PythonComment:
	case ASPPythonComment:
	case PHPDoubleQuotedString:
		return TQColor(0x00,0x7f,0x00);

	case JavaScriptCommentDoc:
		return TQColor(0x3f,0x70,0x3f);

	case JavaScriptKeyword:
	case ASPJavaScriptKeyword:
	case PythonKeyword:
	case ASPPythonKeyword:
	case PHPVariable:
	case PHPDoubleQuotedVariable:
		return TQColor(0x00,0x00,0x7f);

	case ASPJavaScriptCommentDoc:
		return TQColor(0x7f,0x7f,0x7f);

	case VBScriptComment:
	case ASPVBScriptComment:
		return TQColor(0x00,0x80,0x00);

	case PythonStart:
	case PythonDefault:
	case ASPPythonStart:
	case ASPPythonDefault:
		return TQColor(0x80,0x80,0x80);

	case PythonTripleSingleQuotedString:
	case PythonTripleDoubleQuotedString:
	case ASPPythonTripleSingleQuotedString:
	case ASPPythonTripleDoubleQuotedString:
		return TQColor(0x7f,0x00,0x00);

	case PHPDefault:
		return TQColor(0x00,0x00,0x33);

	case PHPSingleQuotedString:
		return TQColor(0x00,0x9f,0x00);

	case PHPNumber:
		return TQColor(0xcc,0x99,0x00);

	case PHPComment:
		return TQColor(0x99,0x99,0x99);

	case PHPCommentLine:
		return TQColor(0x66,0x66,0x66);
	}

	return QextScintillaLexer::color(style);
}


// Returns the end-of-line fill for a style.
bool QextScintillaLexerHTML::eolFill(int style) const
{
	switch (style)
	{
	case JavaScriptDefault:
	case JavaScriptComment:
	case JavaScriptCommentDoc:
	case JavaScriptUnclosedString:
	case ASPJavaScriptDefault:
	case ASPJavaScriptComment:
	case ASPJavaScriptCommentDoc:
	case ASPJavaScriptUnclosedString:
	case VBScriptDefault:
	case VBScriptComment:
	case VBScriptNumber:
	case VBScriptKeyword:
	case VBScriptString:
	case VBScriptIdentifier:
	case VBScriptUnclosedString:
	case ASPVBScriptDefault:
	case ASPVBScriptComment:
	case ASPVBScriptNumber:
	case ASPVBScriptKeyword:
	case ASPVBScriptString:
	case ASPVBScriptIdentifier:
	case ASPVBScriptUnclosedString:
	case PythonDefault:
	case PythonComment:
	case PythonNumber:
	case PythonDoubleQuotedString:
	case PythonSingleQuotedString:
	case PythonKeyword:
	case PythonTripleSingleQuotedString:
	case PythonTripleDoubleQuotedString:
	case PythonClassName:
	case PythonFunctionMethodName:
	case PythonOperator:
	case PythonIdentifier:
	case ASPPythonDefault:
	case ASPPythonComment:
	case ASPPythonNumber:
	case ASPPythonDoubleQuotedString:
	case ASPPythonSingleQuotedString:
	case ASPPythonKeyword:
	case ASPPythonTripleSingleQuotedString:
	case ASPPythonTripleDoubleQuotedString:
	case ASPPythonClassName:
	case ASPPythonFunctionMethodName:
	case ASPPythonOperator:
	case ASPPythonIdentifier:
	case PHPDefault:
		return TRUE;
	}

	return QextScintillaLexer::eolFill(style);
}


// Returns the font of the text for a style.
TQFont QextScintillaLexerHTML::font(int style) const
{
	TQFont f;

	switch (style)
	{
	case Default:
	case Entity:
#if defined(Q_OS_WIN)
		f = TQFont("Times New Roman",11);
#else
		f = TQFont("Bitstream Charter",10);
#endif
		break;

	case HTMLComment:
#if defined(Q_OS_WIN)
		f = TQFont("Verdana",9);
#else
		f = TQFont("Bitstream Vera Sans",8);
#endif
		break;

	case SGMLCommand:
	case PythonKeyword:
	case PythonClassName:
	case PythonFunctionMethodName:
	case PythonOperator:
	case ASPPythonKeyword:
	case ASPPythonClassName:
	case ASPPythonFunctionMethodName:
	case ASPPythonOperator:
		f = QextScintillaLexer::font(style);
		f.setBold(TRUE);
		break;

	case JavaScriptDefault:
	case JavaScriptCommentDoc:
	case JavaScriptKeyword:
	case JavaScriptSymbol:
	case ASPJavaScriptDefault:
	case ASPJavaScriptCommentDoc:
	case ASPJavaScriptKeyword:
	case ASPJavaScriptSymbol:
#if defined(Q_OS_WIN)
		f = TQFont("Comic Sans MS",9);
#else
		f = TQFont("Bitstream Vera Serif",9);
#endif
		f.setBold(TRUE);
		break;

	case JavaScriptComment:
	case JavaScriptCommentLine:
	case JavaScriptNumber:
	case JavaScriptWord:
	case JavaScriptDoubleQuotedString:
	case JavaScriptSingleQuotedString:
	case ASPJavaScriptComment:
	case ASPJavaScriptCommentLine:
	case ASPJavaScriptNumber:
	case ASPJavaScriptWord:
	case ASPJavaScriptDoubleQuotedString:
	case ASPJavaScriptSingleQuotedString:
	case VBScriptComment:
	case ASPVBScriptComment:
	case PythonComment:
	case ASPPythonComment:
	case PHPComment:
#if defined(Q_OS_WIN)
		f = TQFont("Comic Sans MS",9);
#else
		f = TQFont("Bitstream Vera Serif",9);
#endif
		break;

	case VBScriptDefault:
	case VBScriptNumber:
	case VBScriptString:
	case VBScriptIdentifier:
	case VBScriptUnclosedString:
	case ASPVBScriptDefault:
	case ASPVBScriptNumber:
	case ASPVBScriptString:
	case ASPVBScriptIdentifier:
	case ASPVBScriptUnclosedString:
#if defined(Q_OS_WIN)
		f = TQFont("Lucida Sans Unicode",9);
#else
		f = TQFont("Bitstream Vera Serif",9);
#endif
		break;

	case VBScriptKeyword:
	case ASPVBScriptKeyword:
#if defined(Q_OS_WIN)
		f = TQFont("Lucida Sans Unicode",9);
#else
		f = TQFont("Bitstream Vera Serif",9);
#endif
		f.setBold(TRUE);
		break;

	case PythonDoubleQuotedString:
	case PythonSingleQuotedString:
	case ASPPythonDoubleQuotedString:
	case ASPPythonSingleQuotedString:
#if defined(Q_OS_WIN)
		f = TQFont("Courier New",10);
#else
		f = TQFont("Bitstream Vera Sans Mono",9);
#endif
		break;

	case PHPKeyword:
	case PHPVariable:
	case PHPDoubleQuotedVariable:
		f = QextScintillaLexer::font(style);
		f.setItalic(TRUE);
		break;

	case PHPCommentLine:
#if defined(Q_OS_WIN)
		f = TQFont("Comic Sans MS",9);
#else
		f = TQFont("Bitstream Vera Serif",9);
#endif
		f.setItalic(TRUE);
		break;

	default:
		f = QextScintillaLexer::font(style);
	}

	return f;
}


// Returns the set of keywords.
const char *QextScintillaLexerHTML::keywords(int set) const
{
	if (set == 1)
		return
			"a abbr acronym address applet area "
			"b base basefont bdo big blockquote body br button "
			"caption center cite code col colgroup "
			"dd del dfn dir div dl dt "
			"em "
			"fieldset font form frame frameset "
			"h1 h2 h3 h4 h5 h6 head hr html "
			"i iframe img input ins isindex "
			"kbd "
			"label legend li link "
			"map menu meta "
			"noframes noscript "
			"object ol optgroup option "
			"p param pre "
			"q "
			"s samp script select small span strike strong style "
			"sub sup "
			"table tbody td textarea tfoot th thead title tr tt "
			"u ul "
			"var "
			"xml xmlns "
			"abbr accept-charset accept accesskey action align "
			"alink alt archive axis "
			"background bgcolor border "
			"cellpadding cellspacing char charoff charset checked "
			"cite class classid clear codebase codetype color "
			"cols colspan compact content coords "
			"data datafld dataformatas datapagesize datasrc "
			"datetime declare defer dir disabled "
			"enctype event "
			"face for frame frameborder "
			"headers height href hreflang hspace http-equiv "
			"id ismap label lang language leftmargin link "
			"longdesc "
			"marginwidth marginheight maxlength media method "
			"multiple "
			"name nohref noresize noshade nowrap "
			"object onblur onchange onclick ondblclick onfocus "
			"onkeydown onkeypress onkeyup onload onmousedown "
			"onmousemove onmouseover onmouseout onmouseup onreset "
			"onselect onsubmit onunload "
			"profile prompt "
			"readonly rel rev rows rowspan rules "
			"scheme scope selected shape size span src standby "
			"start style summary "
			"tabindex target text title topmargin type "
			"usemap "
			"valign value valuetype version vlink vspace "
			"width "
			"text password checkbox radio submit reset file "
			"hidden image "
			"public !doctype";

	if (set == 2)
		return QextScintillaLexerJavaScript::keywordClass;

	if (set == 3)
		return
			// Move these to QextScintillaLexerVisualBasic when we
			// get round to implementing it.
			"and begin case call continue do each else elseif end "
			"erase error event exit false for function get gosub "
			"goto if implement in load loop lset me mid new next "
			"not nothing on or property raiseevent rem resume "
			"return rset select set stop sub then to true unload "
			"until wend while with withevents attribute alias as "
			"boolean byref byte byval const compare currency date "
			"declare dim double enum explicit friend global "
			"integer let lib long module object option optional "
			"preserve private property public redim single static "
			"string type variant";

	if (set == 4)
		return QextScintillaLexerPython::keywordClass;

	if (set == 5)
		return
			"and argv as argc break case cfunction class continue "
			"declare default do die "
			"echo else elseif empty enddeclare endfor endforeach "
			"endif endswitch endwhile e_all e_parse e_error "
			"e_warning eval exit extends "
			"false for foreach function global "
			"http_cookie_vars http_get_vars http_post_vars "
			"http_post_files http_env_vars http_server_vars "
			"if include include_once list new not null "
			"old_function or "
			"parent php_os php_self php_version print "
			"require require_once return "
			"static switch stdclass this true var xor virtual "
			"while "
			"__file__ __line__ __sleep __wakeup";

	if (set == 6)
		return "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION";

	return 0;
}


// Returns the user name of a style.
TQString QextScintillaLexerHTML::description(int style) const
{
	switch (style)
	{
	case Default:
		return tr("HTML default");

	case Tag:
		return tr("Tag");

	case UnknownTag:
		return tr("Unknown tag");

	case Attribute:
		return tr("Attribute");

	case UnknownAttribute:
		return tr("Unknown attribute");

	case HTMLNumber:
		return tr("HTML number");

	case HTMLDoubleQuotedString:
		return tr("HTML double-quoted string");

	case HTMLSingleQuotedString:
		return tr("HTML single-quoted string");

	case OtherInTag:
		return tr("Other text in a tag");

	case HTMLComment:
		return tr("HTML comment");

	case Entity:
		return tr("Entity");

	case XMLTagEnd:
		return tr("End of a tag");

	case XMLStart:
		return tr("Start of an XML fragment");

	case XMLEnd:
		return tr("End of an XML fragment");

	case Script:
		return tr("Script tag");

	case ASPAtStart:
		return tr("Start of an ASP fragment with @");

	case ASPStart:
		return tr("Start of an ASP fragment");

	case CDATA:
		return tr("CDATA");

	case PHPStart:
		return tr("Start of a PHP fragment");

	case HTMLValue:
		return tr("Unquoted HTML value");

	case ASPXCComment:
		return tr("ASP X-Code comment");

	case SGMLDefault:
		return tr("SGML default");

	case SGMLCommand:
		return tr("SGML command");

	case SGMLParameter:
		return tr("First parameter of an SGML command");

	case SGMLDoubleQuotedString:
		return tr("SGML double-quoted string");

	case SGMLSingleQuotedString:
		return tr("SGML single-quoted string");

	case SGMLError:
		return tr("SGML error");

	case SGMLSpecial:
		return tr("SGML special entity");

	case SGMLComment:
		return tr("SGML comment");

	case SGMLParameterComment:
		return tr("First parameter comment of an SGML command");

	case SGMLBlockDefault:
		return tr("SGML block default");

	case JavaScriptStart:
		return tr("Start of a JavaScript fragment");

	case JavaScriptDefault:
		return tr("JavaScript default");

	case JavaScriptComment:
		return tr("JavaScript comment");

	case JavaScriptCommentLine:
		return tr("JavaScript line comment");

	case JavaScriptCommentDoc:
		return tr("JavaDoc style JavaScript comment");

	case JavaScriptNumber:
		return tr("JavaScript number");

	case JavaScriptWord:
		return tr("JavaScript word");

	case JavaScriptKeyword:
		return tr("JavaScript keyword");

	case JavaScriptDoubleQuotedString:
		return tr("JavaScript double-quoted string");

	case JavaScriptSingleQuotedString:
		return tr("JavaScript single-quoted string");

	case JavaScriptSymbol:
		return tr("JavaScript symbol");

	case JavaScriptUnclosedString:
		return tr("JavaScript unclosed string");

	case JavaScriptRegex:
		return tr("JavaScript regular expression");

	case ASPJavaScriptStart:
		return tr("Start of an ASP JavaScript fragment");

	case ASPJavaScriptDefault:
		return tr("ASP JavaScript default");

	case ASPJavaScriptComment:
		return tr("ASP JavaScript comment");

	case ASPJavaScriptCommentLine:
		return tr("ASP JavaScript line comment");

	case ASPJavaScriptCommentDoc:
		return tr("JavaDoc style ASP JavaScript comment");

	case ASPJavaScriptNumber:
		return tr("ASP JavaScript number");

	case ASPJavaScriptWord:
		return tr("ASP JavaScript word");

	case ASPJavaScriptKeyword:
		return tr("ASP JavaScript keyword");

	case ASPJavaScriptDoubleQuotedString:
		return tr("ASP JavaScript double-quoted string");

	case ASPJavaScriptSingleQuotedString:
		return tr("ASP JavaScript single-quoted string");

	case ASPJavaScriptSymbol:
		return tr("ASP JavaScript symbol");

	case ASPJavaScriptUnclosedString:
		return tr("ASP JavaScript unclosed string");

	case ASPJavaScriptRegex:
		return tr("ASP JavaScript regular expression");

	case VBScriptStart:
		return tr("Start of a VBScript fragment");

	case VBScriptDefault:
		return tr("VBScript default");

	case VBScriptComment:
		return tr("VBScript comment");

	case VBScriptNumber:
		return tr("VBScript number");

	case VBScriptKeyword:
		return tr("VBScript keyword");

	case VBScriptString:
		return tr("VBScript string");

	case VBScriptIdentifier:
		return tr("VBScript identifier");

	case VBScriptUnclosedString:
		return tr("VBScript unclosed string");

	case ASPVBScriptStart:
		return tr("Start of an ASP VBScript fragment");

	case ASPVBScriptDefault:
		return tr("ASP VBScript default");

	case ASPVBScriptComment:
		return tr("ASP VBScript comment");

	case ASPVBScriptNumber:
		return tr("ASP VBScript number");

	case ASPVBScriptKeyword:
		return tr("ASP VBScript keyword");

	case ASPVBScriptString:
		return tr("ASP VBScript string");

	case ASPVBScriptIdentifier:
		return tr("ASP VBScript identifier");

	case ASPVBScriptUnclosedString:
		return tr("ASP VBScript unclosed string");

	case PythonStart:
		return tr("Start of a Python fragment");

	case PythonDefault:
		return tr("Python default");

	case PythonComment:
		return tr("Python comment");

	case PythonNumber:
		return tr("Python number");

	case PythonDoubleQuotedString:
		return tr("Python double-quoted string");

	case PythonSingleQuotedString:
		return tr("Python single-quoted string");

	case PythonKeyword:
		return tr("Python keyword");

	case PythonTripleDoubleQuotedString:
		return tr("Python triple double-quoted string");

	case PythonTripleSingleQuotedString:
		return tr("Python triple single-quoted string");

	case PythonClassName:
		return tr("Python class name");

	case PythonFunctionMethodName:
		return tr("Python function or method name");

	case PythonOperator:
		return tr("Python operator");

	case PythonIdentifier:
		return tr("Python identifier");

	case ASPPythonStart:
		return tr("Start of an ASP Python fragment");

	case ASPPythonDefault:
		return tr("ASP Python default");

	case ASPPythonComment:
		return tr("ASP Python comment");

	case ASPPythonNumber:
		return tr("ASP Python number");

	case ASPPythonDoubleQuotedString:
		return tr("ASP Python double-quoted string");

	case ASPPythonSingleQuotedString:
		return tr("ASP Python single-quoted string");

	case ASPPythonKeyword:
		return tr("ASP Python keyword");

	case ASPPythonTripleDoubleQuotedString:
		return tr("ASP Python triple double-quoted string");

	case ASPPythonTripleSingleQuotedString:
		return tr("ASP Python triple single-quoted string");

	case ASPPythonClassName:
		return tr("ASP Python class name");

	case ASPPythonFunctionMethodName:
		return tr("ASP Python function or method name");

	case ASPPythonOperator:
		return tr("ASP Python operator");

	case ASPPythonIdentifier:
		return tr("ASP Python identifier");

	case PHPDefault:
		return tr("PHP default");

	case PHPDoubleQuotedString:
		return tr("PHP double-quoted string");

	case PHPSingleQuotedString:
		return tr("PHP single-quoted string");

	case PHPKeyword:
		return tr("PHP keyword");

	case PHPNumber:
		return tr("PHP number");

	case PHPVariable:
		return tr("PHP variable");

	case PHPComment:
		return tr("PHP comment");

	case PHPCommentLine:
		return tr("PHP line comment");

	case PHPDoubleQuotedVariable:
		return tr("PHP double-quoted variable");

	case PHPOperator:
		return tr("PHP operator");
	}

	return TQString();
}


// Returns the background colour of the text for a style.
TQColor QextScintillaLexerHTML::paper(int style) const
{
	switch (style)
	{
	case ASPAtStart:
		return TQColor(0xff,0xff,0x00);

	case ASPStart:
	case CDATA:
		return TQColor(0xff,0xdf,0x00);

	case PHPStart:
		return TQColor(0xff,0xef,0xbf);

	case HTMLValue:
		return TQColor(0xff,0xef,0xff);

	case SGMLDefault:
	case SGMLCommand:
	case SGMLParameter:
	case SGMLDoubleQuotedString:
	case SGMLSingleQuotedString:
	case SGMLSpecial:
	case SGMLEntity:
	case SGMLComment:
		return TQColor(0xef,0xef,0xff);

	case SGMLError:
		return TQColor(0xff,0x66,0x66);

	case SGMLBlockDefault:
		return TQColor(0xcc,0xcc,0xe0);

	case JavaScriptDefault:
	case JavaScriptComment:
	case JavaScriptCommentLine:
	case JavaScriptCommentDoc:
	case JavaScriptNumber:
	case JavaScriptWord:
	case JavaScriptKeyword:
	case JavaScriptDoubleQuotedString:
	case JavaScriptSingleQuotedString:
	case JavaScriptSymbol:
		return TQColor(0xf0,0xf0,0xff);

	case JavaScriptUnclosedString:
	case ASPJavaScriptUnclosedString:
		return TQColor(0xbf,0xbb,0xb0);

	case JavaScriptRegex:
	case ASPJavaScriptRegex:
		return TQColor(0xff,0xbb,0xb0);

	case ASPJavaScriptDefault:
	case ASPJavaScriptComment:
	case ASPJavaScriptCommentLine:
	case ASPJavaScriptCommentDoc:
	case ASPJavaScriptNumber:
	case ASPJavaScriptWord:
	case ASPJavaScriptKeyword:
	case ASPJavaScriptDoubleQuotedString:
	case ASPJavaScriptSingleQuotedString:
	case ASPJavaScriptSymbol:
		return TQColor(0xdf,0xdf,0x7f);

	case VBScriptDefault:
	case VBScriptComment:
	case VBScriptNumber:
	case VBScriptKeyword:
	case VBScriptString:
	case VBScriptIdentifier:
		return TQColor(0xef,0xef,0xff);

	case VBScriptUnclosedString:
	case ASPVBScriptUnclosedString:
		return TQColor(0x7f,0x7f,0xff);

	case ASPVBScriptDefault:
	case ASPVBScriptComment:
	case ASPVBScriptNumber:
	case ASPVBScriptKeyword:
	case ASPVBScriptString:
	case ASPVBScriptIdentifier:
		return TQColor(0xcf,0xcf,0xef);

	case PythonDefault:
	case PythonComment:
	case PythonNumber:
	case PythonDoubleQuotedString:
	case PythonSingleQuotedString:
	case PythonKeyword:
	case PythonTripleSingleQuotedString:
	case PythonTripleDoubleQuotedString:
	case PythonClassName:
	case PythonFunctionMethodName:
	case PythonOperator:
	case PythonIdentifier:
		return TQColor(0xef,0xff,0xef);

	case ASPPythonDefault:
	case ASPPythonComment:
	case ASPPythonNumber:
	case ASPPythonDoubleQuotedString:
	case ASPPythonSingleQuotedString:
	case ASPPythonKeyword:
	case ASPPythonTripleSingleQuotedString:
	case ASPPythonTripleDoubleQuotedString:
	case ASPPythonClassName:
	case ASPPythonFunctionMethodName:
	case ASPPythonOperator:
	case ASPPythonIdentifier:
		return TQColor(0xcf,0xef,0xcf);

	case PHPDefault:
	case PHPDoubleQuotedString:
	case PHPSingleQuotedString:
	case PHPKeyword:
	case PHPNumber:
	case PHPVariable:
	case PHPComment:
	case PHPCommentLine:
	case PHPDoubleQuotedVariable:
	case PHPOperator:
		return TQColor(0xff,0xf8,0xf8);
	}

	return QextScintillaLexer::paper(style);
}


// Refresh all properties.
void QextScintillaLexerHTML::refreshProperties()
{
	setCompactProp();
	setPreprocProp();
	setCaseSensTagsProp();
}


// Read properties from the settings.
bool QextScintillaLexerHTML::readProperties(TQSettings &qs,const TQString &prefix)
{
	int rc = TRUE;
	bool ok, flag;

	// Read the fold compact flag.
	flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok);

	if (ok)
		fold_compact = flag;
	else
		rc = FALSE;

	// Read the fold preprocessor flag.
	flag = qs.readBoolEntry(prefix + "foldpreprocessor",FALSE,&ok);

	if (ok)
		fold_preproc = flag;
	else
		rc = FALSE;

	// Read the case sensitive tags flag.
	flag = qs.readBoolEntry(prefix + "casesensitivetags",FALSE,&ok);

	if (ok)
		case_sens_tags = flag;
	else
		rc = FALSE;

	return rc;
}


// Write properties to the settings.
bool QextScintillaLexerHTML::writeProperties(TQSettings &qs,const TQString &prefix) const
{
	int rc = TRUE;

	// Write the fold compact flag.
	if (!qs.writeEntry(prefix + "foldcompact",fold_compact))
		rc = FALSE;

	// Write the fold preprocessor flag.
	if (!qs.writeEntry(prefix + "foldpreprocessor",fold_preproc))
		rc = FALSE;

	// Write the case sensitive tags flag.
	if (!qs.writeEntry(prefix + "casesensitivetags",case_sens_tags))
		rc = FALSE;

	return rc;
}


// Return TRUE if tags are case sensitive.
bool QextScintillaLexerHTML::caseSensitiveTags() const
{
	return case_sens_tags;
}


// Set if tags are case sensitive.
void QextScintillaLexerHTML::setCaseSensitiveTags(bool sens)
{
	case_sens_tags = sens;

	setCaseSensTagsProp();
}


// Set the "html.tags.case.sensitive" property.
void QextScintillaLexerHTML::setCaseSensTagsProp()
{
	emit propertyChanged("html.tags.case.sensitive",(case_sens_tags ? "1" : "0"));
}


// Return TRUE if folds are compact.
bool QextScintillaLexerHTML::foldCompact() const
{
	return fold_compact;
}


// Set if folds are compact
void QextScintillaLexerHTML::setFoldCompact(bool fold)
{
	fold_compact = fold;

	setCompactProp();
}


// Set the "fold.compact" property.
void QextScintillaLexerHTML::setCompactProp()
{
	emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
}


// Return TRUE if preprocessor blocks can be folded.
bool QextScintillaLexerHTML::foldPreprocessor() const
{
	return fold_preproc;
}


// Set if preprocessor blocks can be folded.
void QextScintillaLexerHTML::setFoldPreprocessor(bool fold)
{
	fold_preproc = fold;

	setPreprocProp();
}


// Set the "fold.preprocessor" property.
void QextScintillaLexerHTML::setPreprocProp()
{
	emit propertyChanged("fold.html.preprocessor",(fold_preproc ? "1" : "0"));
}

#include "qextscintillalexerhtml.moc"