src/share/classes/com/sun/tools/javac/parser/Lexer.java

Wed, 06 Apr 2011 19:30:57 -0700

author
darcy
date
Wed, 06 Apr 2011 19:30:57 -0700
changeset 969
8cc5b440fdde
parent 581
f2fdd52e4e87
child 1113
d346ab55031b
permissions
-rw-r--r--

7033809: Rename "disjunctive" to "union" in javax.lang.model
Reviewed-by: mcimadamore, jjg

duke@1 1 /*
ohair@554 2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.javac.parser;
duke@1 27
duke@1 28 import com.sun.tools.javac.util.*;
duke@1 29 import com.sun.tools.javac.util.Position.LineMap;
duke@1 30
duke@1 31 /**
duke@1 32 * The lexical analyzer maps an input stream consisting of ASCII
duke@1 33 * characters and Unicode escapes into a token sequence.
duke@1 34 *
jjg@581 35 * <p><b>This is NOT part of any supported API.
duke@1 36 * If you write code that depends on this, you do so at your own risk.
duke@1 37 * This code and its internal interfaces are subject to change or
duke@1 38 * deletion without notice.</b>
duke@1 39 */
duke@1 40 public interface Lexer {
duke@1 41
duke@1 42 /**
duke@1 43 * Has a @deprecated been encountered in last doc comment?
duke@1 44 * This needs to be reset by client with resetDeprecatedFlag.
duke@1 45 */
duke@1 46 boolean deprecatedFlag();
duke@1 47
duke@1 48 void resetDeprecatedFlag();
duke@1 49
duke@1 50 /**
duke@1 51 * Returns the documentation string of the current token.
duke@1 52 */
duke@1 53 String docComment();
duke@1 54
duke@1 55 /**
duke@1 56 * Return the last character position of the current token.
duke@1 57 */
duke@1 58 int endPos();
duke@1 59
duke@1 60 /**
duke@1 61 * Return the position where a lexical error occurred;
duke@1 62 */
duke@1 63 int errPos();
duke@1 64
duke@1 65 /**
duke@1 66 * Set the position where a lexical error occurred;
duke@1 67 */
duke@1 68 void errPos(int pos);
duke@1 69
duke@1 70 /**
duke@1 71 * Build a map for translating between line numbers and
duke@1 72 * positions in the input.
duke@1 73 *
duke@1 74 * @return a LineMap
duke@1 75 */
duke@1 76 LineMap getLineMap();
duke@1 77
duke@1 78 /**
duke@1 79 * Returns a copy of the input buffer, up to its inputLength.
duke@1 80 * Unicode escape sequences are not translated.
duke@1 81 */
duke@1 82 char[] getRawCharacters();
duke@1 83
duke@1 84 /**
duke@1 85 * Returns a copy of a character array subset of the input buffer.
duke@1 86 * The returned array begins at the <code>beginIndex</code> and
duke@1 87 * extends to the character at index <code>endIndex - 1</code>.
duke@1 88 * Thus the length of the substring is <code>endIndex-beginIndex</code>.
duke@1 89 * This behavior is like
duke@1 90 * <code>String.substring(beginIndex, endIndex)</code>.
duke@1 91 * Unicode escape sequences are not translated.
duke@1 92 *
duke@1 93 * @param beginIndex the beginning index, inclusive.
duke@1 94 * @param endIndex the ending index, exclusive.
duke@1 95 * @throws IndexOutOfBounds if either offset is outside of the
duke@1 96 * array bounds
duke@1 97 */
duke@1 98 char[] getRawCharacters(int beginIndex, int endIndex);
duke@1 99
duke@1 100 /**
duke@1 101 * Return the name of an identifier or token for the current token.
duke@1 102 */
duke@1 103 Name name();
duke@1 104
duke@1 105 /**
duke@1 106 * Read token.
duke@1 107 */
duke@1 108 void nextToken();
duke@1 109
duke@1 110 /**
duke@1 111 * Return the current token's position: a 0-based
duke@1 112 * offset from beginning of the raw input stream
duke@1 113 * (before unicode translation)
duke@1 114 */
duke@1 115 int pos();
duke@1 116
duke@1 117 /**
duke@1 118 * Return the last character position of the previous token.
duke@1 119 */
duke@1 120 int prevEndPos();
duke@1 121
duke@1 122 /**
duke@1 123 * Return the radix of a numeric literal token.
duke@1 124 */
duke@1 125 int radix();
duke@1 126
duke@1 127 /**
duke@1 128 * The value of a literal token, recorded as a string.
duke@1 129 * For integers, leading 0x and 'l' suffixes are suppressed.
duke@1 130 */
duke@1 131 String stringVal();
duke@1 132
duke@1 133 /**
duke@1 134 * Return the current token, set by nextToken().
duke@1 135 */
duke@1 136 Token token();
duke@1 137
duke@1 138 /**
duke@1 139 * Sets the current token.
duke@1 140 */
duke@1 141 void token(Token token);
duke@1 142 }

mercurial