JFlexXref.java revision 1439
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Portions Copyright 2011 Jens Elkner.
*/
/**
* Base class for Xref lexers.
*
* @author Lubos Kosco
*/
public abstract class JFlexXref {
public Annotation annotation;
protected Definitions defs;
/** EOF value returned by yylex(). */
private final int yyeof;
/** See {@link RuntimeEnvironment#getUserPage()}. Per default initialized
* in the constructor and here to be consistent and avoid lot of
* unnecessary lookups.
* @see #startNewLine() */
protected String userPageLink;
/** See {@link RuntimeEnvironment#getUserPageSuffix()}. Per default
* initialized in the constructor and here to be consistent and avoid lot of
* unnecessary lookups.
* @see #startNewLine() */
protected String userPageSuffix;
/**
* Description of the style to use for a type of definitions.
*/
private static class Style {
/** Name of the style definition as given by CTags. */
/** Class name used by the style sheets when rendering the xref. */
/**
* The title of the section to which this type belongs, or {@code null}
* if this type should not be listed in the navigation panel.
*/
/** Construct a style description. */
}
}
/**
* Description of styles to use for different types of definitions.
*/
private static final Style[] DEFINITION_STYLES = {
};
protected JFlexXref() {
try {
// TODO when bug #16053 is fixed, we should add a getter to a file
// that's included from all the Xref classes so that we avoid the
// reflection.
userPageLink = null;
}
}
} catch (Exception e) {
// The auto-generated constructors for the Xref classes don't
// expect a checked exception, so wrap it in an AssertionError.
// This should never happen, since all the Xref classes will get
// a public static YYEOF field from JFlex.
throw ae; // NOPMD (stack trace is preserved by initCause(), but
// PMD thinks it's lost)
}
}
/**
* Reinitialize the xref with new contents.
*
* @param contents a char buffer with text to analyze
* @param length the number of characters to use from the char buffer
*/
annotation = null;
}
}
protected void appendProject() throws IOException {
}
}
protected String getProjectPostfix() {
}
/** Get the next token from the scanner. */
public abstract int yylex() throws IOException;
/** Reset the scanner. */
/** Get the value of {@code yyline}. */
protected abstract int getLineNumber();
/** Set the value of {@code yyline}. */
protected abstract void setLineNumber(int x);
public abstract int yystate();
/**
* Write xref to the specified {@code Writer}.
*
* @param out xref destination
* @throws IOException on error when writing the xref
*/
setLineNumber(0);
startNewLine();
// nothing to do here, yylex() will do the work
}
}
/**
* Write a JavaScript function that returns an array with the definitions
* to list in the navigation panel. Each element of the array is itself an
* array containing the name of the definition type, the CSS class name for
* the type, and an array of (symbol, line) pairs for the definitions of
* that type.
*/
private void writeSymbolTable() throws IOException {
// No definitions, no symbol table to write
return;
}
// We want the symbol table to be sorted
// Order by symbol name, and then by line number if multiple
// definitions use the same symbol name
if (ret == 0) {
}
return ret;
}
};
}
}
}
boolean first = true;
if (!first) {
}
boolean firstTag = true;
if (!firstTag) {
}
firstTag = false;
}
first = false;
}
}
/* no LF intentionally - xml is whitespace aware ... */
}
/**
* Get the style description for a definition type.
*
* @param type the definition type
* @return the style of a definition type, or {@code null} if no style is
* defined for the type
* @see #DEFINITION_STYLES
*/
return style;
}
}
return null;
}
/**
* Terminate the current line and insert preamble for the next line. The
* line count will be incremented.
*
* @throws IOException on error when writing the xref
*/
protected void startNewLine() throws IOException {
}
/**
* Write a symbol and generate links as appropriate.
*
* @param symbol the symbol to write
* @param keywords a set of keywords recognized by this analyzer (no links
* will be generated if the symbol is a keyword)
* @param line the line number on which the symbol appears
* @throws IOException if an error occurs while writing to the stream
*/
throws IOException {
// This is a keyword, so we don't create a link.
// This is the definition of the symbol.
}
// 1) Create an anchor for direct links. (Perhaps we should only
// do this when there's exactly one definition of the symbol in
// this file? Otherwise, we may end up with multiple anchors with
// the same name.)
// 2) Create a link that searches for all references to this symbol.
// This is a reference to a symbol defined exactly once in this file.
// Generate a direct link to the symbol definition.
} else {
// This is a symbol that is not defined in this file, or a symbol
// that is defined more than once in this file. In either case, we
// can't generate a direct link to the definition, so generate a
// link to search for all definitions of that symbol instead.
}
}
/**
* Write HTML escape sequence for the specified Unicode character, unless
* it's an ISO control character, in which case it is ignored.
*
* @param c the character to write
* @throws IOException if an error occurs while writing to the stream
*/
protected void writeUnicodeChar(char c) throws IOException {
if (!Character.isISOControl(c)) {
}
}
/**
* Write an e-mail address. The address will be obfuscated if
* {@link RuntimeEnvironment#isObfuscatingEMailAddresses()} returns
* {@code true}.
*
* @param address the address to write
* @throws IOException if an error occurs while writing to the stream
*/
} else {
}
}
}
public void yypop() throws IOException {
}
}
}