xref: /OpenGrok/opengrok-indexer/src/main/jflex/analysis/ada/AdaXref.lex (revision d219b4cea555a12b602d2d5518daa22134ad4879)
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) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
22  * Portions Copyright (c) 2017, 2019, Chris Fraire <cfraire@me.com>.
23  */
24 
25 /*
26  * Cross reference an Ada file
27  */
28 
29 package org.opengrok.indexer.analysis.ada;
30 
31 import java.io.IOException;
32 import java.util.Set;
33 import org.opengrok.indexer.web.HtmlConsts;
34 %%
35 %public
36 %class AdaXref
37 %extends AdaLexer
38 %unicode
39 %ignorecase
40 %int
41 %char
42 %include ../CommonLexer.lexh
43 %include ../CommonXref.lexh
44 %{
45     @Override
offer(String value)46     public void offer(String value) throws IOException {
47         onNonSymbolMatched(value, yychar);
48     }
49 
50     @Override
offerSymbol(String value,int captureOffset,boolean ignoreKwd)51     public boolean offerSymbol(String value, int captureOffset,
52             boolean ignoreKwd) throws IOException {
53         Set<String> keywords = ignoreKwd ? null : Consts.kwd;
54         return onFilteredSymbolMatched(value, yychar, keywords, false);
55     }
56 
57     @Override
skipSymbol()58     public void skipSymbol() {
59         // noop
60     }
61 
62     @Override
offerKeyword(String value)63     public void offerKeyword(String value) throws IOException {
64         onKeywordMatched(value, yychar);
65     }
66 
67     @Override
startNewLine()68     public void startNewLine() throws IOException {
69         onEndOfLineMatched("\n", yychar);
70     }
71 
72     @Override
disjointSpan(String className)73     public void disjointSpan(String className) throws IOException {
74         onDisjointSpanChanged(className, yychar);
75     }
76 
takeAllContent()77     protected boolean takeAllContent() {
78         return true;
79     }
80 
returnOnSymbol()81     protected boolean returnOnSymbol() {
82         return false;
83     }
84 
85     /**
86      * Gets the constant value created by JFlex to represent SCOMMENT.
87      */
88     @Override
SCOMMENT()89     int SCOMMENT() { return SCOMMENT; }
90 %}
91 
92 %include ../Common.lexh
93 %include ../CommonURI.lexh
94 %include ../CommonPath.lexh
95 %include AdaProductions.lexh
96