/tags/release-0.1-rc2/hive/external/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/Token.java

# · Java · 78 lines · 18 code · 10 blank · 50 comment · 1 complexity · 4e0a57bf9b24c8b8ad3ae50bc3cca732 MD5 · raw file

  1. /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
  2. package org.apache.hadoop.hive.serde2.dynamic_type;
  3. /**
  4. * Describes the input token stream.
  5. */
  6. public class Token {
  7. /**
  8. * An integer that describes the kind of this token. This numbering system is
  9. * determined by JavaCCParser, and a table of these numbers is stored in the
  10. * file ...Constants.java.
  11. */
  12. public int kind;
  13. /**
  14. * beginLine and beginColumn describe the position of the first character of
  15. * this token; endLine and endColumn describe the position of the last
  16. * character of this token.
  17. */
  18. public int beginLine, beginColumn, endLine, endColumn;
  19. /**
  20. * The string image of the token.
  21. */
  22. public String image;
  23. /**
  24. * A reference to the next regular (non-special) token from the input stream.
  25. * If this is the last token from the input stream, or if the token manager
  26. * has not read tokens beyond this one, this field is set to null. This is
  27. * true only if this token is also a regular token. Otherwise, see below for a
  28. * description of the contents of this field.
  29. */
  30. public Token next;
  31. /**
  32. * This field is used to access special tokens that occur prior to this token,
  33. * but after the immediately preceding regular (non-special) token. If there
  34. * are no such special tokens, this field is set to null. When there are more
  35. * than one such special token, this field refers to the last of these special
  36. * tokens, which in turn refers to the next previous special token through its
  37. * specialToken field, and so on until the first special token (whose
  38. * specialToken field is null). The next fields of special tokens refer to
  39. * other special tokens that immediately follow it (without an intervening
  40. * regular token). If there is no such token, this field is null.
  41. */
  42. public Token specialToken;
  43. /**
  44. * Returns the image.
  45. */
  46. @Override
  47. public String toString() {
  48. return image;
  49. }
  50. /**
  51. * Returns a new Token object, by default. However, if you want, you can
  52. * create and return subclass objects based on the value of ofKind. Simply add
  53. * the cases to the switch for all those special cases. For example, if you
  54. * have a subclass of Token called IDToken that you want to create if ofKind
  55. * is ID, simlpy add something like :
  56. *
  57. * case MyParserConstants.ID : return new IDToken();
  58. *
  59. * to the following switch statement. Then you can cast matchedToken variable
  60. * to the appropriate type and use it in your lexical actions.
  61. */
  62. public static final Token newToken(int ofKind) {
  63. switch (ofKind) {
  64. default:
  65. return new Token();
  66. }
  67. }
  68. }