Skip to content

Commit 8cc4a83

Browse files
committed
Fix not to enter redundant span-class-s
1 parent cf01704 commit 8cc4a83

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/org/opensolaris/opengrok/analysis/perl/PerlLexHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,11 @@ public boolean maybeStartHere() throws IOException {
431431
public boolean maybeEndHere(String capture) throws IOException {
432432
String trimmed = capture.replaceFirst("^\\s+", "");
433433
HereDocSettings settings = hereSettings.peek();
434+
435+
boolean didZspan = false;
434436
if (trimmed.equals(settings.terminator)) {
435437
listener.take(Consts.ZS);
438+
didZspan = true;
436439
hereSettings.remove();
437440
}
438441

@@ -441,7 +444,7 @@ public boolean maybeEndHere(String capture) throws IOException {
441444
if (hereSettings.size() > 0) {
442445
settings = hereSettings.peek();
443446
listener.switchState(settings.state);
444-
listener.take(Consts.SS);
447+
if (didZspan) listener.take(Consts.SS);
445448
return false;
446449
} else {
447450
listener.popState();

test/org/opensolaris/opengrok/analysis/perl/sample.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ ($)
134134
bar
135135

136136
myfunc(<< "THIS", 23, <<'THAT');
137-
Here's a line
138-
or two.
137+
Here's a line or
138+
two
139139
THIS
140140
and here's another.
141141
THAT

test/org/opensolaris/opengrok/analysis/perl/samplexrefres.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@
141141
<a class="l" name="134" href="#134">134</a><span class="s"></span>bar
142142
<a class="l" name="135" href="#135">135</a>
143143
<a class="l" name="136" href="#136">136</a><a href="/source/s?defs=myfunc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">myfunc</a>(&lt;&lt; &quot;THIS&quot;, <span class="n">23</span>, &lt;&lt;&apos;THAT&apos;);<span class="s"></span>
144-
<a class="l" name="137" href="#137">137</a><span class="s">Here&apos;s a line</span>
145-
<a class="l" name="138" href="#138">138</a><span class="s">or two.</span>
144+
<a class="l" name="137" href="#137">137</a><span class="s">Here&apos;s a line or</span>
145+
<a class="l" name="138" href="#138">138</a><span class="s">two</span>
146146
<a class="l" name="139" href="#139">139</a><span class="s"></span>THIS<span class="s"></span>
147147
<a class="hl" name="140" href="#140">140</a><span class="s">and here&apos;s another.</span>
148148
<a class="l" name="141" href="#141">141</a><span class="s"></span>THAT

testdata/sources/perl/main.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ ($)
134134
bar
135135

136136
myfunc(<< "THIS", 23, <<'THAT');
137-
Here's a line
138-
or two.
137+
Here's a line or
138+
two
139139
THIS
140140
and here's another.
141141
THAT

0 commit comments

Comments
 (0)