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