@@ -52,15 +52,15 @@ private[html] object SyntaxHigh {
52
52
" Triple" , " TypeTag" , " Unit" )
53
53
54
54
def apply (data : String ): NodeSeq = {
55
- val buf = data.getBytes
55
+ val buf = data.toCharArray
56
56
val out = new StringBuilder
57
57
58
58
def compare (offset : Int , key : String ): Int = {
59
59
var i = offset
60
60
var j = 0
61
61
val l = key.length
62
62
while (i < buf.length && j < l) {
63
- val bch = buf(i).toChar
63
+ val bch = buf(i)
64
64
val kch = key charAt j
65
65
if (bch < kch) return - 1
66
66
else if (bch > kch) return 1
@@ -94,13 +94,13 @@ private[html] object SyntaxHigh {
94
94
def line (i : Int ): Int =
95
95
if (i == buf.length || buf(i) == '\n ' ) i
96
96
else {
97
- out append buf(i).toChar
97
+ out append buf(i)
98
98
line(i+ 1 )
99
99
}
100
100
var level = 0
101
101
def multiline (i : Int , star : Boolean ): Int = {
102
102
if (i == buf.length) return i
103
- val ch = buf(i).toChar
103
+ val ch = buf(i)
104
104
out append ch
105
105
ch match {
106
106
case '*' =>
@@ -127,7 +127,7 @@ private[html] object SyntaxHigh {
127
127
if (i == buf.length) i
128
128
else if (i > j+ 6 ) { out setLength 0 ; j }
129
129
else {
130
- val ch = buf(i).toChar
130
+ val ch = buf(i)
131
131
out append ch
132
132
ch match {
133
133
case '\\ ' =>
@@ -148,7 +148,7 @@ private[html] object SyntaxHigh {
148
148
val out = new StringBuilder (" \" " )
149
149
def strlit0 (i : Int , bslash : Boolean ): Int = {
150
150
if (i == buf.length) return i
151
- val ch = buf(i).toChar
151
+ val ch = buf(i)
152
152
out append ch
153
153
ch match {
154
154
case '\\ ' =>
@@ -167,7 +167,7 @@ private[html] object SyntaxHigh {
167
167
val out = new StringBuilder
168
168
def intg (i : Int ): Int = {
169
169
if (i == buf.length) return i
170
- val ch = buf(i).toChar
170
+ val ch = buf(i)
171
171
ch match {
172
172
case '.' =>
173
173
out append ch
@@ -181,7 +181,7 @@ private[html] object SyntaxHigh {
181
181
}
182
182
def frac (i : Int ): Int = {
183
183
if (i == buf.length) return i
184
- val ch = buf(i).toChar
184
+ val ch = buf(i)
185
185
ch match {
186
186
case 'e' | 'E' =>
187
187
out append ch
@@ -195,7 +195,7 @@ private[html] object SyntaxHigh {
195
195
}
196
196
def expo (i : Int , signed : Boolean ): Int = {
197
197
if (i == buf.length) return i
198
- val ch = buf(i).toChar
198
+ val ch = buf(i)
199
199
ch match {
200
200
case '+' | '-' if ! signed =>
201
201
out append ch
@@ -222,7 +222,7 @@ private[html] object SyntaxHigh {
222
222
case '&' =>
223
223
parse(" &" , i+ 1 )
224
224
case '<' if i+ 1 < buf.length =>
225
- val ch = buf(i+ 1 ).toChar
225
+ val ch = buf(i+ 1 )
226
226
if (ch == '-' || ch == ':' || ch == '%' )
227
227
parse(" <span class=\" kw\" ><" + ch+ " </span>" , i+ 2 )
228
228
else
@@ -236,19 +236,19 @@ private[html] object SyntaxHigh {
236
236
if (i+ 1 < buf.length && buf(i+ 1 ) == '>' )
237
237
parse(" <span class=\" kw\" >=></span>" , i+ 2 )
238
238
else
239
- parse(buf(i).toChar. toString, i+ 1 )
239
+ parse(buf(i).toString, i+ 1 )
240
240
case '/' =>
241
241
if (i+ 1 < buf.length && (buf(i+ 1 ) == '/' || buf(i+ 1 ) == '*' )) {
242
242
val c = comment(i+ 1 )
243
243
parse(" <span class=\" cmt\" >" + c+ " </span>" , i+ c.length)
244
244
} else
245
- parse(buf(i).toChar. toString, i+ 1 )
245
+ parse(buf(i).toString, i+ 1 )
246
246
case '\' ' =>
247
247
val s = charlit(i+ 1 )
248
248
if (s.length > 0 )
249
249
parse(" <span class=\" lit\" >" + s+ " </span>" , i+ s.length)
250
250
else
251
- parse(buf(i).toChar. toString, i+ 1 )
251
+ parse(buf(i).toString, i+ 1 )
252
252
case '"' =>
253
253
val s = strlit(i+ 1 )
254
254
parse(" <span class=\" lit\" >" + s+ " </span>" , i+ s.length)
@@ -257,9 +257,9 @@ private[html] object SyntaxHigh {
257
257
if (k >= 0 )
258
258
parse(" <span class=\" ano\" >@" + annotations(k)+ " </span>" , i+ annotations(k).length+ 1 )
259
259
else
260
- parse(buf(i).toChar. toString, i+ 1 )
260
+ parse(buf(i).toString, i+ 1 )
261
261
case _ =>
262
- if (i == 0 || (i >= 1 && ! Character .isJavaIdentifierPart(buf(i- 1 ).toChar ))) {
262
+ if (i == 0 || (i >= 1 && ! Character .isJavaIdentifierPart(buf(i- 1 )))) {
263
263
if (Character .isDigit(buf(i).toInt) ||
264
264
(buf(i) == '.' && i + 1 < buf.length && Character .isDigit(buf(i+ 1 ).toInt))) {
265
265
val s = numlit(i)
@@ -273,11 +273,11 @@ private[html] object SyntaxHigh {
273
273
if (k >= 0 )
274
274
parse(" <span class=\" std\" >" + standards(k)+ " </span>" , i+ standards(k).length)
275
275
else
276
- parse(buf(i).toChar. toString, i+ 1 )
276
+ parse(buf(i).toString, i+ 1 )
277
277
}
278
278
}
279
279
} else
280
- parse(buf(i).toChar. toString, i+ 1 )
280
+ parse(buf(i).toString, i+ 1 )
281
281
}
282
282
}
283
283
0 commit comments