cvsimport
[beagle.git] / beagled / Lucene.Net / Analysis / Standard / CharStream.cs
blob051a139d19a2823a8f3c7d014dda5f3955dbfb51
1 /*
2 * Copyright 2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /* Generated By:JavaCC: Do not edit this line. CharStream.java Version 3.0 */
18 using System;
19 namespace Lucene.Net.Analysis.Standard
22 /// <summary> This interface describes a character stream that maintains line and
23 /// column number positions of the characters. It also has the capability
24 /// to backup the stream to some extent. An implementation of this
25 /// interface is used in the TokenManager implementation generated by
26 /// JavaCCParser.
27 ///
28 /// All the methods except backup can be implemented in any fashion. backup
29 /// needs to be implemented correctly for the correct operation of the lexer.
30 /// Rest of the methods are all used to get information like line number,
31 /// column number and the String that constitutes a token and are not used
32 /// by the lexer. Hence their implementation won't affect the generated lexer's
33 /// operation.
34 /// </summary>
36 public interface CharStream
39 /// <summary> Returns the next character from the selected input. The method
40 /// of selecting the input is the responsibility of the class
41 /// implementing this interface. Can throw any java.io.IOException.
42 /// </summary>
43 int ReadChar();
45 /// <summary> Returns the column position of the character last read.</summary>
46 /// <deprecated>
47 /// </deprecated>
48 /// <seealso cref="getEndColumn">
49 /// </seealso>
50 int GetColumn();
52 /// <summary> Returns the line number of the character last read.</summary>
53 /// <deprecated>
54 /// </deprecated>
55 /// <seealso cref="getEndLine">
56 /// </seealso>
57 int GetLine();
59 /// <summary> Returns the column number of the last character for current token (being
60 /// matched after the last call to BeginTOken).
61 /// </summary>
62 int GetEndColumn();
64 /// <summary> Returns the line number of the last character for current token (being
65 /// matched after the last call to BeginTOken).
66 /// </summary>
67 int GetEndLine();
69 /// <summary> Returns the column number of the first character for current token (being
70 /// matched after the last call to BeginTOken).
71 /// </summary>
72 int GetBeginColumn();
74 /// <summary> Returns the line number of the first character for current token (being
75 /// matched after the last call to BeginTOken).
76 /// </summary>
77 int GetBeginLine();
79 /// <summary> Backs up the input stream by amount steps. Lexer calls this method if it
80 /// had already read some characters, but could not use them to match a
81 /// (longer) token. So, they will be used again as the prefix of the next
82 /// token and it is the implemetation's responsibility to do this right.
83 /// </summary>
84 void Backup(int amount);
86 /// <summary> Returns the next character that marks the beginning of the next token.
87 /// All characters must remain in the buffer between two successive calls
88 /// to this method to implement backup correctly.
89 /// </summary>
90 int BeginToken();
92 /// <summary> Returns a string made up of characters from the marked token beginning
93 /// to the current buffer position. Implementations have the choice of returning
94 /// anything that they want to. For example, for efficiency, one might decide
95 /// to just return null, which is a valid implementation.
96 /// </summary>
97 System.String GetImage();
99 /// <summary> Returns an array of characters that make up the suffix of length 'len' for
100 /// the currently matched token. This is used to build up the matched string
101 /// for use in actions in the case of MORE. A simple and inefficient
102 /// implementation of this is as follows :
103 ///
104 /// {
105 /// String t = GetImage();
106 /// return t.substring(t.length() - len, t.length()).toCharArray();
107 /// }
108 /// </summary>
109 char[] GetSuffix(int len);
111 /// <summary> The lexer calls this function to indicate that it is done with the stream
112 /// and hence implementations can free any resources held by this class.
113 /// Again, the body of this function can be just empty and it will not
114 /// affect the lexer's operation.
115 /// </summary>
116 void Done();