@@ -111,7 +111,6 @@ import org.opensolaris.opengrok.web.Util;
111
111
char opc = ltpostop. charAt(0 );
112
112
setEndQuoteChar(opc);
113
113
setState(ltpostop, nointerp);
114
- // return htmlize(boundary + opname) + Ss + htmlize(postop);
115
114
116
115
if (doWrite) {
117
116
out. write(htmlize(boundary));
@@ -260,6 +259,22 @@ import org.opensolaris.opengrok.web.Util;
260
259
return trimmed. equals(hereTerminator);
261
260
}
262
261
262
+ // Splits `capture' on {EOL} and sets value1 to the left-side and value2 to
263
+ // the right-side, dropping the {EOL}.
264
+ void splitEol(String capture)
265
+ {
266
+ int i;
267
+ if ((i = capture. indexOf(" \n " )) == - 1 ) {
268
+ value1 = capture;
269
+ value2 = " " ;
270
+ return ;
271
+ }
272
+ value1 = capture. substring(0 , i);
273
+ if (value1. endsWith(" \r " ))
274
+ value1 = value1. substring(0 , value1. length() - 1 );
275
+ value2 = capture. substring(i + 1 );
276
+ }
277
+
263
278
final static String Sc = " <span class=\" c\" >" ;
264
279
final static String Sn = " <span class=\" n\" >" ;
265
280
final static String Ss = " <span class=\" s\" >" ;
@@ -358,6 +373,9 @@ Mwords_2 = ("if" | "unless" | "or" | "and" | "not")
358
373
Mwords_3 = ( "split" )
359
374
Mwords = ( {Mwords_1} | {Mwords_2} | {Mwords_3} )
360
375
376
+ Mpunc1YYIN = [ \(\! ]
377
+ Mpunc2IN = ( [ !=] "~" | [ \:\?\=\+\-\<\> ] | "==" | "!=" | "<=" | ">=" | "<=>" | "&&" | "||" )
378
+
361
379
//
362
380
// There are two dimensions to quoting: "link"-or-not and "interpolate"-or-not.
363
381
// Unfortunately, we cannot control the %state values, so we have to declare
@@ -508,16 +526,26 @@ Mwords = ({Mwords_1} | {Mwords_2} | {Mwords_3})
508
526
// first slash cannot always be distinguished from division (/) without
509
527
// true parsing.
510
528
511
- [ \(\! ] {MaybeWhsp} "/" { hqop(yytext()); }
529
+ {Mpunc1YYIN} {MaybeWhsp} "/" { hqop(yytext()); }
530
+
531
+ {Mpunc1YYIN} {MaybeWhsp}{EOL}{MaybeWhsp} "/" {
532
+ splitEol(yytext());
533
+ out. write(htmlize(value1));
534
+ startNewLine();
535
+ hqop(value2);
536
+ }
512
537
}
513
538
514
539
<INTRA> {
515
540
// Continue with more punctuation heuristics
516
541
517
- [ !=] "~" {MaybeWhsp} "/" |
518
- [ \:\?\=\+\-\<\> ] {MaybeWhsp} "/" |
519
- ( "==" | "!=" | "<=" | ">=" | "<=>" | "&&" | "||" ) {MaybeWhsp} "/" {
520
- hqop(yytext());
542
+ {Mpunc2IN} {MaybeWhsp} "/" { hqop(yytext()); }
543
+
544
+ {Mpunc2IN} {MaybeWhsp}{EOL}{MaybeWhsp} "/" {
545
+ splitEol(yytext());
546
+ out. write(htmlize(value1));
547
+ startNewLine();
548
+ hqop(value2);
521
549
}
522
550
}
523
551
0 commit comments