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 package org.opengrok.indexer.analysis.sql; 24 25 import java.util.Set; 26 27 /** 28 * Represents an abstract base class for SQL xrefers of various dialects. 29 */ 30 abstract class JointSQLXref extends JointSQLLexer { 31 32 @Override offer(String value)33 public void offer(String value) { 34 onNonSymbolMatched(value, getYYCHAR()); 35 } 36 37 @Override offerSymbol(String value, int captureOffset, boolean ignoreKwd)38 public boolean offerSymbol(String value, int captureOffset, boolean ignoreKwd) { 39 Set<String> keywords = ignoreKwd ? null : getDialectKeywords(); 40 return onFilteredSymbolMatched(value, getYYCHAR(), keywords, false); 41 } 42 43 /** noop. */ 44 @Override skipSymbol()45 public void skipSymbol() { 46 } 47 48 @Override offerKeyword(String value)49 public void offerKeyword(String value) { 50 onKeywordMatched(value, getYYCHAR()); 51 } 52 53 @Override startNewLine()54 public void startNewLine() { 55 onEndOfLineMatched("\n", getYYCHAR()); 56 } 57 58 @Override disjointSpan(String className)59 public void disjointSpan(String className) { 60 onDisjointSpanChanged(className, getYYCHAR()); 61 } 62 63 /** Gets the value {@code true}. */ takeAllContent()64 protected boolean takeAllContent() { 65 return true; 66 } 67 68 /** Gets the value {@code false}. */ returnOnSymbol()69 protected boolean returnOnSymbol() { 70 return false; 71 } 72 } 73