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

Mon, 14 Nov 2011 15:11:10 -0800

author
ksrini
date
Mon, 14 Nov 2011 15:11:10 -0800
changeset 1138
7375d4979bd3
parent 1113
d346ab55031b
child 1144
9448fe783fd2
permissions
-rw-r--r--

7106166: (javac) re-factor EndPos parser
Reviewed-by: 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
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@1113 53 * Return the last character position of the previous token.
duke@1 54 */
mcimadamore@1113 55 Token prevToken();
mcimadamore@1113 56
mcimadamore@1113 57 /**
mcimadamore@1113 58 * Splits the current token in two and return the first (splitted) token.
mcimadamore@1113 59 * For instance '<<<' is splitted into two tokens '<' and '<<' respectively,
mcimadamore@1113 60 * and the latter is returned.
mcimadamore@1113 61 */
mcimadamore@1113 62 Token split();
duke@1 63
duke@1 64 /**
duke@1 65 * Return the position where a lexical error occurred;
duke@1 66 */
duke@1 67 int errPos();
duke@1 68
duke@1 69 /**
duke@1 70 * Set the position where a lexical error occurred;
duke@1 71 */
duke@1 72 void errPos(int pos);
duke@1 73
duke@1 74 /**
duke@1 75 * Build a map for translating between line numbers and
duke@1 76 * positions in the input.
duke@1 77 *
duke@1 78 * @return a LineMap
duke@1 79 */
duke@1 80 LineMap getLineMap();
duke@1 81 }

mercurial