Source Code Cross Referenced for Lexer.java in  » Template-Engine » bte » com » Ostermiller » bte » 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 » Template Engine » bte » com.Ostermiller.bte 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* The following code was generated by JFlex 1.3.5 on 7/6/04 9:50 PM */
002:
003:        /*
004:         * Lexer.java is a generated file.  You probably want to
005:         * edit Lexer to make changes.  
006:         */
007:
008:        /*
009:         * Copyright (C) 2000-2004 Stephen Ostermiller
010:         * http://ostermiller.org/contact.pl?regarding=BTE
011:         * 
012:         * This program is free software; you can redistribute it and/or modify
013:         * it under the terms of the GNU General Public License as published by
014:         * the Free Software Foundation; either version 2 of the License, or
015:         * (at your option) any later version.
016:         * 
017:         * This program is distributed in the hope that it will be useful,
018:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
019:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
020:         * GNU General Public License for more details.
021:         * 
022:         * See COPYING.TXT for details.
023:         */
024:        package com.Ostermiller.bte;
025:
026:        import java.io.*;
027:        import java_cup.runtime.*;
028:
029:        /**
030:         * This class is a scanner generated by 
031:         * <a href="http://www.jflex.de/">JFlex</a> 1.3.5
032:         * on 7/6/04 9:50 PM from the specification file
033:         * <tt>file:/home/steveo/java/com/Ostermiller/bte/Lexer.lex</tt>
034:         */
035:        class Lexer implements  java_cup.runtime.Scanner {
036:
037:            /** This character denotes the end of file */
038:            final public static int YYEOF = -1;
039:
040:            /** initial size of the lookahead buffer */
041:            final private static int YY_BUFFERSIZE = 16384;
042:
043:            /** lexical states */
044:            final public static int YYINITIAL = 0;
045:
046:            /** 
047:             * Translates characters to character classes
048:             */
049:            final private static String yycmap_packed = "\11\0\1\2\1\3\1\0\1\2\1\3\22\0\1\2\1\0\1\4"
050:                    + "\2\0\1\10\1\0\1\5\5\0\1\1\1\14\1\15\12\1\2\0"
051:                    + "\1\7\1\6\1\16\2\0\1\1\1\11\1\23\1\24\1\13\1\1"
052:                    + "\1\26\1\1\1\21\2\1\1\20\1\1\1\22\1\25\1\17\1\1"
053:                    + "\1\27\1\1\1\12\6\1\6\0\1\1\1\11\1\23\1\24\1\13"
054:                    + "\1\1\1\26\1\1\1\21\2\1\1\20\1\1\1\22\1\25\1\17"
055:                    + "\1\1\1\27\1\1\1\12\6\1\uff85\0";
056:
057:            /** 
058:             * Translates characters to character classes
059:             */
060:            final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
061:
062:            /** 
063:             * Translates a state to a row index in the transition table
064:             */
065:            final private static int yy_rowMap[] = { 0, 24, 48, 72, 96, 120,
066:                    144, 168, 192, 216, 240, 264, 288, 312, 336, 360, 384, 408,
067:                    432, 456, 480, 504, 528, 552, 576, 600, 624, 648, 672, 696,
068:                    720, 744, 768, 792, 816, 840, 864, 888, 912, 936, 960, 984,
069:                    1008, 1032, 1056, 1080, 1104, 1128, 1152, 1176, 1200, 1224,
070:                    1248, 1272, 1296, 1320, 1344, 1368, 1392, 1416, 1440, 1464,
071:                    1488, 1512, 1536, 1560, 1584, 1608, 1632, 1656, 1680, 1632,
072:                    1704, 1728, 1632, 1752, 1776, 1632, 1800, 1824, 1632, 1848,
073:                    1872, 1896, 1920, 1944, 1968, 1992, 2016, 2040, 2064, 2088,
074:                    2112, 2136, 2160, 2184, 2208, 2232, 2256, 2280, 2304, 2328,
075:                    2352, 2376, 2400, 2424, 1632, 1632, 1632, 1632, 1632, 2448,
076:                    2472, 2496, 2520, 2544, 2568, 2592, 2616, 2640, 2664 };
077:
078:            /** 
079:             * The packed transition table of the DFA (part 0)
080:             */
081:            final private static String yy_packed0 = "\2\2\2\3\3\2\1\4\27\2\1\5\22\2\2\3"
082:                    + "\3\2\1\5\30\2\1\6\27\2\1\7\30\2\1\10"
083:                    + "\3\2\1\11\23\2\1\12\3\2\1\13\24\2\1\14"
084:                    + "\26\2\1\15\30\2\1\16\26\2\1\12\31\2\1\17"
085:                    + "\26\2\1\20\30\2\1\21\30\2\1\22\26\2\1\23"
086:                    + "\30\2\1\0\13\2\3\24\1\0\4\24\1\0\1\24"
087:                    + "\1\25\3\24\1\0\2\24\1\26\2\24\1\27\1\30"
088:                    + "\1\31\1\24\14\2\1\32\13\2\3\24\1\0\4\24"
089:                    + "\1\0\5\24\1\0\14\24\1\0\4\24\1\0\5\24"
090:                    + "\1\0\1\33\13\24\1\0\4\24\1\0\5\24\1\0"
091:                    + "\3\24\1\34\10\24\1\0\4\24\1\0\5\24\1\0"
092:                    + "\6\24\1\35\5\24\1\0\4\24\1\0\5\24\1\0"
093:                    + "\3\24\1\36\10\24\1\0\4\24\1\0\5\24\1\0"
094:                    + "\10\24\1\37\3\24\1\0\4\24\1\0\1\24\1\40"
095:                    + "\3\24\1\0\2\24\1\41\2\24\1\42\1\43\1\44"
096:                    + "\4\24\1\0\4\24\1\0\5\24\1\0\1\24\1\45"
097:                    + "\12\24\1\0\4\24\1\0\5\24\1\0\4\24\1\46"
098:                    + "\7\24\1\0\4\24\1\0\5\24\1\0\4\24\1\47"
099:                    + "\7\24\1\0\4\24\1\0\2\24\1\50\2\24\1\0"
100:                    + "\14\24\1\0\4\24\1\0\5\24\1\0\1\51\13\24"
101:                    + "\1\0\4\24\1\0\5\24\1\0\1\52\13\24\1\0"
102:                    + "\4\24\1\0\5\24\1\0\3\24\1\53\10\24\1\0"
103:                    + "\4\24\1\0\5\24\1\0\6\24\1\54\5\24\1\0"
104:                    + "\4\24\1\0\5\24\1\0\3\24\1\55\10\24\1\0"
105:                    + "\4\24\1\0\5\24\1\0\10\24\1\56\1\24\1\57"
106:                    + "\1\45\1\60\4\24\1\61\4\57\1\24\1\0\11\57"
107:                    + "\1\24\1\62\1\46\1\63\4\24\1\64\4\62\1\24"
108:                    + "\1\0\11\62\1\24\1\65\1\47\1\66\4\24\1\67"
109:                    + "\4\65\1\24\1\0\11\65\1\24\1\70\1\50\1\71"
110:                    + "\4\24\1\72\4\70\1\24\1\0\11\70\1\24\1\73"
111:                    + "\1\51\1\74\4\24\1\75\4\73\1\24\1\0\11\73"
112:                    + "\3\24\1\0\4\24\1\0\5\24\1\0\1\24\1\76"
113:                    + "\12\24\1\0\4\24\1\0\5\24\1\0\4\24\1\77"
114:                    + "\7\24\1\0\4\24\1\0\5\24\1\0\4\24\1\100"
115:                    + "\7\24\1\0\4\24\1\0\2\24\1\101\2\24\1\0"
116:                    + "\14\24\1\0\4\24\1\0\5\24\1\0\1\102\11\24"
117:                    + "\2\57\1\103\2\24\1\104\1\24\1\61\4\57\1\24"
118:                    + "\1\0\11\57\1\0\1\103\2\60\4\0\1\61\4\103"
119:                    + "\2\0\11\103\16\0\1\105\11\0\1\24\2\62\1\106"
120:                    + "\2\24\1\107\1\24\1\64\4\62\1\24\1\0\11\62"
121:                    + "\1\0\1\106\2\63\4\0\1\64\4\106\2\0\11\106"
122:                    + "\16\0\1\110\11\0\1\24\2\65\1\111\2\24\1\112"
123:                    + "\1\24\1\67\4\65\1\24\1\0\11\65\1\0\1\111"
124:                    + "\2\66\4\0\1\67\4\111\2\0\11\111\16\0\1\113"
125:                    + "\11\0\1\24\2\70\1\114\2\24\1\115\1\24\1\72"
126:                    + "\4\70\1\24\1\0\11\70\1\0\1\114\2\71\4\0"
127:                    + "\1\72\4\114\2\0\11\114\16\0\1\116\11\0\1\24"
128:                    + "\2\73\1\117\2\24\1\120\1\24\1\75\4\73\1\24"
129:                    + "\1\0\11\73\1\0\1\117\2\74\4\0\1\75\4\117"
130:                    + "\2\0\11\117\16\0\1\121\11\0\2\24\1\76\1\122"
131:                    + "\4\24\1\123\5\24\1\0\13\24\1\77\1\124\4\24"
132:                    + "\1\125\5\24\1\0\13\24\1\100\1\126\4\24\1\127"
133:                    + "\5\24\1\0\13\24\1\101\1\130\4\24\1\131\5\24"
134:                    + "\1\0\13\24\1\102\1\132\4\24\1\133\5\24\1\0"
135:                    + "\11\24\1\0\3\103\2\0\1\134\1\0\1\61\4\103"
136:                    + "\2\0\11\103\1\24\1\45\1\104\1\134\1\135\1\136"
137:                    + "\2\24\1\0\4\45\1\24\1\0\11\45\31\0\3\106"
138:                    + "\2\0\1\137\1\0\1\64\4\106\2\0\11\106\1\24"
139:                    + "\1\46\1\107\1\137\1\140\1\141\2\24\1\0\4\46"
140:                    + "\1\24\1\0\11\46\1\0\3\111\2\0\1\142\1\0"
141:                    + "\1\67\4\111\2\0\11\111\1\24\1\47\1\112\1\142"
142:                    + "\1\143\1\144\2\24\1\0\4\47\1\24\1\0\11\47"
143:                    + "\1\0\3\114\2\0\1\145\1\0\1\72\4\114\2\0"
144:                    + "\11\114\1\24\1\50\1\115\1\145\1\146\1\147\2\24"
145:                    + "\1\0\4\50\1\24\1\0\11\50\1\0\3\117\2\0"
146:                    + "\1\150\1\0\1\75\4\117\2\0\11\117\1\24\1\51"
147:                    + "\1\120\1\150\1\151\1\152\2\24\1\0\4\51\1\24"
148:                    + "\1\0\11\51\2\0\2\122\4\0\1\123\35\0\1\153"
149:                    + "\13\0\2\124\4\0\1\125\35\0\1\154\13\0\2\126"
150:                    + "\4\0\1\127\35\0\1\155\13\0\2\130\4\0\1\131"
151:                    + "\35\0\1\156\13\0\2\132\4\0\1\133\35\0\1\157"
152:                    + "\12\0\1\60\2\134\1\160\1\161\3\0\4\60\2\0"
153:                    + "\11\60\3\135\1\160\1\45\3\135\1\160\5\135\1\160"
154:                    + "\11\135\3\136\1\161\1\136\1\45\2\136\1\161\5\136"
155:                    + "\1\161\11\136\1\0\1\63\2\137\1\162\1\163\3\0"
156:                    + "\4\63\2\0\11\63\3\140\1\162\1\46\3\140\1\162"
157:                    + "\5\140\1\162\11\140\3\141\1\163\1\141\1\46\2\141"
158:                    + "\1\163\5\141\1\163\11\141\1\0\1\66\2\142\1\164"
159:                    + "\1\165\3\0\4\66\2\0\11\66\3\143\1\164\1\47"
160:                    + "\3\143\1\164\5\143\1\164\11\143\3\144\1\165\1\144"
161:                    + "\1\47\2\144\1\165\5\144\1\165\11\144\1\0\1\71"
162:                    + "\2\145\1\166\1\167\3\0\4\71\2\0\11\71\3\146"
163:                    + "\1\166\1\50\3\146\1\166\5\146\1\166\11\146\3\147"
164:                    + "\1\167\1\147\1\50\2\147\1\167\5\147\1\167\11\147"
165:                    + "\1\0\1\74\2\150\1\170\1\171\3\0\4\74\2\0"
166:                    + "\11\74\3\151\1\170\1\51\3\151\1\170\5\151\1\170"
167:                    + "\11\151\3\152\1\171\1\152\1\51\2\152\1\171\5\152"
168:                    + "\1\171\11\152\4\160\1\60\23\160\5\161\1\60\22\161"
169:                    + "\4\162\1\63\23\162\5\163\1\63\22\163\4\164\1\66"
170:                    + "\23\164\5\165\1\66\22\165\4\166\1\71\23\166\5\167"
171:                    + "\1\71\22\167\4\170\1\74\23\170\5\171\1\74\22\171";
172:
173:            /** 
174:             * The transition table of the DFA
175:             */
176:            final private static int yytrans[] = yy_unpack();
177:
178:            /* error codes */
179:            final private static int YY_UNKNOWN_ERROR = 0;
180:            final private static int YY_ILLEGAL_STATE = 1;
181:            final private static int YY_NO_MATCH = 2;
182:            final private static int YY_PUSHBACK_2BIG = 3;
183:
184:            /* error messages for the codes above */
185:            final private static String YY_ERROR_MSG[] = {
186:                    "Unkown internal scanner error",
187:                    "Internal error: unknown state",
188:                    "Error: could not match input",
189:                    "Error: pushback value was too large" };
190:
191:            /**
192:             * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
193:             */
194:            private final static byte YY_ATTRIBUTE[] = { 1, 1, 1, 0, 0, 0, 0,
195:                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
196:                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
197:                    0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0,
198:                    1, 9, 0, 1, 9, 0, 1, 9, 0, 1, 9, 0, 1, 9, 0, 0, 0, 0, 0, 0,
199:                    0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 9,
200:                    9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
201:
202:            /** the input device */
203:            private java.io.Reader yy_reader;
204:
205:            /** the current state of the DFA */
206:            private int yy_state;
207:
208:            /** the current lexical state */
209:            private int yy_lexical_state = YYINITIAL;
210:
211:            /** this buffer contains the current text to be matched and is
212:                the source of the yytext() string */
213:            private char yy_buffer[] = new char[YY_BUFFERSIZE];
214:
215:            /** the textposition at the last accepting state */
216:            private int yy_markedPos;
217:
218:            /** the textposition at the last state to be included in yytext */
219:            private int yy_pushbackPos;
220:
221:            /** the current text position in the buffer */
222:            private int yy_currentPos;
223:
224:            /** startRead marks the beginning of the yytext() string in the buffer */
225:            private int yy_startRead;
226:
227:            /** endRead marks the last character in the buffer, that has been read
228:                from input */
229:            private int yy_endRead;
230:
231:            /** number of newlines encountered up to the start of the matched text */
232:            private int yyline;
233:
234:            /** the number of characters up to the start of the matched text */
235:            private int yychar;
236:
237:            /**
238:             * the number of characters from the last newline up to the start of the 
239:             * matched text
240:             */
241:            private int yycolumn;
242:
243:            /** 
244:             * yy_atBOL == true <=> the scanner is currently at the beginning of a line
245:             */
246:            private boolean yy_atBOL = true;
247:
248:            /** yy_atEOF == true <=> the scanner is at the EOF */
249:            private boolean yy_atEOF;
250:
251:            /* user code: */
252:            /** 
253:             * next Token method that allows you to control if whitespace and comments are
254:             * returned as tokens.
255:             */
256:            Symbol next_token(boolean returnComments, boolean returnWhiteSpace)
257:                    throws IOException, LexException {
258:                Symbol s = next_token();
259:                while (s != null
260:                        && ((!returnWhiteSpace && ((Token) (s.value))
261:                                .isWhiteSpace()) || (!returnComments && ((Token) (s.value))
262:                                .isComment()))) {
263:                    s = next_token();
264:                }
265:                return (s);
266:            }
267:
268:            /**
269:             * Prints out tokens from a file or System.in.
270:             * If no arguments are given, System.in will be used for input.
271:             * If more arguments are given, the first argument will be used as
272:             * the name of the file to use as input
273:             *
274:             * @param args program arguments, of which the first is a filename
275:             */
276:            public static void main(String[] args) {
277:                InputStream in;
278:                try {
279:                    if (args.length > 0) {
280:                        File f = new File(args[0]);
281:                        if (f.exists()) {
282:                            if (f.canRead()) {
283:                                in = new FileInputStream(f);
284:                            } else {
285:                                throw new IOException("Could not open "
286:                                        + args[0]);
287:                            }
288:                        } else {
289:                            throw new IOException("Could not find " + args[0]);
290:                        }
291:                    } else {
292:                        in = System.in;
293:                    }
294:                    Lexer shredder = new Lexer(in);
295:                    Symbol s;
296:                    while ((s = shredder.next_token()).sym != sym.EOF) {
297:                        Token t = (Token) (s.value);
298:                        System.out.println(t);
299:                    }
300:                } catch (Exception e) {
301:                    System.out.println(e.getMessage());
302:                }
303:            }
304:
305:            /**
306:             * Creates a new scanner
307:             * There is also a java.io.InputStream version of this constructor.
308:             *
309:             * @param   in  the java.io.Reader to read input from.
310:             */
311:            Lexer(java.io.Reader in) {
312:                this .yy_reader = in;
313:            }
314:
315:            /**
316:             * Creates a new scanner.
317:             * There is also java.io.Reader version of this constructor.
318:             *
319:             * @param   in  the java.io.Inputstream to read input from.
320:             */
321:            Lexer(java.io.InputStream in) {
322:                this (new java.io.InputStreamReader(in));
323:            }
324:
325:            /** 
326:             * Unpacks the split, compressed DFA transition table.
327:             *
328:             * @return the unpacked transition table
329:             */
330:            private static int[] yy_unpack() {
331:                int[] trans = new int[2688];
332:                int offset = 0;
333:                offset = yy_unpack(yy_packed0, offset, trans);
334:                return trans;
335:            }
336:
337:            /** 
338:             * Unpacks the compressed DFA transition table.
339:             *
340:             * @param packed   the packed transition table
341:             * @return         the index of the last entry
342:             */
343:            private static int yy_unpack(String packed, int offset, int[] trans) {
344:                int i = 0; /* index in packed string  */
345:                int j = offset; /* index in unpacked array */
346:                int l = packed.length();
347:                while (i < l) {
348:                    int count = packed.charAt(i++);
349:                    int value = packed.charAt(i++);
350:                    value--;
351:                    do
352:                        trans[j++] = value;
353:                    while (--count > 0);
354:                }
355:                return j;
356:            }
357:
358:            /** 
359:             * Unpacks the compressed character translation table.
360:             *
361:             * @param packed   the packed character translation table
362:             * @return         the unpacked character translation table
363:             */
364:            private static char[] yy_unpack_cmap(String packed) {
365:                char[] map = new char[0x10000];
366:                int i = 0; /* index in packed string  */
367:                int j = 0; /* index in unpacked array */
368:                while (i < 132) {
369:                    int count = packed.charAt(i++);
370:                    char value = packed.charAt(i++);
371:                    do
372:                        map[j++] = value;
373:                    while (--count > 0);
374:                }
375:                return map;
376:            }
377:
378:            /**
379:             * Refills the input buffer.
380:             *
381:             * @return      <code>false</code>, iff there was new input.
382:             * 
383:             * @exception   IOException  if any I/O-Error occurs
384:             */
385:            private boolean yy_refill() throws java.io.IOException {
386:
387:                /* first: make room (if you can) */
388:                if (yy_startRead > 0) {
389:                    System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0,
390:                            yy_endRead - yy_startRead);
391:
392:                    /* translate stored positions */
393:                    yy_endRead -= yy_startRead;
394:                    yy_currentPos -= yy_startRead;
395:                    yy_markedPos -= yy_startRead;
396:                    yy_pushbackPos -= yy_startRead;
397:                    yy_startRead = 0;
398:                }
399:
400:                /* is the buffer big enough? */
401:                if (yy_currentPos >= yy_buffer.length) {
402:                    /* if not: blow it up */
403:                    char newBuffer[] = new char[yy_currentPos * 2];
404:                    System.arraycopy(yy_buffer, 0, newBuffer, 0,
405:                            yy_buffer.length);
406:                    yy_buffer = newBuffer;
407:                }
408:
409:                /* finally: fill the buffer with new input */
410:                int numRead = yy_reader.read(yy_buffer, yy_endRead,
411:                        yy_buffer.length - yy_endRead);
412:
413:                if (numRead < 0) {
414:                    return true;
415:                } else {
416:                    yy_endRead += numRead;
417:                    return false;
418:                }
419:            }
420:
421:            /**
422:             * Closes the input stream.
423:             */
424:            final public void yyclose() throws java.io.IOException {
425:                yy_atEOF = true; /* indicate end of file */
426:                yy_endRead = yy_startRead; /* invalidate buffer    */
427:
428:                if (yy_reader != null)
429:                    yy_reader.close();
430:            }
431:
432:            /**
433:             * Closes the current stream, and resets the
434:             * scanner to read from a new input stream.
435:             *
436:             * All internal variables are reset, the old input stream 
437:             * <b>cannot</b> be reused (internal buffer is discarded and lost).
438:             * Lexical state is set to <tt>YY_INITIAL</tt>.
439:             *
440:             * @param reader   the new input stream 
441:             */
442:            final public void yyreset(java.io.Reader reader)
443:                    throws java.io.IOException {
444:                yyclose();
445:                yy_reader = reader;
446:                yy_atBOL = true;
447:                yy_atEOF = false;
448:                yy_endRead = yy_startRead = 0;
449:                yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
450:                yyline = yychar = yycolumn = 0;
451:                yy_lexical_state = YYINITIAL;
452:            }
453:
454:            /**
455:             * Returns the current lexical state.
456:             */
457:            final public int yystate() {
458:                return yy_lexical_state;
459:            }
460:
461:            /**
462:             * Enters a new lexical state
463:             *
464:             * @param newState the new lexical state
465:             */
466:            final public void yybegin(int newState) {
467:                yy_lexical_state = newState;
468:            }
469:
470:            /**
471:             * Returns the text matched by the current regular expression.
472:             */
473:            final public String yytext() {
474:                return new String(yy_buffer, yy_startRead, yy_markedPos
475:                        - yy_startRead);
476:            }
477:
478:            /**
479:             * Returns the character at position <tt>pos</tt> from the 
480:             * matched text. 
481:             * 
482:             * It is equivalent to yytext().charAt(pos), but faster
483:             *
484:             * @param pos the position of the character to fetch. 
485:             *            A value from 0 to yylength()-1.
486:             *
487:             * @return the character at position pos
488:             */
489:            final public char yycharat(int pos) {
490:                return yy_buffer[yy_startRead + pos];
491:            }
492:
493:            /**
494:             * Returns the length of the matched text region.
495:             */
496:            final public int yylength() {
497:                return yy_markedPos - yy_startRead;
498:            }
499:
500:            /**
501:             * Reports an error that occured while scanning.
502:             *
503:             * In a wellformed scanner (no or only correct usage of 
504:             * yypushback(int) and a match-all fallback rule) this method 
505:             * will only be called with things that "Can't Possibly Happen".
506:             * If this method is called, something is seriously wrong
507:             * (e.g. a JFlex bug producing a faulty scanner etc.).
508:             *
509:             * Usual syntax/scanner level error handling should be done
510:             * in error fallback rules.
511:             *
512:             * @param   errorCode  the code of the errormessage to display
513:             */
514:            private void yy_ScanError(int errorCode) {
515:                String message;
516:                try {
517:                    message = YY_ERROR_MSG[errorCode];
518:                } catch (ArrayIndexOutOfBoundsException e) {
519:                    message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
520:                }
521:
522:                throw new Error(message);
523:            }
524:
525:            /**
526:             * Pushes the specified amount of characters back into the input stream.
527:             *
528:             * They will be read again by then next call of the scanning method
529:             *
530:             * @param number  the number of characters to be read again.
531:             *                This number must not be greater than yylength()!
532:             */
533:            private void yypushback(int number) {
534:                if (number > yylength())
535:                    yy_ScanError(YY_PUSHBACK_2BIG);
536:
537:                yy_markedPos -= number;
538:            }
539:
540:            /**
541:             * Resumes scanning until the next regular expression is matched,
542:             * the end of input is encountered or an I/O-Error occurs.
543:             *
544:             * @return      the next token
545:             * @exception   IOException  if any I/O-Error occurs
546:             */
547:            public java_cup.runtime.Symbol next_token()
548:                    throws java.io.IOException, LexException {
549:                int yy_input;
550:                int yy_action;
551:
552:                // cached fields:
553:                int yy_currentPos_l;
554:                int yy_startRead_l;
555:                int yy_markedPos_l;
556:                int yy_endRead_l = yy_endRead;
557:                char[] yy_buffer_l = yy_buffer;
558:                char[] yycmap_l = yycmap;
559:
560:                int[] yytrans_l = yytrans;
561:                int[] yy_rowMap_l = yy_rowMap;
562:                byte[] yy_attr_l = YY_ATTRIBUTE;
563:
564:                while (true) {
565:                    yy_markedPos_l = yy_markedPos;
566:
567:                    yychar += yy_markedPos_l - yy_startRead;
568:
569:                    boolean yy_r = false;
570:                    for (yy_currentPos_l = yy_startRead; yy_currentPos_l < yy_markedPos_l; yy_currentPos_l++) {
571:                        switch (yy_buffer_l[yy_currentPos_l]) {
572:                        case '\u000B':
573:                        case '\u000C':
574:                        case '\u0085':
575:                        case '\u2028':
576:                        case '\u2029':
577:                            yyline++;
578:                            yy_r = false;
579:                            break;
580:                        case '\r':
581:                            yyline++;
582:                            yy_r = true;
583:                            break;
584:                        case '\n':
585:                            if (yy_r)
586:                                yy_r = false;
587:                            else {
588:                                yyline++;
589:                            }
590:                            break;
591:                        default:
592:                            yy_r = false;
593:                        }
594:                    }
595:
596:                    if (yy_r) {
597:                        // peek one character ahead if it is \n (if we have counted one line too much)
598:                        boolean yy_peek;
599:                        if (yy_markedPos_l < yy_endRead_l)
600:                            yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
601:                        else if (yy_atEOF)
602:                            yy_peek = false;
603:                        else {
604:                            boolean eof = yy_refill();
605:                            yy_markedPos_l = yy_markedPos;
606:                            yy_buffer_l = yy_buffer;
607:                            if (eof)
608:                                yy_peek = false;
609:                            else
610:                                yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
611:                        }
612:                        if (yy_peek)
613:                            yyline--;
614:                    }
615:                    yy_action = -1;
616:
617:                    yy_startRead_l = yy_currentPos_l = yy_currentPos = yy_startRead = yy_markedPos_l;
618:
619:                    yy_state = yy_lexical_state;
620:
621:                    yy_forAction: {
622:                        while (true) {
623:
624:                            if (yy_currentPos_l < yy_endRead_l)
625:                                yy_input = yy_buffer_l[yy_currentPos_l++];
626:                            else if (yy_atEOF) {
627:                                yy_input = YYEOF;
628:                                break yy_forAction;
629:                            } else {
630:                                // store back cached positions
631:                                yy_currentPos = yy_currentPos_l;
632:                                yy_markedPos = yy_markedPos_l;
633:                                boolean eof = yy_refill();
634:                                // get translated positions and possibly new buffer
635:                                yy_currentPos_l = yy_currentPos;
636:                                yy_markedPos_l = yy_markedPos;
637:                                yy_buffer_l = yy_buffer;
638:                                yy_endRead_l = yy_endRead;
639:                                if (eof) {
640:                                    yy_input = YYEOF;
641:                                    break yy_forAction;
642:                                } else {
643:                                    yy_input = yy_buffer_l[yy_currentPos_l++];
644:                                }
645:                            }
646:                            int yy_next = yytrans_l[yy_rowMap_l[yy_state]
647:                                    + yycmap_l[yy_input]];
648:                            if (yy_next == -1)
649:                                break yy_forAction;
650:                            yy_state = yy_next;
651:
652:                            int yy_attributes = yy_attr_l[yy_state];
653:                            if ((yy_attributes & 1) == 1) {
654:                                yy_action = yy_state;
655:                                yy_markedPos_l = yy_currentPos_l;
656:                                if ((yy_attributes & 8) == 8)
657:                                    break yy_forAction;
658:                            }
659:
660:                        }
661:                    }
662:
663:                    // store back cached position
664:                    yy_markedPos = yy_markedPos_l;
665:
666:                    switch (yy_action) {
667:
668:                    case 110: {
669:                        int ID = sym.END_GROUP;
670:                        String text = yytext();
671:                        Token t = (new Token(ID, text, yyline + 1, yychar,
672:                                yychar + text.length()));
673:                        return (new Symbol(ID, t));
674:                    }
675:                    case 122:
676:                        break;
677:                    case 108: {
678:                        int ID = sym.END_DOCUMENT;
679:                        String text = yytext();
680:                        Token t = (new Token(ID, text, yyline + 1, yychar,
681:                                yychar + text.length()));
682:                        return (new Symbol(ID, t));
683:                    }
684:                    case 123:
685:                        break;
686:                    case 106: {
687:                        int ID = sym.END_TEMPLATE;
688:                        String text = yytext();
689:                        Token t = (new Token(ID, text, yyline + 1, yychar,
690:                                yychar + text.length()));
691:                        return (new Symbol(ID, t));
692:                    }
693:                    case 124:
694:                        break;
695:                    case 77: {
696:                        int ID = sym.START_ONE;
697:                        String text = yytext();
698:                        Token t = (new Token(ID, text, yyline + 1, yychar,
699:                                yychar + text.length()));
700:                        return (new Symbol(ID, t));
701:                    }
702:                    case 125:
703:                        break;
704:                    case 71: {
705:                        int ID = sym.START_INCLUDE;
706:                        String text = yytext();
707:                        Token t = (new Token(ID, text, yyline + 1, yychar,
708:                                yychar + text.length()));
709:                        return (new Symbol(ID, t));
710:                    }
711:                    case 126:
712:                        break;
713:                    case 109: {
714:                        int ID = sym.END_ONE;
715:                        String text = yytext();
716:                        Token t = (new Token(ID, text, yyline + 1, yychar,
717:                                yychar + text.length()));
718:                        return (new Symbol(ID, t));
719:                    }
720:                    case 127:
721:                        break;
722:                    case 0:
723:                    case 2: {
724:                        int ID = sym.WHITESPACE;
725:                        String text = yytext();
726:                        Token t = (new Token(ID, text, yyline + 1, yychar,
727:                                yychar + text.length()));
728:                        return (new Symbol(ID, t));
729:                    }
730:                    case 128:
731:                        break;
732:                    case 1: {
733:                        int ID = sym.TEXT;
734:                        String text = yytext();
735:                        Token t = (new Token(ID, text, yyline + 1, yychar,
736:                                yychar + text.length()));
737:                        return (new Symbol(ID, t));
738:                    }
739:                    case 129:
740:                        break;
741:                    case 80: {
742:                        int ID = sym.START_GROUP;
743:                        String text = yytext();
744:                        Token t = (new Token(ID, text, yyline + 1, yychar,
745:                                yychar + text.length()));
746:                        return (new Symbol(ID, t));
747:                    }
748:                    case 130:
749:                        break;
750:                    case 68: {
751:                        int ID = sym.START_TEMPLATE;
752:                        String text = yytext();
753:                        Token t = (new Token(ID, text, yyline + 1, yychar,
754:                                yychar + text.length()));
755:                        return (new Symbol(ID, t));
756:                    }
757:                    case 131:
758:                        break;
759:                    case 74: {
760:                        int ID = sym.START_DOCUMENT;
761:                        String text = yytext();
762:                        Token t = (new Token(ID, text, yyline + 1, yychar,
763:                                yychar + text.length()));
764:                        return (new Symbol(ID, t));
765:                    }
766:                    case 132:
767:                        break;
768:                    case 107: {
769:                        int ID = sym.error;
770:                        String text = yytext();
771:                        Token t = (new Token(ID, text, yyline + 1, yychar,
772:                                yychar + text.length()));
773:                        throw new LexException("Line " + t.getLineNumber()
774:                                + ": unexpected tag: '" + t.getContents()
775:                                + "'\n");
776:                    }
777:                    case 133:
778:                        break;
779:                    case 17:
780:                    case 19:
781:                    case 20:
782:                    case 21:
783:                    case 22:
784:                    case 23:
785:                    case 24:
786:                    case 25:
787:                    case 26:
788:                    case 27:
789:                    case 28:
790:                    case 29:
791:                    case 30:
792:                    case 31:
793:                    case 32:
794:                    case 33:
795:                    case 34:
796:                    case 35:
797:                    case 36:
798:                    case 37:
799:                    case 38:
800:                    case 39:
801:                    case 40:
802:                    case 41:
803:                    case 42:
804:                    case 43:
805:                    case 44:
806:                    case 45:
807:                    case 46:
808:                    case 49:
809:                    case 52:
810:                    case 55:
811:                    case 58:
812:                    case 61:
813:                    case 62:
814:                    case 63:
815:                    case 64:
816:                    case 65:
817:                    case 67:
818:                    case 70:
819:                    case 73:
820:                    case 76:
821:                    case 79:
822:                    case 92:
823:                    case 93:
824:                    case 95:
825:                    case 96:
826:                    case 98:
827:                    case 99:
828:                    case 101:
829:                    case 102:
830:                    case 104:
831:                    case 105: {
832:                        int ID = sym.error;
833:                        String text = yytext();
834:                        Token t = (new Token(ID, text, yyline + 1, yychar,
835:                                yychar + text.length()));
836:                        throw new LexException("Line " + t.getLineNumber()
837:                                + ": unknown or malformed bte tag: '"
838:                                + t.getContents() + "'\n");
839:                    }
840:                    case 134:
841:                        break;
842:                    default:
843:                        if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
844:                            yy_atEOF = true;
845:                            {
846:                                return new Symbol(sym.EOF);
847:                            }
848:                        } else {
849:                            yy_ScanError(YY_NO_MATCH);
850:                        }
851:                    }
852:                }
853:            }
854:
855:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.