Source Code Cross Referenced for SpecLexer.java in  » Parser » SJPT » ro » infoiasi » donald » compiler » parser » 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 » Parser » SJPT » ro.infoiasi.donald.compiler.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* The following code was generated by JFlex 1.4 on 19/10/04 10:42 */
002:
003:        /*
004:         A Simple Context Free Grammar Lexer
005:         Catalin Hritcu <donald at infoiasi dot ro>
006:         */
007:
008:        package ro.infoiasi.donald.compiler.parser;
009:
010:        /**
011:         * This class is a scanner generated by 
012:         * <a href="http://www.jflex.de/">JFlex</a> 1.4
013:         * on 19/10/04 10:42 from the specification file
014:         * <tt>SpecLexer.flex</tt>
015:         */
016:        public class SpecLexer implements  java_cup.runtime.Scanner {
017:
018:            /** This character denotes the end of file */
019:            public static final int YYEOF = -1;
020:
021:            /** initial size of the lookahead buffer */
022:            private static final int ZZ_BUFFERSIZE = 16384;
023:
024:            /** lexical states */
025:            public static final int CODE = 1;
026:            public static final int YYINITIAL = 0;
027:
028:            /** 
029:             * Translates characters to character classes
030:             */
031:            private static final char[] ZZ_CMAP = { 7, 7, 7, 7, 7, 7, 7, 7, 7,
032:                    3, 2, 0, 3, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0,
033:                    0, 0, 0, 3, 0, 0, 0, 6, 26, 0, 0, 0, 0, 5, 0, 31, 0, 32, 4,
034:                    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 27, 30, 0, 28, 0, 0, 0, 6, 6,
035:                    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
036:                    6, 6, 6, 6, 33, 0, 34, 0, 6, 0, 9, 6, 10, 21, 13, 25, 12,
037:                    23, 14, 6, 11, 24, 15, 19, 16, 8, 6, 17, 20, 18, 6, 6, 22,
038:                    6, 6, 6, 35, 29, 36, 0, 7 };
039:
040:            /** 
041:             * Translates DFA states to action switch labels.
042:             */
043:            private static final int[] ZZ_ACTION = zzUnpackAction();
044:
045:            private static final String ZZ_ACTION_PACKED_0 = "\2\0\1\1\2\2\1\1\1\3\13\4\1\1\1\5"
046:                    + "\1\6\1\7\1\10\1\11\1\12\1\13\1\1\2\14"
047:                    + "\1\2\1\0\15\4\2\0\1\15\1\16\1\0\11\4"
048:                    + "\1\17\4\4\1\0\1\20\1\0\4\4\1\21\1\4"
049:                    + "\1\22\4\4\1\23\1\4\1\24\1\25\1\0\5\4"
050:                    + "\1\26\3\4\1\27\1\30\1\4\1\31\1\4\1\32"
051:                    + "\1\33\3\4\1\34\5\4\1\35\1\36\3\4\1\37" + "\1\4\1\40";
052:
053:            private static int[] zzUnpackAction() {
054:                int[] result = new int[115];
055:                int offset = 0;
056:                offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
057:                return result;
058:            }
059:
060:            private static int zzUnpackAction(String packed, int offset,
061:                    int[] result) {
062:                int i = 0; /* index in packed string  */
063:                int j = offset; /* index in unpacked array */
064:                int l = packed.length();
065:                while (i < l) {
066:                    int count = packed.charAt(i++);
067:                    int value = packed.charAt(i++);
068:                    do
069:                        result[j++] = value;
070:                    while (--count > 0);
071:                }
072:                return j;
073:            }
074:
075:            /** 
076:             * Translates a state to a row index in the transition table
077:             */
078:            private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
079:
080:            private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\45\0\112\0\157\0\112\0\224\0\112\0\271"
081:                    + "\0\336\0\u0103\0\u0128\0\u014d\0\u0172\0\u0197\0\u01bc\0\u01e1"
082:                    + "\0\u0206\0\u022b\0\u0250\0\u0275\0\112\0\112\0\112\0\112"
083:                    + "\0\112\0\112\0\u029a\0\112\0\u02bf\0\u02e4\0\u0309\0\u032e"
084:                    + "\0\u0353\0\u0378\0\u039d\0\u03c2\0\u03e7\0\u040c\0\u0431\0\u0456"
085:                    + "\0\u047b\0\u04a0\0\u04c5\0\u04ea\0\u050f\0\u0534\0\112\0\112"
086:                    + "\0\u0559\0\u057e\0\u05a3\0\u05c8\0\u05ed\0\u0612\0\u0637\0\u065c"
087:                    + "\0\u0681\0\u06a6\0\u06cb\0\u06f0\0\u0715\0\u073a\0\u075f\0\u0784"
088:                    + "\0\112\0\u07a9\0\u07ce\0\u07f3\0\u0818\0\u083d\0\271\0\u0862"
089:                    + "\0\271\0\u0887\0\u08ac\0\u08d1\0\u08f6\0\271\0\u091b\0\271"
090:                    + "\0\271\0\u0940\0\u0965\0\u098a\0\u09af\0\u09d4\0\u09f9\0\271"
091:                    + "\0\u0a1e\0\u0a43\0\u0a68\0\271\0\112\0\u0a8d\0\271\0\u0ab2"
092:                    + "\0\271\0\271\0\u0ad7\0\u0afc\0\u0b21\0\271\0\u0b46\0\u0b6b"
093:                    + "\0\u0b90\0\u0bb5\0\u0bda\0\271\0\271\0\u0bff\0\u0c24\0\u0c49"
094:                    + "\0\271\0\u0c6e\0\271";
095:
096:            private static int[] zzUnpackRowMap() {
097:                int[] result = new int[115];
098:                int offset = 0;
099:                offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
100:                return result;
101:            }
102:
103:            private static int zzUnpackRowMap(String packed, int offset,
104:                    int[] result) {
105:                int i = 0; /* index in packed string  */
106:                int j = offset; /* index in unpacked array */
107:                int l = packed.length();
108:                while (i < l) {
109:                    int high = packed.charAt(i++) << 16;
110:                    result[j++] = high | packed.charAt(i++);
111:                }
112:                return j;
113:            }
114:
115:            /** 
116:             * The transition table of the DFA
117:             */
118:            private static final int[] ZZ_TRANS = zzUnpackTrans();
119:
120:            private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\2\5\1\6\1\7\1\10\1\3\1\11"
121:                    + "\1\12\1\13\3\10\1\14\2\10\1\15\1\16\1\17"
122:                    + "\1\20\1\10\1\21\1\10\1\22\1\10\1\23\1\24"
123:                    + "\1\3\1\25\1\26\1\27\1\30\1\31\1\32\1\33"
124:                    + "\1\3\33\34\1\35\11\34\47\0\1\5\46\0\1\36"
125:                    + "\1\37\45\0\24\10\21\0\3\10\1\40\7\10\1\41"
126:                    + "\10\10\21\0\4\10\1\42\17\10\21\0\12\10\1\43"
127:                    + "\11\10\21\0\11\10\1\44\3\10\1\45\6\10\21\0"
128:                    + "\10\10\1\46\13\10\21\0\7\10\1\47\14\10\21\0"
129:                    + "\12\10\1\50\11\10\21\0\4\10\1\51\7\10\1\52"
130:                    + "\7\10\21\0\10\10\1\53\13\10\21\0\7\10\1\54"
131:                    + "\14\10\23\0\1\55\67\0\1\56\44\0\1\57\55\0"
132:                    + "\1\60\1\36\1\4\1\5\42\36\45\61\6\0\4\10"
133:                    + "\1\62\6\10\1\63\10\10\21\0\7\10\1\64\14\10"
134:                    + "\21\0\14\10\1\65\7\10\21\0\17\10\1\66\4\10"
135:                    + "\21\0\2\10\1\67\21\10\21\0\10\10\1\70\13\10"
136:                    + "\21\0\6\10\1\71\15\10\21\0\13\10\1\72\10\10"
137:                    + "\21\0\15\10\1\73\6\10\21\0\3\10\1\74\20\10"
138:                    + "\21\0\3\10\1\75\20\10\21\0\14\10\1\76\7\10"
139:                    + "\21\0\23\10\1\77\34\0\1\100\57\0\1\101\10\0"
140:                    + "\5\61\1\102\37\61\6\0\5\10\1\103\16\10\21\0"
141:                    + "\16\10\1\104\5\10\21\0\4\10\1\105\17\10\21\0"
142:                    + "\10\10\1\106\13\10\21\0\7\10\1\107\14\10\21\0"
143:                    + "\12\10\1\110\11\10\21\0\14\10\1\111\7\10\21\0"
144:                    + "\21\10\1\112\2\10\21\0\11\10\1\113\12\10\21\0"
145:                    + "\3\10\1\114\10\10\1\115\7\10\21\0\15\10\1\116"
146:                    + "\6\10\21\0\13\10\1\117\10\10\21\0\21\10\1\120"
147:                    + "\2\10\21\0\14\10\1\121\7\10\30\0\1\122\27\0"
148:                    + "\4\61\1\5\1\102\37\61\6\0\3\10\1\123\20\10"
149:                    + "\21\0\7\10\1\124\14\10\21\0\7\10\1\125\14\10"
150:                    + "\21\0\12\10\1\126\11\10\21\0\13\10\1\127\10\10"
151:                    + "\21\0\14\10\1\130\7\10\21\0\10\10\1\131\13\10"
152:                    + "\21\0\16\10\1\132\5\10\21\0\7\10\1\133\14\10"
153:                    + "\21\0\14\10\1\134\7\10\25\0\1\135\40\0\6\10"
154:                    + "\1\136\15\10\21\0\13\10\1\137\10\10\21\0\17\10"
155:                    + "\1\140\4\10\21\0\15\10\1\141\6\10\21\0\14\10"
156:                    + "\1\142\7\10\21\0\15\10\1\143\6\10\21\0\16\10"
157:                    + "\1\144\5\10\21\0\13\10\1\145\10\10\21\0\7\10"
158:                    + "\1\146\14\10\21\0\7\10\1\147\14\10\21\0\3\10"
159:                    + "\1\150\20\10\21\0\12\10\1\151\11\10\21\0\11\10"
160:                    + "\1\152\12\10\21\0\15\10\1\153\6\10\21\0\22\10"
161:                    + "\1\154\1\10\21\0\4\10\1\155\17\10\21\0\10\10"
162:                    + "\1\156\13\10\21\0\4\10\1\157\17\10\21\0\15\10"
163:                    + "\1\160\6\10\21\0\7\10\1\161\14\10\21\0\3\10"
164:                    + "\1\162\20\10\21\0\22\10\1\163\1\10\13\0";
165:
166:            private static int[] zzUnpackTrans() {
167:                int[] result = new int[3219];
168:                int offset = 0;
169:                offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
170:                return result;
171:            }
172:
173:            private static int zzUnpackTrans(String packed, int offset,
174:                    int[] result) {
175:                int i = 0; /* index in packed string  */
176:                int j = offset; /* index in unpacked array */
177:                int l = packed.length();
178:                while (i < l) {
179:                    int count = packed.charAt(i++);
180:                    int value = packed.charAt(i++);
181:                    value--;
182:                    do
183:                        result[j++] = value;
184:                    while (--count > 0);
185:                }
186:                return j;
187:            }
188:
189:            /* error codes */
190:            private static final int ZZ_UNKNOWN_ERROR = 0;
191:            private static final int ZZ_NO_MATCH = 1;
192:            private static final int ZZ_PUSHBACK_2BIG = 2;
193:
194:            /* error messages for the codes above */
195:            private static final String ZZ_ERROR_MSG[] = {
196:                    "Unkown internal scanner error",
197:                    "Error: could not match input",
198:                    "Error: pushback value was too large" };
199:
200:            /**
201:             * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
202:             */
203:            private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
204:
205:            private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\1\1\1\11\1\1\1\11\15\1\6\11"
206:                    + "\1\1\1\11\2\1\1\0\15\1\2\0\2\11\1\0"
207:                    + "\16\1\1\0\1\11\1\0\17\1\1\0\12\1\1\11" + "\26\1";
208:
209:            private static int[] zzUnpackAttribute() {
210:                int[] result = new int[115];
211:                int offset = 0;
212:                offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset,
213:                        result);
214:                return result;
215:            }
216:
217:            private static int zzUnpackAttribute(String packed, int offset,
218:                    int[] result) {
219:                int i = 0; /* index in packed string  */
220:                int j = offset; /* index in unpacked array */
221:                int l = packed.length();
222:                while (i < l) {
223:                    int count = packed.charAt(i++);
224:                    int value = packed.charAt(i++);
225:                    do
226:                        result[j++] = value;
227:                    while (--count > 0);
228:                }
229:                return j;
230:            }
231:
232:            /** the input device */
233:            private java.io.Reader zzReader;
234:
235:            /** the current state of the DFA */
236:            private int zzState;
237:
238:            /** the current lexical state */
239:            private int zzLexicalState = YYINITIAL;
240:
241:            /** this buffer contains the current text to be matched and is
242:                the source of the yytext() string */
243:            private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
244:
245:            /** the textposition at the last accepting state */
246:            private int zzMarkedPos;
247:
248:            /** the textposition at the last state to be included in yytext */
249:            private int zzPushbackPos;
250:
251:            /** the current text position in the buffer */
252:            private int zzCurrentPos;
253:
254:            /** startRead marks the beginning of the yytext() string in the buffer */
255:            private int zzStartRead;
256:
257:            /** endRead marks the last character in the buffer, that has been read
258:                from input */
259:            private int zzEndRead;
260:
261:            /** number of newlines encountered up to the start of the matched text */
262:            private int yyline;
263:
264:            /** the number of characters up to the start of the matched text */
265:            private int yychar;
266:
267:            /**
268:             * the number of characters from the last newline up to the start of the 
269:             * matched text
270:             */
271:            private int yycolumn;
272:
273:            /** 
274:             * zzAtBOL == true <=> the scanner is currently at the beginning of a line
275:             */
276:            private boolean zzAtBOL = true;
277:
278:            /** zzAtEOF == true <=> the scanner is at the EOF */
279:            private boolean zzAtEOF;
280:
281:            /** denotes if the user-EOF-code has already been executed */
282:            private boolean zzEOFDone;
283:
284:            /* user code: */
285:            class LexerError extends RuntimeException {
286:                LexerError() {
287:                    super ();
288:                }
289:
290:                LexerError(String msg, String reason, int line, int column) {
291:                    super ("Lexer Error: "
292:                            + msg
293:                            + ((reason.length() > 0) ? " \"" + reason + "\""
294:                                    : "") + " line: " + line + " column:"
295:                            + column);
296:                }
297:            }
298:
299:            private StringBuffer sb = new StringBuffer();
300:
301:            private java_cup.runtime.Symbol symbol(int type) {
302:                return new java_cup.runtime.Symbol(type, yyline + 1,
303:                        yycolumn + 1);
304:            }
305:
306:            private java_cup.runtime.Symbol symbol(int type, Object value) {
307:                return new java_cup.runtime.Symbol(type, yyline + 1,
308:                        yycolumn + 1, value);
309:            }
310:
311:            private void error(String msg) throws LexerError {
312:                throw new LexerError(msg, yytext(), yyline, yycolumn);
313:            }
314:
315:            /**
316:             * Creates a new scanner
317:             * There is also a java.io.InputStream version of this constructor.
318:             *
319:             * @param   in  the java.io.Reader to read input from.
320:             */
321:            public SpecLexer(java.io.Reader in) {
322:                this .zzReader = in;
323:            }
324:
325:            /**
326:             * Creates a new scanner.
327:             * There is also java.io.Reader version of this constructor.
328:             *
329:             * @param   in  the java.io.Inputstream to read input from.
330:             */
331:            public SpecLexer(java.io.InputStream in) {
332:                this (new java.io.InputStreamReader(in));
333:            }
334:
335:            /**
336:             * Refills the input buffer.
337:             *
338:             * @return      <code>false</code>, iff there was new input.
339:             * 
340:             * @exception   java.io.IOException  if any I/O-Error occurs
341:             */
342:            private boolean zzRefill() throws java.io.IOException {
343:
344:                /* first: make room (if you can) */
345:                if (zzStartRead > 0) {
346:                    System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0,
347:                            zzEndRead - zzStartRead);
348:
349:                    /* translate stored positions */
350:                    zzEndRead -= zzStartRead;
351:                    zzCurrentPos -= zzStartRead;
352:                    zzMarkedPos -= zzStartRead;
353:                    zzPushbackPos -= zzStartRead;
354:                    zzStartRead = 0;
355:                }
356:
357:                /* is the buffer big enough? */
358:                if (zzCurrentPos >= zzBuffer.length) {
359:                    /* if not: blow it up */
360:                    char newBuffer[] = new char[zzCurrentPos * 2];
361:                    System
362:                            .arraycopy(zzBuffer, 0, newBuffer, 0,
363:                                    zzBuffer.length);
364:                    zzBuffer = newBuffer;
365:                }
366:
367:                /* finally: fill the buffer with new input */
368:                int numRead = zzReader.read(zzBuffer, zzEndRead,
369:                        zzBuffer.length - zzEndRead);
370:
371:                if (numRead < 0) {
372:                    return true;
373:                } else {
374:                    zzEndRead += numRead;
375:                    return false;
376:                }
377:            }
378:
379:            /**
380:             * Closes the input stream.
381:             */
382:            public final void yyclose() throws java.io.IOException {
383:                zzAtEOF = true; /* indicate end of file */
384:                zzEndRead = zzStartRead; /* invalidate buffer    */
385:
386:                if (zzReader != null)
387:                    zzReader.close();
388:            }
389:
390:            /**
391:             * Resets the scanner to read from a new input stream.
392:             * Does not close the old reader.
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>ZZ_INITIAL</tt>.
397:             *
398:             * @param reader   the new input stream 
399:             */
400:            public final void yyreset(java.io.Reader reader) {
401:                zzReader = reader;
402:                zzAtBOL = true;
403:                zzAtEOF = false;
404:                zzEndRead = zzStartRead = 0;
405:                zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
406:                yyline = yychar = yycolumn = 0;
407:                zzLexicalState = YYINITIAL;
408:            }
409:
410:            /**
411:             * Returns the current lexical state.
412:             */
413:            public final int yystate() {
414:                return zzLexicalState;
415:            }
416:
417:            /**
418:             * Enters a new lexical state
419:             *
420:             * @param newState the new lexical state
421:             */
422:            public final void yybegin(int newState) {
423:                zzLexicalState = newState;
424:            }
425:
426:            /**
427:             * Returns the text matched by the current regular expression.
428:             */
429:            public final String yytext() {
430:                return new String(zzBuffer, zzStartRead, zzMarkedPos
431:                        - zzStartRead);
432:            }
433:
434:            /**
435:             * Returns the character at position <tt>pos</tt> from the 
436:             * matched text. 
437:             * 
438:             * It is equivalent to yytext().charAt(pos), but faster
439:             *
440:             * @param pos the position of the character to fetch. 
441:             *            A value from 0 to yylength()-1.
442:             *
443:             * @return the character at position pos
444:             */
445:            public final char yycharat(int pos) {
446:                return zzBuffer[zzStartRead + pos];
447:            }
448:
449:            /**
450:             * Returns the length of the matched text region.
451:             */
452:            public final int yylength() {
453:                return zzMarkedPos - zzStartRead;
454:            }
455:
456:            /**
457:             * Reports an error that occured while scanning.
458:             *
459:             * In a wellformed scanner (no or only correct usage of 
460:             * yypushback(int) and a match-all fallback rule) this method 
461:             * will only be called with things that "Can't Possibly Happen".
462:             * If this method is called, something is seriously wrong
463:             * (e.g. a JFlex bug producing a faulty scanner etc.).
464:             *
465:             * Usual syntax/scanner level error handling should be done
466:             * in error fallback rules.
467:             *
468:             * @param   errorCode  the code of the errormessage to display
469:             */
470:            private void zzScanError(int errorCode) {
471:                String message;
472:                try {
473:                    message = ZZ_ERROR_MSG[errorCode];
474:                } catch (ArrayIndexOutOfBoundsException e) {
475:                    message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
476:                }
477:
478:                throw new Error(message);
479:            }
480:
481:            /**
482:             * Pushes the specified amount of characters back into the input stream.
483:             *
484:             * They will be read again by then next call of the scanning method
485:             *
486:             * @param number  the number of characters to be read again.
487:             *                This number must not be greater than yylength()!
488:             */
489:            public void yypushback(int number) {
490:                if (number > yylength())
491:                    zzScanError(ZZ_PUSHBACK_2BIG);
492:
493:                zzMarkedPos -= number;
494:            }
495:
496:            /**
497:             * Contains user EOF-code, which will be executed exactly once,
498:             * when the end of file is reached
499:             */
500:            private void zzDoEOF() throws java.io.IOException {
501:                if (!zzEOFDone) {
502:                    zzEOFDone = true;
503:                    yyclose();
504:                }
505:            }
506:
507:            /**
508:             * Resumes scanning until the next regular expression is matched,
509:             * the end of input is encountered or an I/O-Error occurs.
510:             *
511:             * @return      the next token
512:             * @exception   java.io.IOException  if any I/O-Error occurs
513:             */
514:            public java_cup.runtime.Symbol next_token()
515:                    throws java.io.IOException {
516:                int zzInput;
517:                int zzAction;
518:
519:                // cached fields:
520:                int zzCurrentPosL;
521:                int zzMarkedPosL;
522:                int zzEndReadL = zzEndRead;
523:                char[] zzBufferL = zzBuffer;
524:                char[] zzCMapL = ZZ_CMAP;
525:
526:                int[] zzTransL = ZZ_TRANS;
527:                int[] zzRowMapL = ZZ_ROWMAP;
528:                int[] zzAttrL = ZZ_ATTRIBUTE;
529:
530:                while (true) {
531:                    zzMarkedPosL = zzMarkedPos;
532:
533:                    boolean zzR = false;
534:                    for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL; zzCurrentPosL++) {
535:                        switch (zzBufferL[zzCurrentPosL]) {
536:                        case '\u000B':
537:                        case '\u000C':
538:                        case '\u0085':
539:                        case '\u2028':
540:                        case '\u2029':
541:                            yyline++;
542:                            yycolumn = 0;
543:                            zzR = false;
544:                            break;
545:                        case '\r':
546:                            yyline++;
547:                            yycolumn = 0;
548:                            zzR = true;
549:                            break;
550:                        case '\n':
551:                            if (zzR)
552:                                zzR = false;
553:                            else {
554:                                yyline++;
555:                                yycolumn = 0;
556:                            }
557:                            break;
558:                        default:
559:                            zzR = false;
560:                            yycolumn++;
561:                        }
562:                    }
563:
564:                    if (zzR) {
565:                        // peek one character ahead if it is \n (if we have counted one line too much)
566:                        boolean zzPeek;
567:                        if (zzMarkedPosL < zzEndReadL)
568:                            zzPeek = zzBufferL[zzMarkedPosL] == '\n';
569:                        else if (zzAtEOF)
570:                            zzPeek = false;
571:                        else {
572:                            boolean eof = zzRefill();
573:                            zzMarkedPosL = zzMarkedPos;
574:                            zzBufferL = zzBuffer;
575:                            if (eof)
576:                                zzPeek = false;
577:                            else
578:                                zzPeek = zzBufferL[zzMarkedPosL] == '\n';
579:                        }
580:                        if (zzPeek)
581:                            yyline--;
582:                    }
583:                    zzAction = -1;
584:
585:                    zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
586:
587:                    zzState = zzLexicalState;
588:
589:                    zzForAction: {
590:                        while (true) {
591:
592:                            if (zzCurrentPosL < zzEndReadL)
593:                                zzInput = zzBufferL[zzCurrentPosL++];
594:                            else if (zzAtEOF) {
595:                                zzInput = YYEOF;
596:                                break zzForAction;
597:                            } else {
598:                                // store back cached positions
599:                                zzCurrentPos = zzCurrentPosL;
600:                                zzMarkedPos = zzMarkedPosL;
601:                                boolean eof = zzRefill();
602:                                // get translated positions and possibly new buffer
603:                                zzCurrentPosL = zzCurrentPos;
604:                                zzMarkedPosL = zzMarkedPos;
605:                                zzBufferL = zzBuffer;
606:                                zzEndReadL = zzEndRead;
607:                                if (eof) {
608:                                    zzInput = YYEOF;
609:                                    break zzForAction;
610:                                } else {
611:                                    zzInput = zzBufferL[zzCurrentPosL++];
612:                                }
613:                            }
614:                            int zzNext = zzTransL[zzRowMapL[zzState]
615:                                    + zzCMapL[zzInput]];
616:                            if (zzNext == -1)
617:                                break zzForAction;
618:                            zzState = zzNext;
619:
620:                            int zzAttributes = zzAttrL[zzState];
621:                            if ((zzAttributes & 1) == 1) {
622:                                zzAction = zzState;
623:                                zzMarkedPosL = zzCurrentPosL;
624:                                if ((zzAttributes & 8) == 8)
625:                                    break zzForAction;
626:                            }
627:
628:                        }
629:                    }
630:
631:                    // store back cached position
632:                    zzMarkedPos = zzMarkedPosL;
633:
634:                    switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
635:                    case 1: {
636:                        error("illegal character");
637:                    }
638:                    case 33:
639:                        break;
640:                    case 12: {
641:                        sb.append(yytext());
642:                    }
643:                    case 34:
644:                        break;
645:                    case 7: {
646:                        return symbol(sym.SEMI);
647:                    }
648:                    case 35:
649:                        break;
650:                    case 30: {
651:                        return symbol(sym.NONASSOC);
652:                    }
653:                    case 36:
654:                        break;
655:                    case 32: {
656:                        return symbol(sym.NONTERMINAL);
657:                    }
658:                    case 37:
659:                        break;
660:                    case 14: {
661:                        yybegin(YYINITIAL);
662:                        return symbol(sym.CODE_STRING, sb.toString());
663:                    }
664:                    case 38:
665:                        break;
666:                    case 21: {
667:                        return symbol(sym.LEFT);
668:                    }
669:                    case 39:
670:                        break;
671:                    case 5: {
672:                        return symbol(sym.COLON);
673:                    }
674:                    case 40:
675:                        break;
676:                    case 23: {
677:                        return symbol(sym.START);
678:                    }
679:                    case 41:
680:                        break;
681:                    case 11: {
682:                        return symbol(sym.RBRACK);
683:                    }
684:                    case 42:
685:                        break;
686:                    case 4: {
687:                        return symbol(sym.ID, yytext());
688:                    }
689:                    case 43:
690:                        break;
691:                    case 6: {
692:                        return symbol(sym.BAR);
693:                    }
694:                    case 44:
695:                        break;
696:                    case 8: {
697:                        return symbol(sym.COMMA);
698:                    }
699:                    case 45:
700:                        break;
701:                    case 26: {
702:                        return symbol(sym.ACTION);
703:                    }
704:                    case 46:
705:                        break;
706:                    case 24: {
707:                        return symbol(sym.PERCENT_PREC);
708:                    }
709:                    case 47:
710:                        break;
711:                    case 31: {
712:                        return symbol(sym.PRECEDENCE);
713:                    }
714:                    case 48:
715:                        break;
716:                    case 3: {
717:                        return symbol(sym.STAR);
718:                    }
719:                    case 49:
720:                        break;
721:                    case 29: {
722:                        return symbol(sym.TERMINAL);
723:                    }
724:                    case 50:
725:                        break;
726:                    case 20: {
727:                        return symbol(sym.WITH);
728:                    }
729:                    case 51:
730:                        break;
731:                    case 28: {
732:                        return symbol(sym.PACKAGE);
733:                    }
734:                    case 52:
735:                        break;
736:                    case 17: {
737:                        return symbol(sym.CODE);
738:                    }
739:                    case 53:
740:                        break;
741:                    case 15: {
742:                        return symbol(sym.NON);
743:                    }
744:                    case 54:
745:                        break;
746:                    case 25: {
747:                        return symbol(sym.PARSER);
748:                    }
749:                    case 55:
750:                        break;
751:                    case 16: {
752:                        return symbol(sym.COLON_COLON_EQUALS);
753:                    }
754:                    case 56:
755:                        break;
756:                    case 22: {
757:                        return symbol(sym.RIGHT);
758:                    }
759:                    case 57:
760:                        break;
761:                    case 27: {
762:                        return symbol(sym.IMPORT);
763:                    }
764:                    case 58:
765:                        break;
766:                    case 19: {
767:                        return symbol(sym.SCAN);
768:                    }
769:                    case 59:
770:                        break;
771:                    case 13: {
772:                        sb.setLength(0);
773:                        yybegin(CODE);
774:                    }
775:                    case 60:
776:                        break;
777:                    case 9: {
778:                        return symbol(sym.DOT);
779:                    }
780:                    case 61:
781:                        break;
782:                    case 18: {
783:                        return symbol(sym.INIT);
784:                    }
785:                    case 62:
786:                        break;
787:                    case 2: { /* ignore */
788:                    }
789:                    case 63:
790:                        break;
791:                    case 10: {
792:                        return symbol(sym.LBRACK);
793:                    }
794:                    case 64:
795:                        break;
796:                    default:
797:                        if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
798:                            zzAtEOF = true;
799:                            zzDoEOF();
800:                            {
801:                                return new java_cup.runtime.Symbol(sym.EOF);
802:                            }
803:                        } else {
804:                            zzScanError(ZZ_NO_MATCH);
805:                        }
806:                    }
807:                }
808:            }
809:
810:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.