• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oracle / opengrok / #3691

09 Nov 2023 04:15PM UTC coverage: 74.721% (+8.6%) from 66.08%
#3691

push

web-flow
avoid annotations for binary files (#4476)

fixes #4473

6 of 13 new or added lines in 4 files covered. (46.15%)

258 existing lines in 28 files now uncovered.

43797 of 58614 relevant lines covered (74.72%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.65
/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaLexer.java
1
/*
2
 * CDDL HEADER START
3
 *
4
 * The contents of this file are subject to the terms of the
5
 * Common Development and Distribution License (the "License").
6
 * You may not use this file except in compliance with the License.
7
 *
8
 * See LICENSE.txt included in this distribution for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing Covered Code, include this CDDL HEADER in each
12
 * file and include the License file at LICENSE.txt.
13
 * If applicable, add the following below this CDDL HEADER, with the
14
 * fields enclosed by brackets "[]" replaced with your own identifying
15
 * information: Portions Copyright [yyyy] [name of copyright owner]
16
 *
17
 * CDDL HEADER END
18
 */
19

20
 /*
21
 * Copyright (c) 2017, 2019, Chris Fraire <cfraire@me.com>.
22
 */
23
package org.opengrok.indexer.analysis.ada;
24

25
import java.io.IOException;
26

27
import org.opengrok.indexer.analysis.JFlexJointLexer;
28
import org.opengrok.indexer.analysis.JFlexSymbolMatcher;
29
import org.opengrok.indexer.analysis.Resettable;
30

31
/**
32
 * Represents an abstract base class for Ada lexers.
33
 */
34
abstract class AdaLexer extends JFlexSymbolMatcher
1✔
35
        implements JFlexJointLexer, Resettable {
36

37
    /**
38
     * Writes {@code value} to output -- if it contains any EOLs then the
39
     * {@link JFlexJointLexer#startNewLine()} is called in lieu of outputting
40
     * EOL.
41
     */
42
    public void takeLiteral(String value, String className)
43
            throws IOException {
44

45
        disjointSpan(className);
1✔
46

47
        int off = 0;
1✔
48
        do {
49
            int w = 1;
1✔
50
            int i;
51
            int ri = value.indexOf("\r", off);
1✔
52
            int ni = value.indexOf("\n", off);
1✔
53
            if (ri == -1 && ni == -1) {
1✔
54
                String sub = value.substring(off);
1✔
55
                offer(sub);
1✔
56
                break;
1✔
57
            }
58
            if (ri != -1 && ni != -1) {
1✔
UNCOV
59
                if (ri < ni) {
×
UNCOV
60
                    i = ri;
×
UNCOV
61
                    if (value.charAt(ri) == '\r' && value.charAt(ni) == '\n') {
×
UNCOV
62
                        w = 2;
×
63
                    }
64
                } else {
65
                    i = ni;
×
66
                }
67
            } else if (ri != -1) {
1✔
68
                i = ri;
×
69
            } else {
70
                i = ni;
1✔
71
            }
72

73
            String sub = value.substring(off, i);
1✔
74
            offer(sub);
1✔
75
            disjointSpan(null);
1✔
76
            startNewLine();
1✔
77
            disjointSpan(className);
1✔
78
            off = i + w;
1✔
79
        } while (off < value.length());
1✔
80

81
        disjointSpan(null);
1✔
82
    }
1✔
83

84
    /**
85
     * Calls {@link #phLOC()} if the yystate is not SCOMMENT.
86
     */
87
    public void chkLOC() {
88
        if (yystate() != SCOMMENT()) {
1✔
89
            phLOC();
1✔
90
        }
91
    }
1✔
92

93
    /**
94
     * Subclasses must override to get the constant value created by JFlex to
95
     * represent SCOMMENT.
96
     */
97
    @SuppressWarnings("java:S100")
98
    abstract int SCOMMENT();
99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc