View Javadoc

1   package org.devaki.nextobjects.ui.editor.syntax;
2   /*
3   
4   nextobjects Copyright (C) 2001-2005 Emmanuel Florent
5   
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by the
8   Free Software Foundation; either version 2 of the License, or (at your
9   option) any later version.
10  
11  This program is distributed in the hope that it will
12  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the GNU General Public License for more details.
15  
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc., 59
18  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  
20  */
21  import java.io.IOException;
22  /***
23   * A lexer should implement this interface.
24   */
25  public interface Lexer
26  {
27      /***
28       * Returns the next token.
29       *
30       * @return the next token
31       * @throws IOException i/o exception
32       */
33      Token getNextToken() throws IOException;
34      /***
35       * Closes the current input stream, and resets the scanner to read from a
36       * new input stream.
37       * All internal variables are reset, the old input stream  cannot be reused
38       * (content of the internal buffer is discarded and lost).
39       * The lexical state is set to the inititial state.
40       * Subsequent tokens read from the lexer will start with the line, char,
41       * and column values given here.
42       *
43       * @param reader The new input.
44       * @param yyline The line number of the first token.
45       * @param yychar The position (relative) of the first token.
46       * @param yycolumn The position (relative to the line) of the first token.
47       * @throws IOException occurs while switching readers.
48       */
49      void reset(
50          java.io.Reader reader,
51          int yyline,
52          int yychar,
53          int yycolumn)
54          throws IOException;
55  }