View Javadoc

1   /* Generated By:JavaCC: Do not edit this line. CharStream.java Version 4.1 */
2   /* JavaCCOptions:STATIC=false */
3   /** 
4    * JSP Parser for PMD.
5    * @author Pieter ? Application Engineers NV/SA ? http://www.ae.be
6    */
7   
8   package net.sourceforge.pmd.jsp.ast;
9   
10  /**
11   * This interface describes a character stream that maintains line and
12   * column number positions of the characters.  It also has the capability
13   * to backup the stream to some extent.  An implementation of this
14   * interface is used in the TokenManager implementation generated by
15   * JavaCCParser.
16   *
17   * All the methods except backup can be implemented in any fashion. backup
18   * needs to be implemented correctly for the correct operation of the lexer.
19   * Rest of the methods are all used to get information like line number,
20   * column number and the String that constitutes a token and are not used
21   * by the lexer. Hence their implementation won't affect the generated lexer's
22   * operation.
23   */
24  
25  public interface CharStream extends net.sourceforge.pmd.ast.CharStream {
26  
27    /**
28     * Returns the next character from the selected input.  The method
29     * of selecting the input is the responsibility of the class
30     * implementing this interface.  Can throw any java.io.IOException.
31     */
32    char readChar() throws java.io.IOException;
33  
34    /**
35     * Returns the column position of the character last read.
36     * @deprecated
37     * @see #getEndColumn
38     */
39    int getColumn();
40  
41    /**
42     * Returns the line number of the character last read.
43     * @deprecated
44     * @see #getEndLine
45     */
46    int getLine();
47  
48    /**
49     * Returns the column number of the last character for current token (being
50     * matched after the last call to BeginTOken).
51     */
52    int getEndColumn();
53  
54    /**
55     * Returns the line number of the last character for current token (being
56     * matched after the last call to BeginTOken).
57     */
58    int getEndLine();
59  
60    /**
61     * Returns the column number of the first character for current token (being
62     * matched after the last call to BeginTOken).
63     */
64    int getBeginColumn();
65  
66    /**
67     * Returns the line number of the first character for current token (being
68     * matched after the last call to BeginTOken).
69     */
70    int getBeginLine();
71  
72    /**
73     * Backs up the input stream by amount steps. Lexer calls this method if it
74     * had already read some characters, but could not use them to match a
75     * (longer) token. So, they will be used again as the prefix of the next
76     * token and it is the implemetation's responsibility to do this right.
77     */
78    void backup(int amount);
79  
80    /**
81     * Returns the next character that marks the beginning of the next token.
82     * All characters must remain in the buffer between two successive calls
83     * to this method to implement backup correctly.
84     */
85    char BeginToken() throws java.io.IOException;
86  
87    /**
88     * Returns a string made up of characters from the marked token beginning
89     * to the current buffer position. Implementations have the choice of returning
90     * anything that they want to. For example, for efficiency, one might decide
91     * to just return null, which is a valid implementation.
92     */
93    String GetImage();
94  
95    /**
96     * Returns an array of characters that make up the suffix of length 'len' for
97     * the currently matched token. This is used to build up the matched string
98     * for use in actions in the case of MORE. A simple and inefficient
99     * implementation of this is as follows :
100    *
101    *   {
102    *      String t = GetImage();
103    *      return t.substring(t.length() - len, t.length()).toCharArray();
104    *   }
105    */
106   char[] GetSuffix(int len);
107 
108   /**
109    * The lexer calls this function to indicate that it is done with the stream
110    * and hence implementations can free any resources held by this class.
111    * Again, the body of this function can be just empty and it will not
112    * affect the lexer's operation.
113    */
114   void Done();
115 
116 }
117 /* JavaCC - OriginalChecksum=41ae2339795c47e740cf9814e6433c13 (do not edit this line) */