|
27 | 27 | */
|
28 | 28 |
|
29 | 29 | package org.opensolaris.opengrok.analysis.clojure;
|
30 |
| -import org.opensolaris.opengrok.analysis.JFlexXref; |
| 30 | +import org.opensolaris.opengrok.analysis.JFlexXrefSimple; |
31 | 31 | import java.io.IOException;
|
32 | 32 | import java.io.Writer;
|
33 | 33 | import java.io.Reader;
|
| 34 | +import org.opensolaris.opengrok.web.HtmlConsts; |
34 | 35 | import org.opensolaris.opengrok.web.Util;
|
35 | 36 | %%
|
36 | 37 | %public
|
37 | 38 | %class ClojureXref
|
38 |
| -%extends JFlexXref |
| 39 | +%extends JFlexXrefSimple |
39 | 40 | %unicode
|
40 |
| -%ignorecase |
41 | 41 | %int
|
42 | 42 | %include CommonXref.lexh
|
43 | 43 | %{
|
@@ -72,48 +72,59 @@ File = [a-zA-Z] {FNameChar}+ "." ([a-zA-Z]+)
|
72 | 72 | writeSymbol(id, Consts.kwd, yyline);
|
73 | 73 | }
|
74 | 74 |
|
75 |
| -{Number} { out.write("<span class=\"n\">"); |
76 |
| - out.write(yytext()); |
77 |
| - out.write("</span>"); } |
| 75 | + {Number} { |
| 76 | + disjointSpan(HtmlConsts.NUMBER_CLASS); |
| 77 | + out.write(yytext()); |
| 78 | + disjointSpan(null); |
| 79 | + } |
78 | 80 |
|
79 |
| - \" { yybegin(STRING);out.write("<span class=\"s\">\"");} |
80 |
| - ";" { yybegin(SCOMMENT);out.write("<span class=\"c\">;");} |
| 81 | + \" { |
| 82 | + pushSpan(STRING, HtmlConsts.STRING_CLASS); |
| 83 | + out.write(htmlize(yytext())); |
| 84 | + } |
| 85 | + ";" { |
| 86 | + pushSpan(SCOMMENT, HtmlConsts.COMMENT_CLASS); |
| 87 | + out.write(yytext()); |
| 88 | + } |
81 | 89 | }
|
82 | 90 |
|
83 | 91 | <STRING> {
|
84 |
| - \" {WhiteSpace} \" { out.write(yytext()); } |
85 |
| - \" { yybegin(YYINITIAL); out.write("\"</span>"); } |
86 |
| - \\\\ { out.write("\\\\"); } |
87 |
| - \\\" { out.write("\\\""); } |
| 92 | + \" {WhiteSpace} \" | |
| 93 | + \\[\"\\] { out.write(htmlize(yytext())); } |
| 94 | + \" { |
| 95 | + out.write(htmlize(yytext())); |
| 96 | + yypop(); |
| 97 | + } |
88 | 98 | }
|
89 | 99 |
|
90 | 100 | <YYINITIAL, COMMENT> {
|
91 |
| - "#|" { yybegin(COMMENT); |
92 |
| - if (nestedComment++ == 0) { out.write("<span class=\"c\">"); } |
93 |
| - out.write("#|"); |
94 |
| - } |
| 101 | + "#|" { |
| 102 | + if (nestedComment++ == 0) { |
| 103 | + pushSpan(COMMENT, HtmlConsts.COMMENT_CLASS); |
| 104 | + } |
| 105 | + out.write(yytext()); |
95 | 106 | }
|
| 107 | +} |
96 | 108 |
|
97 | 109 | <COMMENT> {
|
98 |
| - "|#" { out.write("|#"); |
99 |
| - if (--nestedComment == 0) { |
100 |
| - yybegin(YYINITIAL); |
101 |
| - out.write("</span>"); |
102 |
| - } |
103 |
| - } |
| 110 | + "|#" { |
| 111 | + out.write(yytext()); |
| 112 | + if (--nestedComment == 0) { |
| 113 | + yypop(); |
| 114 | + } |
| 115 | + } |
104 | 116 | }
|
105 | 117 |
|
106 | 118 | <SCOMMENT> {
|
107 | 119 | {WhspChar}*{EOL} {
|
108 |
| - yybegin(YYINITIAL); out.write("</span>"); |
| 120 | + yypop(); |
109 | 121 | startNewLine();
|
110 | 122 | }
|
111 | 123 | }
|
112 | 124 |
|
113 | 125 | <YYINITIAL, STRING, COMMENT, SCOMMENT> {
|
114 |
| -"&" {out.write( "&");} |
115 |
| -"<" {out.write( "<");} |
116 |
| -">" {out.write( ">");} |
| 126 | +[&<>\'\"] { out.write(htmlize(yytext())); } |
| 127 | + |
117 | 128 | {WhspChar}*{EOL} { startNewLine(); }
|
118 | 129 | {WhiteSpace} { out.write(yytext()); }
|
119 | 130 | [!-~] { out.write(yycharat(0)); }
|
|
0 commit comments