JFlexXref.java revision 1020
883N/A * The contents of this file are subject to the terms of the 883N/A * Common Development and Distribution License (the "License"). 883N/A * You may not use this file except in compliance with the License. 883N/A * language governing permissions and limitations under the License. 883N/A * When distributing Covered Code, include this CDDL HEADER in each 883N/A * If applicable, add the following below this CDDL HEADER, with the 883N/A * fields enclosed by brackets "[]" replaced with your own identifying 883N/A * information: Portions Copyright [yyyy] [name of copyright owner] 883N/A * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 883N/A * Use is subject to license terms. 883N/A * Base class for Xref lexers. 883N/A /** EOF value returned by yylex(). */ 883N/A // TODO when bug #16053 is fixed, we should add a getter to a file 883N/A // that's included from all the Xref classes so that we avoid the // 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 /** Get the next token from the scanner. */ /** Get the value of {@code yyline}. */ /** Set the value of {@code yyline}. */ * Write xref to the specified {@code Writer}. * @param out xref destination * @throws IOException on error when writing the xref while (
yylex() !=
yyeof) {
// NOPMD while statement intentionally empty // nothing to do here, yylex() will do the work * 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 * 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 // 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 // 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. // 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