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

Sun, 17 Feb 2013 16:44:55 -0500

author
dholmes
date
Sun, 17 Feb 2013 16:44:55 -0500
changeset 1571
af8417e590f4
parent 1326
30c36e23f154
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Merge

duke@1 1 /*
jjg@1326 2 * Copyright (c) 2005, 2012, 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
mcimadamore@1113 28 import com.sun.tools.javac.parser.Tokens.*;
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 /**
mcimadamore@1113 43 * Consume the next token.
duke@1 44 */
mcimadamore@1113 45 void nextToken();
duke@1 46
duke@1 47 /**
mcimadamore@1113 48 * Return current token.
duke@1 49 */
mcimadamore@1113 50 Token token();
duke@1 51
duke@1 52 /**
mcimadamore@1144 53 * Return token with given lookahead.
mcimadamore@1144 54 */
mcimadamore@1144 55 Token token(int lookahead);
mcimadamore@1144 56
mcimadamore@1144 57 /**
mcimadamore@1113 58 * Return the last character position of the previous token.
duke@1 59 */
mcimadamore@1113 60 Token prevToken();
mcimadamore@1113 61
mcimadamore@1113 62 /**
mcimadamore@1113 63 * Splits the current token in two and return the first (splitted) token.
jjg@1326 64 * For instance {@literal '<<<'} is split into two tokens
jjg@1326 65 * {@literal '<'} and {@literal '<<'} respectively,
mcimadamore@1113 66 * and the latter is returned.
mcimadamore@1113 67 */
mcimadamore@1113 68 Token split();
duke@1 69
duke@1 70 /**
duke@1 71 * Return the position where a lexical error occurred;
duke@1 72 */
duke@1 73 int errPos();
duke@1 74
duke@1 75 /**
duke@1 76 * Set the position where a lexical error occurred;
duke@1 77 */
duke@1 78 void errPos(int pos);
duke@1 79
duke@1 80 /**
duke@1 81 * Build a map for translating between line numbers and
duke@1 82 * positions in the input.
duke@1 83 *
duke@1 84 * @return a LineMap
duke@1 85 */
duke@1 86 LineMap getLineMap();
duke@1 87 }

mercurial