You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CharStream.java 3.8KB

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