xref: /OpenGrok/opengrok-indexer/src/main/jflex/analysis/verilog/VerilogXref.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) 2019, Chris Fraire <cfraire@me.com>.
22  */
23 
24 package org.opengrok.indexer.analysis.verilog;
25 
26 import java.io.IOException;
27 import java.util.Set;
28 import org.opengrok.indexer.web.HtmlConsts;
29 %%
30 %public
31 %class VerilogXref
32 %extends VerilogLexer
33 %char
34 %unicode
35 %int
36 %include ../CommonLexer.lexh
37 %include ../CommonXref.lexh
38 %{
39     @Override
offer(String value)40     public void offer(String value) throws IOException {
41         onNonSymbolMatched(value, yychar);
42     }
43 
44     @Override
offerSymbol(String value,int captureOffset,boolean ignoreKwd)45     public boolean offerSymbol(String value, int captureOffset,
46             boolean ignoreKwd) throws IOException {
47         Set<String> keywords = ignoreKwd ? null : Consts.kwd;
48         return onFilteredSymbolMatched(value, yychar, keywords, true);
49     }
50 
51     @Override
skipSymbol()52     public void skipSymbol() {
53         // noop
54     }
55 
56     @Override
offerKeyword(String value)57     public void offerKeyword(String value) throws IOException {
58         onKeywordMatched(value, yychar);
59     }
60 
61     @Override
startNewLine()62     public void startNewLine() throws IOException {
63         onEndOfLineMatched("\n", yychar);
64     }
65 
66     @Override
disjointSpan(String className)67     public void disjointSpan(String className) throws IOException {
68         onDisjointSpanChanged(className, yychar);
69     }
70 
takeAllContent()71     protected boolean takeAllContent() {
72         return true;
73     }
74 
returnOnSymbol()75     protected boolean returnOnSymbol() {
76         return false;
77     }
78 
79     /**
80      * Gets the constant value created by JFlex to represent COMMENT.
81      */
82     @Override
COMMENT()83     int COMMENT() { return COMMENT; }
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 VerilogProductions.lexh
95