PageRenderTime 243ms CodeModel.GetById 221ms app.highlight 5ms RepoModel.GetById 15ms 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
  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 */
 22package org.gjt.sp.jedit.syntax;
 23
 24/**
 25 * A linked list of syntax tokens.
 26 *
 27 * @author Slava Pestov
 28 * @version $Id: Token.java 3928 2001-12-01 05:48:48Z spestov $
 29 */
 30public class Token
 31{
 32	//{{{ Token types
 33	public static final byte NULL = 0;
 34	public static final byte COMMENT1 = 1;
 35	public static final byte COMMENT2 = 2;
 36	public static final byte LITERAL1 = 3;
 37	public static final byte LITERAL2 = 4;
 38	public static final byte LABEL = 5;
 39	public static final byte KEYWORD1 = 6;
 40	public static final byte KEYWORD2 = 7;
 41	public static final byte KEYWORD3 = 8;
 42	public static final byte FUNCTION = 9;
 43	public static final byte MARKUP = 10;
 44	public static final byte OPERATOR = 11;
 45	public static final byte DIGIT = 12;
 46	public static final byte INVALID = 13; //}}}
 47
 48	public static final byte ID_COUNT = 14;
 49
 50	public static final byte END = 127;
 51
 52	//{{{ Instance variables
 53	/**
 54	 * The length of this token.
 55	 */
 56	public int length;
 57
 58	/**
 59	 * The id of this token.
 60	 */
 61	public byte id;
 62
 63	/**
 64	 * The rule set of this token.
 65	 */
 66	public ParserRuleSet rules;
 67
 68	/**
 69	 * The previous token in the linked list.
 70	 * @since jEdit 2.6pre1
 71	 */
 72	public Token prev;
 73
 74	/**
 75	 * The next token in the linked list.
 76	 */
 77	public Token next;
 78	//}}}
 79
 80	//{{{ Token constructor
 81	/**
 82	 * Creates a new token.
 83	 * @param length The length of the token
 84	 * @param id The id of the token
 85	 * @param rules The parser rule set that generated this token
 86	 */
 87	public Token(int length, byte id, ParserRuleSet rules)
 88	{
 89		this.length = length;
 90		this.id = id;
 91		this.rules = rules;
 92	} //}}}
 93
 94	//{{{ toString() method
 95	/**
 96	 * Returns a string representation of this token.
 97	 */
 98	public String toString()
 99	{
100		return "[id=" + id + ",length=" + length + "]";
101	} //}}}
102}