Source Code Cross Referenced for HTMLFlexScanner.java in  » Net » SkunkDAV » org » skunk » swing » text » 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 » Net » SkunkDAV » org.skunk.swing.text.syntax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* The following code was generated by JFlex 1.3 on 2/14/01 4:37 PM */
002:
003:        /*
004:         *  Copyright (c) 2001, Jacob Smullyan.
005:         *
006:         *  This is part of SkunkDAV, a WebDAV client.  See http://skunkdav.sourceforge.net/ 
007:         *  for the latest version.
008:         * 
009:         *  SkunkDAV is free software; you can redistribute it and/or
010:         *  modify it under the terms of the GNU General Public License as published
011:         *  by the Free Software Foundation; either version 2, or (at your option)
012:         *  any later version.
013:         * 
014:         *  SkunkDAV is distributed in the hope that it will be useful,
015:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         *  General Public License for more details.
018:         * 
019:         *  You should have received a copy of the GNU General Public License
020:         *  along with SkunkDAV; see the file COPYING.  If not, write to the Free
021:         *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
022:         *  02111-1307, USA.
023:         */
024:
025:        package org.skunk.swing.text.syntax;
026:
027:        import java.io.IOException;
028:        import java.io.StringReader;
029:
030:        /**
031:         * This class is a scanner generated by 
032:         * <a href="http://www.jflex.de/">JFlex</a> 1.3
033:         * on 2/14/01 4:37 PM from the specification file
034:         * <tt>file:/home/smulloni/workdir/skunkdav/org/skunk/swing/text/syntax/html.flex</tt>
035:         */
036:        public class HTMLFlexScanner extends FlexScanner {
037:
038:            /** This character denotes the end of file */
039:            final public static int YYEOF = -1;
040:
041:            /** initial size of the lookahead buffer */
042:            final private static int YY_BUFFERSIZE = 16384;
043:
044:            /** lexical states */
045:            final public static int COMMENT_STATE = 4;
046:            final public static int YYINITIAL = 0;
047:            final public static int SCRIPT_STATE = 5;
048:            final public static int TAG_VALUE_STATE = 3;
049:            final public static int TAG_ATTRIBUTE_STATE = 2;
050:            final public static int TAG_STATE = 1;
051:
052:            /** 
053:             * Translates characters to character classes
054:             */
055:            final private static String yycmap_packed = "\11\7\1\22\1\27\1\0\2\22\16\7\4\0\1\22\1\2\1\11"
056:                    + "\1\0\1\7\1\0\1\6\1\12\5\0\1\3\1\0\1\5\12\7"
057:                    + "\1\0\1\10\1\1\1\26\1\4\2\0\2\7\1\15\1\13\1\21"
058:                    + "\3\7\1\25\5\7\1\14\1\20\1\7\1\24\1\23\1\16\4\7"
059:                    + "\1\17\1\7\4\0\1\7\1\0\2\7\1\15\1\13\1\21\3\7"
060:                    + "\1\25\5\7\1\14\1\20\1\7\1\24\1\23\1\16\4\7\1\17"
061:                    + "\1\7\4\0\41\7\2\0\4\7\4\0\1\7\12\0\1\7\4\0"
062:                    + "\1\7\5\0\27\7\1\0\37\7\1\0\376\7\4\0\36\7\70\0"
063:                    + "\131\7\7\0\11\7\2\0\7\7\16\0\2\7\16\0\5\7\33\0"
064:                    + "\106\7\32\0\2\7\30\0\1\7\13\0\1\7\1\0\3\7\1\0"
065:                    + "\1\7\1\0\24\7\1\0\54\7\1\0\7\7\3\0\1\7\1\0"
066:                    + "\1\7\1\0\1\7\1\0\1\7\1\0\22\7\15\0\14\7\1\0"
067:                    + "\102\7\1\0\14\7\1\0\44\7\1\0\4\7\11\0\65\7\2\0"
068:                    + "\2\7\2\0\2\7\3\0\34\7\2\0\10\7\2\0\2\7\67\0"
069:                    + "\46\7\2\0\1\7\7\0\47\7\11\0\21\7\1\0\27\7\1\0"
070:                    + "\3\7\1\0\1\7\1\0\2\7\1\0\1\7\13\0\33\7\5\0"
071:                    + "\3\7\56\0\32\7\5\0\23\7\15\0\12\7\6\0\110\7\2\0"
072:                    + "\5\7\1\0\17\7\1\0\4\7\1\0\10\7\2\0\12\7\1\0"
073:                    + "\4\7\2\0\12\7\u0207\0\3\7\1\0\65\7\2\0\22\7\3\0"
074:                    + "\4\7\3\0\14\7\2\0\12\7\21\0\3\7\1\0\10\7\2\0"
075:                    + "\2\7\2\0\26\7\1\0\7\7\1\0\1\7\3\0\4\7\2\0"
076:                    + "\1\7\1\0\7\7\2\0\2\7\2\0\3\7\11\0\1\7\4\0"
077:                    + "\2\7\1\0\5\7\2\0\16\7\16\0\1\7\2\0\6\7\4\0"
078:                    + "\2\7\2\0\26\7\1\0\7\7\1\0\2\7\1\0\2\7\1\0"
079:                    + "\2\7\2\0\1\7\1\0\5\7\4\0\2\7\2\0\3\7\13\0"
080:                    + "\4\7\1\0\1\7\7\0\17\7\14\0\3\7\1\0\7\7\1\0"
081:                    + "\1\7\1\0\3\7\1\0\26\7\1\0\7\7\1\0\2\7\1\0"
082:                    + "\5\7\2\0\12\7\1\0\3\7\1\0\3\7\22\0\1\7\5\0"
083:                    + "\12\7\21\0\3\7\1\0\10\7\2\0\2\7\2\0\26\7\1\0"
084:                    + "\7\7\1\0\2\7\2\0\4\7\2\0\10\7\3\0\2\7\2\0"
085:                    + "\3\7\10\0\2\7\4\0\2\7\1\0\3\7\4\0\12\7\22\0"
086:                    + "\2\7\1\0\6\7\3\0\3\7\1\0\4\7\3\0\2\7\1\0"
087:                    + "\1\7\1\0\2\7\3\0\2\7\3\0\3\7\3\0\10\7\1\0"
088:                    + "\3\7\4\0\5\7\3\0\3\7\1\0\4\7\11\0\1\7\17\0"
089:                    + "\11\7\21\0\3\7\1\0\10\7\1\0\3\7\1\0\27\7\1\0"
090:                    + "\12\7\1\0\5\7\4\0\7\7\1\0\3\7\1\0\4\7\7\0"
091:                    + "\2\7\11\0\2\7\4\0\12\7\22\0\2\7\1\0\10\7\1\0"
092:                    + "\3\7\1\0\27\7\1\0\12\7\1\0\5\7\4\0\7\7\1\0"
093:                    + "\3\7\1\0\4\7\7\0\2\7\7\0\1\7\1\0\2\7\4\0"
094:                    + "\12\7\22\0\2\7\1\0\10\7\1\0\3\7\1\0\27\7\1\0"
095:                    + "\20\7\4\0\6\7\2\0\3\7\1\0\4\7\11\0\1\7\10\0"
096:                    + "\2\7\4\0\12\7\221\0\56\7\1\0\13\7\4\0\20\7\1\0"
097:                    + "\12\7\47\0\2\7\1\0\1\7\2\0\2\7\1\0\1\7\2\0"
098:                    + "\1\7\6\0\4\7\1\0\7\7\1\0\3\7\1\0\1\7\1\0"
099:                    + "\1\7\2\0\2\7\1\0\2\7\1\0\12\7\1\0\3\7\2\0"
100:                    + "\5\7\1\0\1\7\1\0\6\7\2\0\12\7\2\0\2\7\72\0"
101:                    + "\2\7\6\0\12\7\13\0\1\7\1\0\1\7\1\0\1\7\4\0"
102:                    + "\12\7\1\0\41\7\7\0\24\7\1\0\6\7\4\0\6\7\1\0"
103:                    + "\1\7\1\0\25\7\3\0\7\7\1\0\1\7\346\0\46\7\12\0"
104:                    + "\47\7\11\0\132\7\5\0\104\7\5\0\122\7\u0c06\0\234\7\4\0"
105:                    + "\132\7\6\0\26\7\2\0\6\7\2\0\46\7\2\0\6\7\2\0"
106:                    + "\10\7\1\0\1\7\1\0\1\7\1\0\1\7\1\0\37\7\2\0"
107:                    + "\65\7\1\0\7\7\1\0\1\7\3\0\3\7\1\0\7\7\3\0"
108:                    + "\4\7\2\0\6\7\4\0\15\7\5\0\3\7\1\0\7\7\17\0"
109:                    + "\4\7\32\0\5\7\20\0\2\7\51\0\6\7\17\0\1\7\40\0"
110:                    + "\15\7\43\0\15\7\4\0\1\7\40\0\1\7\4\0\1\7\2\0"
111:                    + "\12\7\1\0\1\7\2\0\6\7\6\0\1\7\1\0\1\7\1\0"
112:                    + "\1\7\1\0\10\7\1\0\6\7\47\0\43\7\u0e82\0\1\7\1\0"
113:                    + "\1\7\31\0\17\7\1\0\5\7\13\0\124\7\4\0\6\7\2\0"
114:                    + "\132\7\1\0\3\7\6\0\50\7\4\0\136\7\u1c71\0\u51a6\7\u0c5a\0"
115:                    + "\u2ba4\7\u215c\0\u012e\7\322\0\7\7\14\0\5\7\6\0\13\7\1\0"
116:                    + "\15\7\1\0\5\7\1\0\1\7\1\0\2\7\1\0\2\7\1\0"
117:                    + "\154\7\41\0\u016b\7\22\0\100\7\2\0\66\7\50\0\14\7\44\0"
118:                    + "\4\7\17\0\2\7\30\0\3\7\31\0\1\7\6\0\3\7\1\0"
119:                    + "\1\7\1\0\207\7\2\0\1\7\4\0\1\7\13\0\12\7\7\0"
120:                    + "\32\7\4\0\1\7\1\0\32\7\13\0\131\7\3\0\6\7\2\0"
121:                    + "\6\7\2\0\6\7\2\0\3\7\3\0\2\7\3\0\2\7\31\0";
122:
123:            /** 
124:             * Translates characters to character classes
125:             */
126:            final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
127:
128:            /** 
129:             * Translates a state to a row index in the transition table
130:             */
131:            final private static int yy_rowMap[] = { 0, 24, 48, 72, 96, 120,
132:                    144, 168, 144, 192, 216, 144, 240, 144, 144, 264, 288, 312,
133:                    336, 144, 360, 144, 144, 384, 144, 408, 432, 456, 480, 504,
134:                    528, 552, 144, 144, 144, 576, 144, 600, 624, 648, 672, 696,
135:                    720, 744, 768, 792, 144, 816, 144, 840, 864 };
136:
137:            /** 
138:             * The packed transition table of the DFA (part 0)
139:             */
140:            final private static String yy_packed0 = "\1\7\1\10\2\7\1\11\1\7\1\12\21\7\1\13"
141:                    + "\1\7\2\13\1\14\15\13\1\7\3\13\2\7\1\15"
142:                    + "\1\7\2\15\1\16\15\15\1\7\3\15\1\17\1\7"
143:                    + "\1\20\1\7\2\20\1\14\4\20\1\21\1\22\7\20"
144:                    + "\1\7\3\20\5\7\1\23\24\7\1\24\1\25\25\24"
145:                    + "\1\26\30\0\2\27\1\30\2\27\1\31\22\27\7\0"
146:                    + "\1\32\3\0\7\32\1\0\3\32\2\0\1\13\1\0"
147:                    + "\2\13\1\0\15\13\1\0\3\13\2\0\1\15\1\0"
148:                    + "\2\15\1\0\15\15\1\0\3\15\2\0\1\20\1\0"
149:                    + "\2\20\1\0\15\20\1\0\3\20\2\0\1\21\1\33"
150:                    + "\2\21\1\33\4\21\1\20\10\21\1\33\3\21\2\33"
151:                    + "\1\22\1\34\2\22\1\34\5\22\1\20\7\22\1\34"
152:                    + "\3\22\2\34\3\0\1\35\31\0\1\36\25\0\1\37"
153:                    + "\7\0\1\40\23\0\1\32\1\41\2\0\7\32\1\0"
154:                    + "\3\32\2\0\11\33\1\42\16\33\12\34\1\42\15\34"
155:                    + "\4\0\1\43\46\0\1\44\7\0\1\45\40\0\1\46"
156:                    + "\30\0\1\47\27\0\1\50\36\0\1\51\21\0\1\52"
157:                    + "\36\0\1\53\21\0\1\54\30\0\1\55\27\0\1\56"
158:                    + "\25\0\1\57\32\0\1\60\6\0\4\60\1\61\4\60"
159:                    + "\1\62\1\63\15\60\11\62\1\60\16\62\12\63\1\60" + "\15\63";
160:
161:            /** 
162:             * The transition table of the DFA
163:             */
164:            final private static int yytrans[] = yy_unpack();
165:
166:            /* error codes */
167:            final private static int YY_UNKNOWN_ERROR = 0;
168:            final private static int YY_ILLEGAL_STATE = 1;
169:            final private static int YY_NO_MATCH = 2;
170:            final private static int YY_PUSHBACK_2BIG = 3;
171:
172:            /* error messages for the codes above */
173:            final private static String YY_ERROR_MSG[] = {
174:                    "Unkown internal scanner error",
175:                    "Internal error: unknown state",
176:                    "Error: could not match input",
177:                    "Error: pushback value was too large" };
178:
179:            /**
180:             * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
181:             */
182:            private final static byte YY_ATTRIBUTE[] = { 0, 1, 1, 1, 0, 0, 9,
183:                    3, 9, 1, 1, 9, 1, 9, 9, 1, 1, 1, 1, 9, 1, 9, 13, 5, 9, 0,
184:                    0, 0, 0, 0, 0, 0, 9, 9, 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
185:                    9, 0, 9, 0, 0 };
186:
187:            /** the input device */
188:            private java.io.Reader yy_reader;
189:
190:            /** the current state of the DFA */
191:            private int yy_state;
192:
193:            /** the current lexical state */
194:            private int yy_lexical_state = YYINITIAL;
195:
196:            /** this buffer contains the current text to be matched and is
197:                the source of the yytext() string */
198:            private char yy_buffer[] = new char[YY_BUFFERSIZE];
199:
200:            /** the textposition at the last accepting state */
201:            private int yy_markedPos;
202:
203:            /** the textposition at the last state to be included in yytext */
204:            private int yy_pushbackPos;
205:
206:            /** the current text position in the buffer */
207:            private int yy_currentPos;
208:
209:            /** startRead marks the beginning of the yytext() string in the buffer */
210:            private int yy_startRead;
211:
212:            /** endRead marks the last character in the buffer, that has been read
213:                from input */
214:            private int yy_endRead;
215:
216:            /** number of newlines encountered up to the start of the matched text */
217:            private int yyline;
218:
219:            /** the number of characters up to the start of the matched text */
220:            private int yychar;
221:
222:            /**
223:             * the number of characters from the last newline up to the start of the 
224:             * matched text
225:             */
226:            private int yycolumn;
227:
228:            /** 
229:             * yy_atBOL == true <=> the scanner is currently at the beginning of a line
230:             */
231:            private boolean yy_atBOL = true;
232:
233:            /** yy_atEOF == true <=> the scanner is at the EOF */
234:            private boolean yy_atEOF;
235:
236:            /* user code: */
237:            private boolean inScript = false;
238:            private boolean open = false;
239:            private StringBuffer scriptBuffer = new StringBuffer();
240:            private boolean inLanguage = false;
241:            private String scriptLanguage = "javascript";
242:
243:            public void scan() throws IOException {
244:                while (!yy_atEOF) {
245:                    yylex();
246:                }
247:            }
248:
249:            private int applyStyle(int type) {
250:                return applyStyle(type, yychar, yylength());
251:            }
252:
253:            /**
254:             * Creates a new scanner
255:             * There is also a java.io.InputStream version of this constructor.
256:             *
257:             * @param   in  the java.io.Reader to read input from.
258:             */
259:            public HTMLFlexScanner(java.io.Reader in) {
260:                this .yy_reader = in;
261:            }
262:
263:            /**
264:             * Creates a new scanner.
265:             * There is also java.io.Reader version of this constructor.
266:             *
267:             * @param   in  the java.io.Inputstream to read input from.
268:             */
269:            public HTMLFlexScanner(java.io.InputStream in) {
270:                this (new java.io.InputStreamReader(in));
271:            }
272:
273:            /** 
274:             * Unpacks the split, compressed DFA transition table.
275:             *
276:             * @return the unpacked transition table
277:             */
278:            private static int[] yy_unpack() {
279:                int[] trans = new int[888];
280:                int offset = 0;
281:                offset = yy_unpack(yy_packed0, offset, trans);
282:                return trans;
283:            }
284:
285:            /** 
286:             * Unpacks the compressed DFA transition table.
287:             *
288:             * @param packed   the packed transition table
289:             * @return         the index of the last entry
290:             */
291:            private static int yy_unpack(String packed, int offset, int[] trans) {
292:                int i = 0; /* index in packed string  */
293:                int j = offset; /* index in unpacked array */
294:                int l = packed.length();
295:                while (i < l) {
296:                    int count = packed.charAt(i++);
297:                    int value = packed.charAt(i++);
298:                    value--;
299:                    do
300:                        trans[j++] = value;
301:                    while (--count > 0);
302:                }
303:                return j;
304:            }
305:
306:            /** 
307:             * Unpacks the compressed character translation table.
308:             *
309:             * @param packed   the packed character translation table
310:             * @return         the unpacked character translation table
311:             */
312:            private static char[] yy_unpack_cmap(String packed) {
313:                char[] map = new char[0x10000];
314:                int i = 0; /* index in packed string  */
315:                int j = 0; /* index in unpacked array */
316:                while (i < 1340) {
317:                    int count = packed.charAt(i++);
318:                    char value = packed.charAt(i++);
319:                    do
320:                        map[j++] = value;
321:                    while (--count > 0);
322:                }
323:                return map;
324:            }
325:
326:            /**
327:             * Gets the next input character.
328:             *
329:             * @return      the next character of the input stream, EOF if the
330:             *              end of the stream is reached.
331:             * @exception   IOException  if any I/O-Error occurs
332:             */
333:            private int yy_advance() throws java.io.IOException {
334:
335:                /* standard case */
336:                if (yy_currentPos < yy_endRead)
337:                    return yy_buffer[yy_currentPos++];
338:
339:                /* if the eof is reached, we don't need to work hard */
340:                if (yy_atEOF)
341:                    return YYEOF;
342:
343:                /* otherwise: need to refill the buffer */
344:
345:                /* first: make room (if you can) */
346:                if (yy_startRead > 0) {
347:                    System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0,
348:                            yy_endRead - yy_startRead);
349:
350:                    /* translate stored positions */
351:                    yy_endRead -= yy_startRead;
352:                    yy_currentPos -= yy_startRead;
353:                    yy_markedPos -= yy_startRead;
354:                    yy_pushbackPos -= yy_startRead;
355:                    yy_startRead = 0;
356:                }
357:
358:                /* is the buffer big enough? */
359:                if (yy_currentPos >= yy_buffer.length) {
360:                    /* if not: blow it up */
361:                    char newBuffer[] = new char[yy_currentPos * 2];
362:                    System.arraycopy(yy_buffer, 0, newBuffer, 0,
363:                            yy_buffer.length);
364:                    yy_buffer = newBuffer;
365:                }
366:
367:                /* finally: fill the buffer with new input */
368:                int numRead = yy_reader.read(yy_buffer, yy_endRead,
369:                        yy_buffer.length - yy_endRead);
370:
371:                if (numRead == -1)
372:                    return YYEOF;
373:
374:                yy_endRead += numRead;
375:
376:                return yy_buffer[yy_currentPos++];
377:            }
378:
379:            /**
380:             * Closes the input stream.
381:             */
382:            final public void yyclose() throws java.io.IOException {
383:                yy_atEOF = true; /* indicate end of file */
384:                yy_endRead = yy_startRead; /* invalidate buffer    */
385:
386:                if (yy_reader != null)
387:                    yy_reader.close();
388:            }
389:
390:            /**
391:             * Closes the current stream, and resets the
392:             * scanner to read from a new input stream.
393:             *
394:             * All internal variables are reset, the old input stream 
395:             * <b>cannot</b> be reused (internal buffer is discarded and lost).
396:             * Lexical state is set to <tt>YY_INITIAL</tt>.
397:             *
398:             * @param reader   the new input stream 
399:             */
400:            final public void yyreset(java.io.Reader reader)
401:                    throws java.io.IOException {
402:                yyclose();
403:                yy_reader = reader;
404:                yy_atBOL = true;
405:                yy_atEOF = false;
406:                yy_endRead = yy_startRead = 0;
407:                yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
408:                yyline = yychar = yycolumn = 0;
409:                yy_lexical_state = YYINITIAL;
410:            }
411:
412:            /**
413:             * Returns the current lexical state.
414:             */
415:            final public int yystate() {
416:                return yy_lexical_state;
417:            }
418:
419:            /**
420:             * Enters a new lexical state
421:             *
422:             * @param newState the new lexical state
423:             */
424:            final public void yybegin(int newState) {
425:                yy_lexical_state = newState;
426:            }
427:
428:            /**
429:             * Returns the text matched by the current regular expression.
430:             */
431:            final public String yytext() {
432:                return new String(yy_buffer, yy_startRead, yy_markedPos
433:                        - yy_startRead);
434:            }
435:
436:            /**
437:             * Returns the character at position <tt>pos</tt> from the 
438:             * matched text. 
439:             * 
440:             * It is equivalent to yytext().charAt(pos), but faster
441:             *
442:             * @param pos the position of the character to fetch. 
443:             *            A value from 0 to yylength()-1.
444:             *
445:             * @return the character at position pos
446:             */
447:            final public char yycharat(int pos) {
448:                return yy_buffer[yy_startRead + pos];
449:            }
450:
451:            /**
452:             * Returns the length of the matched text region.
453:             */
454:            final public int yylength() {
455:                return yy_markedPos - yy_startRead;
456:            }
457:
458:            /**
459:             * Reports an error that occured while scanning.
460:             *
461:             * In a wellformed scanner (no or only correct usage of 
462:             * yypushback(int) and a match-all fallback rule) this method 
463:             * will only be called with things that "Can't Possibly Happen".
464:             * If this method is called, something is seriously wrong
465:             * (e.g. a JFlex bug producing a faulty scanner etc.).
466:             *
467:             * Usual syntax/scanner level error handling should be done
468:             * in error fallback rules.
469:             *
470:             * @param   errorCode  the code of the errormessage to display
471:             */
472:            private void yy_ScanError(int errorCode) {
473:                String message;
474:                try {
475:                    message = YY_ERROR_MSG[errorCode];
476:                } catch (ArrayIndexOutOfBoundsException e) {
477:                    message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
478:                }
479:
480:                throw new Error(message);
481:            }
482:
483:            /**
484:             * Pushes the specified amount of characters back into the input stream.
485:             *
486:             * They will be read again by then next call of the scanning method
487:             *
488:             * @param number  the number of characters to be read again.
489:             *                This number must not be greater than yylength()!
490:             */
491:            private void yypushback(int number) {
492:                if (number > yylength())
493:                    yy_ScanError(YY_PUSHBACK_2BIG);
494:
495:                yy_markedPos -= number;
496:            }
497:
498:            /**
499:             * Resumes scanning until the next regular expression is matched,
500:             * the end of input is encountered or an I/O-Error occurs.
501:             *
502:             * @return      the next token
503:             * @exception   IOException  if any I/O-Error occurs
504:             */
505:            public int yylex() throws java.io.IOException {
506:                int yy_input;
507:                int yy_action;
508:
509:                yy_pushbackPos = -1;
510:                boolean yy_was_pushback;
511:
512:                while (true) {
513:
514:                    yychar += yylength();
515:
516:                    yy_action = -1;
517:
518:                    yy_currentPos = yy_startRead = yy_markedPos;
519:
520:                    yy_state = yy_lexical_state;
521:
522:                    yy_was_pushback = false;
523:
524:                    yy_forAction: {
525:                        while (true) {
526:
527:                            yy_input = yy_advance();
528:
529:                            if (yy_input == YYEOF)
530:                                break yy_forAction;
531:
532:                            int yy_next = yytrans[yy_rowMap[yy_state]
533:                                    + yycmap[yy_input]];
534:                            if (yy_next == -1)
535:                                break yy_forAction;
536:                            yy_state = yy_next;
537:
538:                            int yy_attributes = YY_ATTRIBUTE[yy_state];
539:                            if ((yy_attributes & 2) > 0)
540:                                yy_pushbackPos = yy_currentPos;
541:
542:                            if ((yy_attributes & 1) > 0) {
543:                                yy_was_pushback = (yy_attributes & 4) > 0;
544:                                yy_action = yy_state;
545:                                yy_markedPos = yy_currentPos;
546:                                if ((yy_attributes & 8) > 0)
547:                                    break yy_forAction;
548:                            }
549:
550:                        }
551:                    }
552:
553:                    if (yy_was_pushback)
554:                        yy_markedPos = yy_pushbackPos;
555:
556:                    switch (yy_action) {
557:
558:                    case 48: {
559:                        return applyStyle(SyntaxStyle.LITERAL2);
560:                    }
561:                    case 52:
562:                        break;
563:                    case 46: {
564:                        inScript = false;
565:                        String s = scriptBuffer.toString();
566:                        FlexScanner scanner = Flexicizer.getScanner(FileMode
567:                                .getMode(scriptLanguage), new StringReader(s));
568:                        if (scanner != null) {
569:                            scanner.setStyleBuffer(this .styleBuffer);
570:                            scanner.setOffset(offset + spanStart);
571:                            scanner.scan();
572:                        }
573:
574:                        yybegin(YYINITIAL);
575:                        yypushback(yylength());
576:
577:                    }
578:                    case 53:
579:                        break;
580:                    case 36: {
581:                        yybegin(COMMENT_STATE);
582:                        spanStart = yychar;
583:                        return applyStyle(SyntaxStyle.COMMENT2);
584:                    }
585:                    case 54:
586:                        break;
587:                    case 34: {
588:                        yybegin(YYINITIAL);
589:                        return applyStyle(SyntaxStyle.COMMENT3, spanStart,
590:                                yylength() + yychar - spanStart);
591:                    }
592:                    case 55:
593:                        break;
594:                    case 3:
595:                    case 15:
596:                    case 16:
597:                    case 17:
598:                    case 33: {
599:                        if (inLanguage) {
600:                            scriptLanguage = yytext().toLowerCase();
601:                            if (scriptLanguage.startsWith("\"")
602:                                    || scriptLanguage.startsWith("'"))
603:                                scriptLanguage = scriptLanguage
604:                                        .substring(1, Math.max(1,
605:                                                scriptLanguage.length() - 1));
606:
607:                            if (scriptLanguage.startsWith("javascript")
608:                                    || scriptLanguage.equals("jscript")
609:                                    || scriptLanguage.equals("ecmascript"))
610:                                scriptLanguage = "javascript";
611:                        } else
612:                            scriptLanguage = "javascript";
613:
614:                        yybegin(TAG_ATTRIBUTE_STATE);
615:                        return applyStyle(SyntaxStyle.LITERAL1);
616:                    }
617:                    case 56:
618:                        break;
619:                    case 8: {
620:                        if (inScript) {
621:                            scriptBuffer.setLength(0);
622:                            spanStart = yychar + yylength();
623:                            yybegin(SCRIPT_STATE);
624:                        }
625:                        return applyStyle(SyntaxStyle.SEPARATOR2);
626:                    }
627:                    case 57:
628:                        break;
629:                    case 11: {
630:                        yybegin(YYINITIAL);
631:                        open = false;
632:                        return applyStyle(SyntaxStyle.ERROR);
633:                    }
634:                    case 58:
635:                        break;
636:                    case 13: {
637:                        //yybegin((inScript) ? SCRIPT_STATE : YYINITIAL);
638:                        open = false;
639:                        //I should pushback and return to YYINITIAL, and apply this test there
640:                        //return applyStyle(SyntaxStyle.SEPARATOR2);
641:                        yypushback(yylength());
642:                        yybegin(YYINITIAL);
643:                    }
644:                    case 59:
645:                        break;
646:                    case 2:
647:                    case 12: {
648:                        inLanguage = inScript
649:                                && yytext().equalsIgnoreCase("language");
650:                        return applyStyle(SyntaxStyle.TAG2);
651:                    }
652:                    case 60:
653:                        break;
654:                    case 32: {
655:                        return applyStyle(SyntaxStyle.TAG3);
656:                    }
657:                    case 61:
658:                        break;
659:                    case 24: {
660:                        yybegin(TAG_STATE);
661:                        spanStart = yychar;
662:                        open = false;
663:                        return applyStyle(SyntaxStyle.SEPARATOR2);
664:                    }
665:                    case 62:
666:                        break;
667:                    case 22:
668:                    case 23: {
669:                        yybegin(TAG_STATE);
670:                        spanStart = yychar;
671:                        open = true;
672:                        return applyStyle(SyntaxStyle.SEPARATOR2);
673:                    }
674:                    case 63:
675:                        break;
676:                    case 21: {
677:                        scriptBuffer.append("\n");
678:                    }
679:                    case 64:
680:                        break;
681:                    case 19:
682:                    case 20: {
683:                        scriptBuffer.append(yytext());
684:                    }
685:                    case 65:
686:                        break;
687:                    case 1:
688:                    case 10: {
689:                        yybegin(TAG_ATTRIBUTE_STATE);
690:                        inScript = open
691:                                && yytext().trim().equalsIgnoreCase("script");
692:                        return applyStyle(SyntaxStyle.TAG1);
693:                    }
694:                    case 66:
695:                        break;
696:                    case 14: {
697:                        yybegin(TAG_VALUE_STATE);
698:                        return applyStyle(SyntaxStyle.OPERATOR);
699:                    }
700:                    case 67:
701:                        break;
702:                    case 6:
703:                    case 7:
704:                    case 9:
705:                    case 18: {
706:                        return applyStyle(SyntaxStyle.DEFAULT);
707:                    }
708:                    case 68:
709:                        break;
710:                    default:
711:                        if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
712:                            yy_atEOF = true;
713:                            {
714:                                return -1;
715:                            }
716:                        } else {
717:                            yy_ScanError(YY_NO_MATCH);
718:                        }
719:                    }
720:                }
721:            }
722:
723:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.