PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/bsh/Token.java

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