PageRenderTime 39ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/bsh/Token.java

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