Source Code Cross Referenced for XMLTokenId.java in  » IDE-Netbeans » xml » org » netbeans » api » xml » lexer » 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 » IDE Netbeans » xml » org.netbeans.api.xml.lexer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *                 Sun Public License Notice
003:         *
004:         * The contents of this file are subject to the Sun Public License
005:         * Version 1.0 (the "License"). You may not use this file except in
006:         * compliance with the License. A copy of the License is available at
007:         * http://www.sun.com/
008:         *
009:         * The Original Code is NetBeans. The Initial Developer of the Original
010:         * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
011:         * Microsystems, Inc. All Rights Reserved.
012:
013:        If you wish your version of this file to be governed by only the CDDL
014:        or only the GPL Version 2, indicate your decision by adding
015:        "[Contributor] elects to include this software in this distribution
016:        under the [CDDL or GPL Version 2] license." If you do not indicate a
017:        single choice of license, a recipient has the option to distribute
018:        your version of this file under either the CDDL, the GPL Version 2 or
019:        to extend the choice of license to its licensees as provided above.
020:        However, if you add GPL Version 2 code and therefore, elected the GPL
021:        Version 2 license, then the option applies only if the new code is
022:        made subject to such option by the copyright holder.
023:
024:        If you wish your version of this file to be governed by only the CDDL
025:        or only the GPL Version 2, indicate your decision by adding
026:        "[Contributor] elects to include this software in this distribution
027:        under the [CDDL or GPL Version 2] license." If you do not indicate a
028:        single choice of license, a recipient has the option to distribute
029:        your version of this file under either the CDDL, the GPL Version 2 or
030:        to extend the choice of license to its licensees as provided above.
031:        However, if you add GPL Version 2 code and therefore, elected the GPL
032:        Version 2 license, then the option applies only if the new code is
033:        made subject to such option by the copyright holder.
034:         */
035:        package org.netbeans.api.xml.lexer;
036:
037:        import java.util.Collection;
038:        import java.util.EnumSet;
039:        import java.util.HashMap;
040:        import java.util.Map;
041:        import org.netbeans.api.lexer.InputAttributes;
042:        import org.netbeans.api.lexer.Language;
043:        import org.netbeans.api.lexer.LanguagePath;
044:        import org.netbeans.api.lexer.Token;
045:        import org.netbeans.api.lexer.TokenId;
046:        import org.netbeans.lib.xml.lexer.XMLLexer;
047:        import org.netbeans.spi.lexer.LanguageEmbedding;
048:        import org.netbeans.spi.lexer.LanguageHierarchy;
049:        import org.netbeans.spi.lexer.Lexer;
050:        import org.netbeans.spi.lexer.LexerRestartInfo;
051:
052:        /**
053:         * Token ids of XML language
054:         */
055:        public enum XMLTokenId implements  TokenId {
056:
057:            /** Plain text */
058:            TEXT("xml-text"),
059:            /** Erroneous Text */
060:            WS("xml-ws"),
061:            /** Plain Text*/
062:            ERROR("xml-error"),
063:            /** XML Tag */
064:            TAG("xml-tag"),
065:            /** Argument of a tag */
066:            ARGUMENT("xml-attribute"),
067:            /** Operators - '=' between arg and value */
068:            OPERATOR("xml-operator"),
069:            /** Value - value of an argument */
070:            VALUE("xml-value"),
071:            /** Block comment */
072:            BLOCK_COMMENT("xml-comment"),
073:            /** SGML declaration in XML document - e.g. <!DOCTYPE> */
074:            DECLARATION("xml-doctype"),
075:            /** Character reference, e.g. &amp;lt; = &lt; */
076:            CHARACTER("xml-ref"),
077:            /** End of line */
078:            EOL("xml-EOL"),
079:            /* PI start delimiter <sample><b>&lt;?</b>target content of pi ?></sample> */
080:            PI_START("xml-pi-start"),
081:            /* PI target <sample>&lt;?<b>target</b> content of pi ?></sample> */
082:            PI_TARGET("xml-pi-target"),
083:            /* PI conetnt <sample>&lt;?target <b>content of pi </b>?></sample> */
084:            PI_CONTENT("pi-content"),
085:            /* PI end delimiter <sample>&lt;?target <content of pi <b>?></b></sample> */
086:            PI_END("pi-end"),
087:            /** Cdata section including its delimiters. */
088:            CDATA_SECTION("xml-cdata-section");
089:
090:            private final String primaryCategory;
091:
092:            XMLTokenId() {
093:                this (null);
094:            }
095:
096:            XMLTokenId(String primaryCategory) {
097:                this .primaryCategory = primaryCategory;
098:            }
099:
100:            public String primaryCategory() {
101:                return primaryCategory;
102:            }
103:
104:            private static final Language<XMLTokenId> language = new LanguageHierarchy<XMLTokenId>() {
105:                @Override
106:                protected Collection<XMLTokenId> createTokenIds() {
107:                    return EnumSet.allOf(XMLTokenId.class);
108:                }
109:
110:                @Override
111:                protected Map<String, Collection<XMLTokenId>> createTokenCategories() {
112:                    Map<String, Collection<XMLTokenId>> cats = new HashMap<String, Collection<XMLTokenId>>();
113:
114:                    // Incomplete literals
115:                    //cats.put("incomplete", EnumSet.of());
116:                    // Additional literals being a lexical error
117:                    //cats.put("error", EnumSet.of());
118:
119:                    return cats;
120:                }
121:
122:                @Override
123:                public Lexer<XMLTokenId> createLexer(
124:                        LexerRestartInfo<XMLTokenId> info) {
125:                    return new XMLLexer(info);
126:                }
127:
128:                @Override
129:                public LanguageEmbedding<?> embedding(Token<XMLTokenId> token,
130:                        LanguagePath languagePath,
131:                        InputAttributes inputAttributes) {
132:                    return null; // No embedding
133:                }
134:
135:                @Override
136:                public String mimeType() {
137:                    return "text/xml";
138:                }
139:            }.language();
140:
141:            public static Language<XMLTokenId> language() {
142:                return language;
143:            }
144:
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.