/plugins/PHPParser/tags/PHPParser-1.2.6/src/gatchan/phpparser/parser/Token.java

# · Java · 83 lines · 20 code · 10 blank · 53 comment · 0 complexity · 8b94789d96f828fbe56ba277b99045df MD5 · raw file

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