001/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */
002/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
003package org.w3c.flute.parser;
004
005/**
006 * This interface describes a character stream that maintains line and
007 * column number positions of the characters.  It also has the capability
008 * to backup the stream to some extent.  An implementation of this
009 * interface is used in the TokenManager implementation generated by
010 * JavaCCParser.
011 *
012 * All the methods except backup can be implemented in any fashion. backup
013 * needs to be implemented correctly for the correct operation of the lexer.
014 * Rest of the methods are all used to get information like line number,
015 * column number and the String that constitutes a token and are not used
016 * by the lexer. Hence their implementation won't affect the generated lexer's
017 * operation.
018 */
019
020public
021interface CharStream {
022
023  /**
024   * Returns the next character from the selected input.  The method
025   * of selecting the input is the responsibility of the class
026   * implementing this interface.  Can throw any java.io.IOException.
027   */
028  char readChar() throws java.io.IOException;
029
030  @Deprecated
031  /**
032   * Returns the column position of the character last read.
033   * @deprecated
034   * @see #getEndColumn
035   */
036  int getColumn();
037
038  @Deprecated
039  /**
040   * Returns the line number of the character last read.
041   * @deprecated
042   * @see #getEndLine
043   */
044  int getLine();
045
046  /**
047   * Returns the column number of the last character for current token (being
048   * matched after the last call to BeginTOken).
049   */
050  int getEndColumn();
051
052  /**
053   * Returns the line number of the last character for current token (being
054   * matched after the last call to BeginTOken).
055   */
056  int getEndLine();
057
058  /**
059   * Returns the column number of the first character for current token (being
060   * matched after the last call to BeginTOken).
061   */
062  int getBeginColumn();
063
064  /**
065   * Returns the line number of the first character for current token (being
066   * matched after the last call to BeginTOken).
067   */
068  int getBeginLine();
069
070  /**
071   * Backs up the input stream by amount steps. Lexer calls this method if it
072   * had already read some characters, but could not use them to match a
073   * (longer) token. So, they will be used again as the prefix of the next
074   * token and it is the implemetation's responsibility to do this right.
075   */
076  void backup(int amount);
077
078  /**
079   * Returns the next character that marks the beginning of the next token.
080   * All characters must remain in the buffer between two successive calls
081   * to this method to implement backup correctly.
082   */
083  char BeginToken() throws java.io.IOException;
084
085  /**
086   * Returns a string made up of characters from the marked token beginning
087   * to the current buffer position. Implementations have the choice of returning
088   * anything that they want to. For example, for efficiency, one might decide
089   * to just return null, which is a valid implementation.
090   */
091  String GetImage();
092
093  /**
094   * Returns an array of characters that make up the suffix of length 'len' for
095   * the currently matched token. This is used to build up the matched string
096   * for use in actions in the case of MORE. A simple and inefficient
097   * implementation of this is as follows :
098   *
099   *   {
100   *      String t = GetImage();
101   *      return t.substring(t.length() - len, t.length()).toCharArray();
102   *   }
103   */
104  char[] GetSuffix(int len);
105
106  /**
107   * The lexer calls this function to indicate that it is done with the stream
108   * and hence implementations can free any resources held by this class.
109   * Again, the body of this function can be just empty and it will not
110   * affect the lexer's operation.
111   */
112  void Done();
113
114}
115/* JavaCC - OriginalChecksum=9e13eaf20bbd60d420d5d89177ab64a7 (do not edit this line) */