Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / beagled / Lucene.Net / QueryParser / CharStream.cs
blobb00f915f2ddcf1a3c8e14ec8d4a027526ff1b37a
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.
16 /* Generated By:JavaCC: Do not edit this line. CharStream.java Version 3.0 */
17 using System;
18 namespace Lucene.Net.QueryParsers
21 /// <summary> This interface describes a character stream that maintains line and
22 /// column number positions of the characters. It also has the capability
23 /// to backup the stream to some extent. An implementation of this
24 /// interface is used in the TokenManager implementation generated by
25 /// JavaCCParser.
26 ///
27 /// All the methods except backup can be implemented in any fashion. backup
28 /// needs to be implemented correctly for the correct operation of the lexer.
29 /// Rest of the methods are all used to get information like line number,
30 /// column number and the String that constitutes a token and are not used
31 /// by the lexer. Hence their implementation won't affect the generated lexer's
32 /// operation.
33 /// </summary>
35 public interface CharStream
38 /// <summary> Returns the next character from the selected input. The method
39 /// of selecting the input is the responsibility of the class
40 /// implementing this interface. Can throw any java.io.IOException.
41 /// </summary>
42 char ReadChar();
44 /// <summary> Returns the column position of the character last read.</summary>
45 /// <deprecated>
46 /// </deprecated>
47 /// <seealso cref="#getEndColumn">
48 /// </seealso>
49 int GetColumn();
51 /// <summary> Returns the line number of the character last read.</summary>
52 /// <deprecated>
53 /// </deprecated>
54 /// <seealso cref="#getEndLine">
55 /// </seealso>
56 int GetLine();
58 /// <summary> Returns the column number of the last character for current token (being
59 /// matched after the last call to BeginTOken).
60 /// </summary>
61 int GetEndColumn();
63 /// <summary> Returns the line number of the last character for current token (being
64 /// matched after the last call to BeginTOken).
65 /// </summary>
66 int GetEndLine();
68 /// <summary> Returns the column number of the first character for current token (being
69 /// matched after the last call to BeginTOken).
70 /// </summary>
71 int GetBeginColumn();
73 /// <summary> Returns the line number of the first character for current token (being
74 /// matched after the last call to BeginTOken).
75 /// </summary>
76 int GetBeginLine();
78 /// <summary> Backs up the input stream by amount steps. Lexer calls this method if it
79 /// had already read some characters, but could not use them to match a
80 /// (longer) token. So, they will be used again as the prefix of the next
81 /// token and it is the implemetation's responsibility to do this right.
82 /// </summary>
83 void Backup(int amount);
85 /// <summary> Returns the next character that marks the beginning of the next token.
86 /// All characters must remain in the buffer between two successive calls
87 /// to this method to implement backup correctly.
88 /// </summary>
89 char BeginToken();
91 /// <summary> Returns a string made up of characters from the marked token beginning
92 /// to the current buffer position. Implementations have the choice of returning
93 /// anything that they want to. For example, for efficiency, one might decide
94 /// to just return null, which is a valid implementation.
95 /// </summary>
96 System.String GetImage();
98 /// <summary> Returns an array of characters that make up the suffix of length 'len' for
99 /// the currently matched token. This is used to build up the matched string
100 /// for use in actions in the case of MORE. A simple and inefficient
101 /// implementation of this is as follows :
102 ///
103 /// {
104 /// String t = GetImage();
105 /// return t.substring(t.length() - len, t.length()).toCharArray();
106 /// }
107 /// </summary>
108 char[] GetSuffix(int len);
110 /// <summary> The lexer calls this function to indicate that it is done with the stream
111 /// and hence implementations can free any resources held by this class.
112 /// Again, the body of this function can be just empty and it will not
113 /// affect the lexer's operation.
114 /// </summary>
115 void Done();