JFlexXref.java revision 1185
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * language governing permissions and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 119N/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * Portions Copyright 2011 Jens Elkner. 0N/A * Base class for Xref lexers. 0N/A * @author Lubos Kosco 65N/A /** EOF value returned by yylex(). */ 30N/A /** See {@link RuntimeEnvironment#getUserPage()}. Per default initialized 58N/A * in the constructor and here to be consistent and avoid lot of 112N/A * @see #startNewLine() */ 0N/A /** See {@link RuntimeEnvironment#getUserPageSuffix()}. Per default 0N/A * initialized in the constructor and here to be consistent and avoid lot of 0N/A * @see #startNewLine() */ 0N/A * Description of styles to use for different types of definitions. Each 11N/A * element in the array contains a three-element string array with the 0N/A * following values: (0) the name of the style definition type given by 240N/A * CTags, (1) the class name used by the style sheets when rendering the 58N/A * xref, and (2) the title of the section listing symbols of this type 58N/A * in the xref's navigation panel, or {@code null} if this type should not 58N/A * be included in the navigation panel. 207N/A {
"macro",
"xm",
"Macro"},
260N/A {
"variable",
"xv",
"Variable"},
77N/A {
"class",
"xc",
"Class"},
260N/A {
"package",
"xp",
"Package"},
112N/A {
"interface",
"xi",
"Interface"},
77N/A {
"namespace",
"xn",
"Namespace"},
77N/A {
"enum",
"xe",
"Enum"},
77N/A {
"struct",
"xs",
"Struct"},
77N/A {
"typedef",
"xt",
"Typedef"},
77N/A {
"function",
"xf",
"Function"},
111N/A {
"method",
"xmt",
"Method"},
111N/A {
"subroutine",
"xsr",
"Subroutine"},
111N/A // TODO when bug #16053 is fixed, we should add a getter to a file 111N/A // that's included from all the Xref classes so that we avoid the 77N/A // The auto-generated constructors for the Xref classes don't 77N/A // expect a checked exception, so wrap it in an AssertionError. 77N/A // This should never happen, since all the Xref classes will get 77N/A // a public static YYEOF field from JFlex. 77N/A throw ae;
// NOPMD (stack trace is preserved by initCause(), but 77N/A // PMD thinks it's lost) 77N/A * Reinitialize the xref with new contents. 77N/A * @param contents a char buffer with text to analyze 77N/A * @param length the number of characters to use from the char buffer 173N/A /** Get the next token from the scanner. */ 253N/A /** Reset the scanner. */ 253N/A /** Get the value of {@code yyline}. */ 253N/A /** Set the value of {@code yyline}. */ 99N/A * Write xref to the specified {@code Writer}. 77N/A * @param out xref destination 77N/A * @throws IOException on error when writing the xref 77N/A while (
yylex() !=
yyeof) {
// NOPMD while statement intentionally empty 77N/A // nothing to do here, yylex() will do the work 112N/A * Write a JavaScript function that returns an array with the definitions 112N/A * to list in the navigation panel. Each element of the array is itself an 77N/A * array containing the name of the definition type, the CSS class name for 106N/A * the type, and an array of (symbol, line) pairs for the definitions of 119N/A // No definitions, no symbol table to write 106N/A // We want the symbol table to be sorted 99N/A // Order by symbol name, and then by line number if multiple 99N/A // definitions use the same symbol name 261N/A /* no LF intentionally - xml is whitespace aware ... */ 296N/A * Get the style description for a definition type. 296N/A * @param type the definition type 296N/A * @return a three element string array that describes the style of a 296N/A * definition type (name of type, CSS style class, title in the navigation 296N/A * @see #DEFINITION_STYLES 0N/A * Terminate the current line and insert preamble for the next line. The 0N/A * line count will be incremented. 77N/A * @throws IOException on error when writing the xref 58N/A * Write a symbol and generate links as appropriate. 260N/A * @param symbol the symbol to write 0N/A * @param keywords a set of keywords recognized by this analyzer (no links 0N/A * will be generated if the symbol is a keyword) 77N/A * @param line the line number on which the symbol appears 58N/A * @throws IOException if an error occurs while writing to the stream 0N/A // This is a keyword, so we don't create a link. 0N/A // This is the definition of the symbol. 0N/A // 1) Create an anchor for direct links. (Perhaps we should only 0N/A // do this when there's exactly one definition of the symbol in 0N/A // this file? Otherwise, we may end up with multiple anchors with 99N/A // 2) Create a link that searches for all references to this symbol. 70N/A // This is a reference to a symbol defined exactly once in this file. 77N/A // Generate a direct link to the symbol definition. 77N/A // This is a symbol that is not defined in this file, or a symbol 77N/A // that is defined more than once in this file. In either case, we 77N/A // can't generate a direct link to the definition, so generate a 77N/A // link to search for all definitions of that symbol instead. 77N/A * Write HTML escape sequence for the specified Unicode character, unless 77N/A * it's an ISO control character, in which case it is ignored. 77N/A * @param c the character to write 99N/A * @throws IOException if an error occurs while writing to the stream 99N/A * Write an e-mail address. The address will be obfuscated if 99N/A * {@link RuntimeEnvironment#isObfuscatingEMailAddresses()} returns 58N/A * @param address the address to write 203N/A * @throws IOException if an error occurs while writing to the stream