xref: /OpenGrok/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexJointLexer.java (revision 5d9f3aa0ca3da3a714233f987fa732f62c0965f6)
1b5840353SAdam Hornáček /*
2b5840353SAdam Hornáček  * CDDL HEADER START
3b5840353SAdam Hornáček  *
4b5840353SAdam Hornáček  * The contents of this file are subject to the terms of the
5b5840353SAdam Hornáček  * Common Development and Distribution License (the "License").
6b5840353SAdam Hornáček  * You may not use this file except in compliance with the License.
7b5840353SAdam Hornáček  *
8b5840353SAdam Hornáček  * See LICENSE.txt included in this distribution for the specific
9b5840353SAdam Hornáček  * language governing permissions and limitations under the License.
10b5840353SAdam Hornáček  *
11b5840353SAdam Hornáček  * When distributing Covered Code, include this CDDL HEADER in each
12b5840353SAdam Hornáček  * file and include the License file at LICENSE.txt.
13b5840353SAdam Hornáček  * If applicable, add the following below this CDDL HEADER, with the
14b5840353SAdam Hornáček  * fields enclosed by brackets "[]" replaced with your own identifying
15b5840353SAdam Hornáček  * information: Portions Copyright [yyyy] [name of copyright owner]
16b5840353SAdam Hornáček  *
17b5840353SAdam Hornáček  * CDDL HEADER END
18b5840353SAdam Hornáček  */
19b5840353SAdam Hornáček 
20b5840353SAdam Hornáček /*
21b5840353SAdam Hornáček  * Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
22b5840353SAdam Hornáček  */
23*9805b761SAdam Hornáček package org.opengrok.indexer.analysis;
24b5840353SAdam Hornáček 
25b5840353SAdam Hornáček import java.io.IOException;
26b5840353SAdam Hornáček 
27b5840353SAdam Hornáček /**
28b5840353SAdam Hornáček  * Represents an API for JFlex lexers that produce multiple types of derived
29b5840353SAdam Hornáček  * OpenGrok documents (e.g., cross-reference documents [xrefs] or Lucene search
30b5840353SAdam Hornáček  * documents [tokenizers]) from the same JFlex productions.
31b5840353SAdam Hornáček  */
32b5840353SAdam Hornáček public interface JFlexJointLexer extends JFlexStackingLexer {
33b5840353SAdam Hornáček 
34b5840353SAdam Hornáček     /**
35b5840353SAdam Hornáček      * Passes non-symbolic fragment for processing.
36b5840353SAdam Hornáček      * @param value the excised fragment
37b5840353SAdam Hornáček      * @throws IOException if an error occurs while accepting
38b5840353SAdam Hornáček      */
offer(String value)39b5840353SAdam Hornáček     void offer(String value) throws IOException;
40b5840353SAdam Hornáček 
41b5840353SAdam Hornáček     /**
42b5840353SAdam Hornáček      * Passes a text fragment that is syntactically a symbol for processing.
43b5840353SAdam Hornáček      * @param value the excised symbol
44b5840353SAdam Hornáček      * @param captureOffset the offset from yychar where {@code value} began
45b5840353SAdam Hornáček      * @param ignoreKwd a value indicating whether keywords should be ignored
46b5840353SAdam Hornáček      * @return true if the {@code value} was not in keywords or if the
47b5840353SAdam Hornáček      * {@code ignoreKwd} was true
48b5840353SAdam Hornáček      * @throws IOException if an error occurs while accepting
49b5840353SAdam Hornáček      */
offerSymbol(String value, int captureOffset, boolean ignoreKwd)50b5840353SAdam Hornáček     boolean offerSymbol(String value, int captureOffset, boolean ignoreKwd)
51b5840353SAdam Hornáček         throws IOException;
52b5840353SAdam Hornáček 
53b5840353SAdam Hornáček     /**
54b5840353SAdam Hornáček      * Indicates that something unusual happened where normally a symbol would
55b5840353SAdam Hornáček      * have been offered.
56b5840353SAdam Hornáček      */
skipSymbol()57b5840353SAdam Hornáček     void skipSymbol();
58b5840353SAdam Hornáček 
59b5840353SAdam Hornáček     /**
60b5840353SAdam Hornáček      * Passes a text fragment that is syntactically a keyword symbol for
61b5840353SAdam Hornáček      * processing.
62b5840353SAdam Hornáček      * @param value the excised symbol
63b5840353SAdam Hornáček      * @throws IOException if an error occurs while accepting
64b5840353SAdam Hornáček      */
offerKeyword(String value)65b5840353SAdam Hornáček     void offerKeyword(String value) throws IOException;
66b5840353SAdam Hornáček 
67b5840353SAdam Hornáček     /**
68b5840353SAdam Hornáček      * Indicates that the current line is ended.
69b5840353SAdam Hornáček      * @throws IOException if an error occurs when handling the EOL
70b5840353SAdam Hornáček      */
startNewLine()71b5840353SAdam Hornáček     void startNewLine() throws IOException;
72b5840353SAdam Hornáček 
73b5840353SAdam Hornáček     /**
74b5840353SAdam Hornáček      * Indicates the closing of an open tag and the opening -- if
75b5840353SAdam Hornáček      * {@code className} is non-null -- of a new one.
76b5840353SAdam Hornáček      * @param className the class name for the new tag or {@code null} just to
77b5840353SAdam Hornáček      * close an open tag.
78b5840353SAdam Hornáček      * @throws IOException if an output error occurs
79b5840353SAdam Hornáček      */
disjointSpan(String className)80b5840353SAdam Hornáček     void disjointSpan(String className) throws IOException;
81b5840353SAdam Hornáček 
82b5840353SAdam Hornáček     /**
83b5840353SAdam Hornáček      * Indicates that eligible source code was encountered for physical
84b5840353SAdam Hornáček      * lines-of-code count (physical LOC).
85b5840353SAdam Hornáček      */
phLOC()86b5840353SAdam Hornáček     void phLOC();
87b5840353SAdam Hornáček }
88