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

/jEdit/tags/jedit-4-0-pre3/org/gjt/sp/jedit/syntax/Token.java

#
Java | 102 lines | 35 code | 10 blank | 57 comment | 0 complexity | 7be8fa7bd945b8b341c95ea4926b1265 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. /*
  2. * Token.java - Syntax token
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 1998, 1999, 2000, 2001 Slava Pestov
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package org.gjt.sp.jedit.syntax;
  23. /**
  24. * A linked list of syntax tokens.
  25. *
  26. * @author Slava Pestov
  27. * @version $Id: Token.java 3928 2001-12-01 05:48:48Z spestov $
  28. */
  29. public class Token
  30. {
  31. //{{{ Token types
  32. public static final byte NULL = 0;
  33. public static final byte COMMENT1 = 1;
  34. public static final byte COMMENT2 = 2;
  35. public static final byte LITERAL1 = 3;
  36. public static final byte LITERAL2 = 4;
  37. public static final byte LABEL = 5;
  38. public static final byte KEYWORD1 = 6;
  39. public static final byte KEYWORD2 = 7;
  40. public static final byte KEYWORD3 = 8;
  41. public static final byte FUNCTION = 9;
  42. public static final byte MARKUP = 10;
  43. public static final byte OPERATOR = 11;
  44. public static final byte DIGIT = 12;
  45. public static final byte INVALID = 13; //}}}
  46. public static final byte ID_COUNT = 14;
  47. public static final byte END = 127;
  48. //{{{ Instance variables
  49. /**
  50. * The length of this token.
  51. */
  52. public int length;
  53. /**
  54. * The id of this token.
  55. */
  56. public byte id;
  57. /**
  58. * The rule set of this token.
  59. */
  60. public ParserRuleSet rules;
  61. /**
  62. * The previous token in the linked list.
  63. * @since jEdit 2.6pre1
  64. */
  65. public Token prev;
  66. /**
  67. * The next token in the linked list.
  68. */
  69. public Token next;
  70. //}}}
  71. //{{{ Token constructor
  72. /**
  73. * Creates a new token.
  74. * @param length The length of the token
  75. * @param id The id of the token
  76. * @param rules The parser rule set that generated this token
  77. */
  78. public Token(int length, byte id, ParserRuleSet rules)
  79. {
  80. this.length = length;
  81. this.id = id;
  82. this.rules = rules;
  83. } //}}}
  84. //{{{ toString() method
  85. /**
  86. * Returns a string representation of this token.
  87. */
  88. public String toString()
  89. {
  90. return "[id=" + id + ",length=" + length + "]";
  91. } //}}}
  92. }