JFlexXref.java revision 1470
850N/A * The contents of this file are subject to the terms of the 850N/A * Common Development and Distribution License (the "License"). 850N/A * You may not use this file except in compliance with the License. 850N/A * language governing permissions and limitations under the License. 850N/A * When distributing Covered Code, include this CDDL HEADER in each 850N/A * If applicable, add the following below this CDDL HEADER, with the 850N/A * fields enclosed by brackets "[]" replaced with your own identifying 850N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1259N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 1185N/A * Portions Copyright 2011, 2012 Jens Elkner. 850N/A * Base class for Xref lexers. 1121N/A /** Where to write xref content. */ 1121N/A /** URL prefix to use when generating search URLs. Per default this is 1185N/A * {@link Configuration#getUrlPrefix()}.*/ 1185N/A /** Annotation to use when writing out annotation info.*/ 1185N/A /** The project, to which this instance is related to. */ 1190N/A /** symbol definitions to use when writing out related info */ 1185N/A * A stack of <span ...> CSS class names currently opened. 1020N/A * It is used to close all open spans for a line and re-open them at the 1439N/A * start of the next line to produce wellformed XML. So if a 1439N/A * <span ...> is opened and do not closed on the same line, the class 1439N/A * name used needs to be pushed onto this stack. If the <span ...> 1145N/A * gets closed on a different line, it needs to be popped from this stack. 1259N/A * If properly done, the stack should be empty when the last line has been 1259N/A * Create a new empty instance with the default capacity. 1259N/A * The preferred method to add a new span class name to this instance. 1259N/A * @param s class name to add. 1259N/A * @throws IllegalArgumentException if the given argument is {@code null}. 1259N/A * The preferred method to remove the last element from this stack. 1259N/A * @return {@code null} if the stack is empty, the removed element 1259N/A /** the {@link SpanStack} for this and only this instance */ 1259N/A /** EOF value returned by yylex(). */ 1259N/A /** See {@link Configuration#getUserPage()}. Per default initialized 1259N/A * in the constructor and here to be consistent and avoid lot of 1259N/A /** See {@link Configuration#getUserPageSuffix()}. Per default 1259N/A * initialized in the constructor and here to be consistent and avoid lot of 1121N/A /** Stack to remember the order of relevant states for the current parser. 1121N/A /** Stack to remember the order of relevant state related labels for the 1121N/A * current parser. To keep consistency, {@link #stateStack} opertions should 1185N/A * always performed accordingly to this instance (i.e. if you wanna pop, 1185N/A * Description of the style to use for a type of definitions. 1121N/A /** Name of the style definition as given by CTags. */ 1121N/A /** Class name used by the style sheets when rendering the xref. */ 1121N/A * The title of the section to which this type belongs, or {@code null} 1121N/A * if this type should not be listed in the navigation panel. 1121N/A /** Construct a style description. */ 1121N/A * Description of styles to use for different types of definitions. 1121N/A * Create a new lexer instance. Initializes {@link #userPageLink}, 1121N/A * {@link #userPageSuffix} using the runtime environment and creates a new 850N/A * @see Configuration#getUserPage() 1439N/A * @see Configuration#getUserPageSuffix() 1121N/A // TODO when bug #16053 is fixed, we should add a getter to a file 1121N/A // that's included from all the Xref classes so that we avoid the 1121N/A // The auto-generated constructors for the Xref classes don't 1020N/A // expect a checked exception, so wrap it in an AssertionError. 1121N/A // This should never happen, since all the Xref classes will get 1145N/A // a public static YYEOF field from JFlex. 1145N/A throw ae;
// NOPMD (stack trace is preserved by initCause(), but 1145N/A * Reinitialize the xref with new contents. 1145N/A * @param contents a char buffer with text to analyze 1145N/A * @param length the number of characters to use from the char buffer 1145N/A * Set the symbol defintions to use when writing out related info. 1145N/A * @param defs symbol definitions to use. Might be {@code null}. 1145N/A * Write out the URL parameter, which specifies the project to use. Does 1259N/A * nothing if {@link #project} is not set. 1145N/A * Get the URL parameter, which specifies the project to use. 1145N/A * @return an empty String if {@link #project} is not set, the parameter 1145N/A * including the leading & otherwise. 1145N/A * Run the scanner to get the next token from the input. 1145N/A * Closes the current input stream, and resets the scanner to read from the 1145N/A * given input stream. All internal variables are reset, the old input 1145N/A * stream cannot be reused (content of the internal buffer is discarded and 1145N/A * lost). The lexical state is set to {@code YY_INITIAL}. 1145N/A * @param reader the new input stream to operate on.*/ 1145N/A * Get the number of the current line of input (which is usually the same as 1145N/A * Set the number of the current line of input (which is usually the same as 1185N/A * @param line line number to set. */ 1145N/A * Enter the given lexical state. 1145N/A * @param newState state to enter 1145N/A * Get the current lexical state of the scanner. 1145N/A * Write the crossfile content to the specified {@code Writer}. 1259N/A * @param out xref destination 1145N/A * @throws IOException on error when writing the xref 1121N/A // nothing to do here, yylex() will do the work 1121N/A +
" lexer is not perfect yet!");
1121N/A * Write a JavaScript function that returns an array with the definitions 1121N/A * to list in the navigation panel. Each element of the array is itself an 1121N/A * array containing the name of the definition type, the CSS class name for 1121N/A * the type, and an array of (symbol, line) pairs for the definitions of 1108N/A // No definitions, no symbol table to write 1121N/A // We want the symbol table to be sorted 1259N/A // Order by symbol name, and then by line number if multiple 1121N/A // definitions use the same symbol name 1121N/A /* no LF intentionally - xml is whitespace aware ... */ 1121N/A * Get the style description for a definition type. 1121N/A * @param type the definition type 1121N/A * @return the style of a definition type, or {@code null} if no style is 1123N/A * Write out annotation infos for the given line. 1122N/A * @param num linenumber to print 1439N/A * @throws IOException depends on the destination (<var>out</var>). out.
write(
' ');
// <div></div> doesn't produce a line-height block * 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 * -> uncompressed size ~6%, compressed size ~26% bigger; * <div id="N"><b>N</b>...</div> * -> uncompressed size ~12%, compressed size ~52% bigger; * <span class="[h]l" id="N">N</span>... * -> is about the same as previous one * 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 * @param escape If {@code true} <var>symbol</var> gets escapes for URI paths * and html text. Otherwise it is assumed, that symbol contains no HTML * @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 out the Unicode character, unless it's an ISO control character * < 0x20, in which case it is ignored. * @param c the character to write * @throws IOException if an error occurs while writing to the stream * Write an e-mail address. The address will be obfuscated if * {@link Configuration#isObfuscatingEMailAddresses()} returns * {@code true}. It gets not htmlized because it is assumed to contain no * HTML special characters. * @param address the address to write * @throws IOException if an error occurs while writing to the stream * Push the current state to the state order stack, the given label to the * {@link #labelStack} and enter the given state. * @param newState new state to enter. * @param label label to push to the {@link #labelStack}. Might be {@code null}. * Pop the last entry from the state order stack and enter it. Also pop the * the last label from the {@link #labelStack} and write it out, if it is