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 24 package org.opengrok.indexer.analysis.eiffel; 25 26 import java.io.IOException; 27 import java.util.Set; 28 import org.opengrok.indexer.web.HtmlConsts; 29 %% 30 %public 31 %class EiffelXref 32 %extends EiffelLexer 33 %char 34 %unicode 35 %ignorecase 36 %int 37 %include ../CommonLexer.lexh 38 %include ../CommonXref.lexh 39 %{ 40 @Override offer(String value)41 public void offer(String value) throws IOException { 42 onNonSymbolMatched(value, yychar); 43 } 44 45 @Override offerSymbol(String value,int captureOffset,boolean ignoreKwd)46 public boolean offerSymbol(String value, int captureOffset, 47 boolean ignoreKwd) throws IOException { 48 Set<String> keywords = ignoreKwd ? null : Consts.kwd; 49 return onFilteredSymbolMatched(value, yychar, keywords, false); 50 } 51 52 @Override skipSymbol()53 public void skipSymbol() { 54 // noop 55 } 56 57 @Override offerKeyword(String value)58 public void offerKeyword(String value) throws IOException { 59 onKeywordMatched(value, yychar); 60 } 61 62 @Override startNewLine()63 public void startNewLine() throws IOException { 64 onEndOfLineMatched("\n", yychar); 65 } 66 67 @Override disjointSpan(String className)68 public void disjointSpan(String className) throws IOException { 69 onDisjointSpanChanged(className, yychar); 70 } 71 takeAllContent()72 protected boolean takeAllContent() { 73 return true; 74 } 75 returnOnSymbol()76 protected boolean returnOnSymbol() { 77 return false; 78 } 79 80 /** 81 * Gets the constant value created by JFlex to represent SCOMMENT. 82 */ 83 @Override SCOMMENT()84 int SCOMMENT() { return SCOMMENT; } 85 86 /** 87 * Gets the constant value created by JFlex to represent VSTRING. 88 */ 89 @Override VSTRING()90 int VSTRING() { return VSTRING; } 91 %} 92 93 /* 94 * SCOMMENT : single-line comment 95 * STRING : basic manifest string (literal) 96 * VSTRING : verbatim manifest string (literal) 97 */ 98 %state SCOMMENT STRING VSTRING 99 100 %include ../Common.lexh 101 %include ../CommonURI.lexh 102 %include EiffelProductions.lexh 103