Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
CharStream.cs
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /* Generated By:JavaCC: Do not edit this line. CharStream.java Version 4.1 */
19 /* JavaCCOptions:STATIC=false */
20 
21 using System;
22 
23 namespace Lucene.Net.QueryParsers
24 {
25 
26  /// <summary> This interface describes a character stream that maintains line and
27  /// column number positions of the characters. It also has the capability
28  /// to backup the stream to some extent. An implementation of this
29  /// interface is used in the TokenManager implementation generated by
30  /// JavaCCParser.
31  ///
32  /// All the methods except backup can be implemented in any fashion. backup
33  /// needs to be implemented correctly for the correct operation of the lexer.
34  /// Rest of the methods are all used to get information like line number,
35  /// column number and the String that constitutes a token and are not used
36  /// by the lexer. Hence their implementation won't affect the generated lexer's
37  /// operation.
38  /// </summary>
39 
40  public interface ICharStream
41  {
42  /// <summary> Returns the next character from the selected input. The method
43  /// of selecting the input is the responsibility of the class
44  /// implementing this interface. Can throw any java.io.IOException.
45  /// </summary>
46  char ReadChar();
47 
48  /// <summary> Returns the column position of the character last read.</summary>
49  /// <deprecated>
50  /// </deprecated>
51  /// <seealso cref="EndColumn">
52  /// </seealso>
53  [Obsolete]
54  int Column { get; }
55 
56  /// <summary> Returns the line number of the character last read.</summary>
57  /// <deprecated>
58  /// </deprecated>
59  /// <seealso cref="EndLine">
60  /// </seealso>
61  [Obsolete]
62  int Line { get; }
63 
64  /// <summary> Returns the column number of the last character for current token (being
65  /// matched after the last call to BeginTOken).
66  /// </summary>
67  int EndColumn { get; }
68 
69  /// <summary> Returns the line number of the last character for current token (being
70  /// matched after the last call to BeginTOken).
71  /// </summary>
72  int EndLine { get; }
73 
74  /// <summary> Returns the column number of the first character for current token (being
75  /// matched after the last call to BeginTOken).
76  /// </summary>
77  int BeginColumn { get; }
78 
79  /// <summary> Returns the line number of the first character for current token (being
80  /// matched after the last call to BeginTOken).
81  /// </summary>
82  int BeginLine { get; }
83 
84  /// <summary> Backs up the input stream by amount steps. Lexer calls this method if it
85  /// had already read some characters, but could not use them to match a
86  /// (longer) token. So, they will be used again as the prefix of the next
87  /// token and it is the implemetation's responsibility to do this right.
88  /// </summary>
89  void Backup(int amount);
90 
91  /// <summary> Returns the next character that marks the beginning of the next token.
92  /// All characters must remain in the buffer between two successive calls
93  /// to this method to implement backup correctly.
94  /// </summary>
95  char BeginToken();
96 
97  /// <summary> Returns a string made up of characters from the marked token beginning
98  /// to the current buffer position. Implementations have the choice of returning
99  /// anything that they want to. For example, for efficiency, one might decide
100  /// to just return null, which is a valid implementation.
101  /// </summary>
102  string Image { get; }
103 
104  /// <summary> Returns an array of characters that make up the suffix of length 'len' for
105  /// the currently matched token. This is used to build up the matched string
106  /// for use in actions in the case of MORE. A simple and inefficient
107  /// implementation of this is as follows :
108  ///
109  /// {
110  /// String t = GetImage();
111  /// return t.substring(t.length() - len, t.length()).toCharArray();
112  /// }
113  /// </summary>
114  char[] GetSuffix(int len);
115 
116  /// <summary> The lexer calls this function to indicate that it is done with the stream
117  /// and hence implementations can free any resources held by this class.
118  /// Again, the body of this function can be just empty and it will not
119  /// affect the lexer's operation.
120  /// </summary>
121  void Done();
122  }
123  /* JavaCC - OriginalChecksum=32a89423891f765dde472f7ef0e3ef7b (do not edit this line) */
124 }