Source Code Cross Referenced for Token.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » syntax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jEdit » org.gjt.sp.jedit.syntax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Token.java - Syntax token
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 1998, 1999, 2000, 2001, 2002 Slava Pestov
007:         *
008:         * This program is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public License
010:         * as published by the Free Software Foundation; either version 2
011:         * of the License, or any later version.
012:         *
013:         * This program is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:        package org.gjt.sp.jedit.syntax;
023:
024:        import java.lang.reflect.Field;
025:
026:        /**
027:         * A linked list of syntax tokens.
028:         *
029:         * @author Slava Pestov
030:         * @version $Id: Token.java 5354 2006-03-03 16:18:06Z ezust $
031:         */
032:        public class Token {
033:            //{{{ stringToToken() method
034:            /**
035:             * Converts a token type string to a token type constant.
036:             * @param value The token type
037:             * @since jEdit 4.1pre1
038:             */
039:            public static byte stringToToken(String value) {
040:                try {
041:                    Field f = Token.class.getField(value);
042:                    return f.getByte(null);
043:                } catch (Exception e) {
044:                    return -1;
045:                }
046:            } //}}}
047:
048:            //{{{ tokenToString() method
049:            /**
050:             * Converts a token type constant to a token type string.
051:             * @since jEdit 4.2pre1
052:             */
053:            public static String tokenToString(byte token) {
054:                return TOKEN_TYPES[token];
055:            } //}}}
056:
057:            //{{{ Token types
058:            public static final String[] TOKEN_TYPES = new String[] { "NULL",
059:                    "COMMENT1", "COMMENT2", "COMMENT3", "COMMENT4", "DIGIT",
060:                    "FUNCTION", "INVALID", "KEYWORD1", "KEYWORD2", "KEYWORD3",
061:                    "KEYWORD4", "LABEL", "LITERAL1", "LITERAL2", "LITERAL3",
062:                    "LITERAL4", "MARKUP", "OPERATOR" };
063:
064:            public static final byte NULL = 0;
065:
066:            public static final byte COMMENT1 = 1;
067:            public static final byte COMMENT2 = 2;
068:            public static final byte COMMENT3 = 3;
069:            public static final byte COMMENT4 = 4;
070:            public static final byte DIGIT = 5;
071:            public static final byte FUNCTION = 6;
072:            public static final byte INVALID = 7;
073:            public static final byte KEYWORD1 = 8;
074:            public static final byte KEYWORD2 = 9;
075:            public static final byte KEYWORD3 = 10;
076:            public static final byte KEYWORD4 = 11;
077:            public static final byte LABEL = 12;
078:            public static final byte LITERAL1 = 13;
079:            public static final byte LITERAL2 = 14;
080:            public static final byte LITERAL3 = 15;
081:            public static final byte LITERAL4 = 16;
082:            public static final byte MARKUP = 17;
083:            public static final byte OPERATOR = 18;
084:            //}}}
085:
086:            public static final byte ID_COUNT = 19;
087:
088:            // Special:
089:            public static final byte END = 127;
090:
091:            //{{{ Instance variables
092:            /**
093:             * The id of this token.
094:             */
095:            public byte id;
096:
097:            /**
098:             * The start offset of this token.
099:             */
100:            public int offset;
101:
102:            /**
103:             * The length of this token.
104:             */
105:            public int length;
106:
107:            /**
108:             * The rule set of this token.
109:             */
110:            public ParserRuleSet rules;
111:
112:            /**
113:             * The next token in the linked list.
114:             */
115:            public Token next;
116:
117:            //}}}
118:
119:            //{{{ Token constructor
120:            /**
121:             * Creates a new token.
122:             * @param id The id of the token
123:             * @param offset The start offset of the token
124:             * @param length The length of the token
125:             * @param rules The parser rule set that generated this token
126:             */
127:            public Token(byte id, int offset, int length, ParserRuleSet rules) {
128:                this .id = id;
129:                this .offset = offset;
130:                this .length = length;
131:                this .rules = rules;
132:            } //}}}
133:
134:            //{{{ toString() method
135:            /**
136:             * Returns a string representation of this token.
137:             */
138:            public String toString() {
139:                return "[id=" + id + ",offset=" + offset + ",length=" + length
140:                        + "]";
141:            } //}}}
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.