001: /* The following code was generated by JFlex 1.4.1 on 17.04.06 18:36 */
002: package com.bm.utils.csv;
003:
004: import java.io.File;
005: import java.io.FileInputStream;
006: import java.io.IOException;
007: import java.io.InputStream;
008:
009: /**
010: * Read files in comma separated value format.
011: *
012: */
013:
014: public class CSVLexer {
015:
016: /** This character denotes the end of file */
017: public static final int YYEOF = -1;
018:
019: /** initial size of the lookahead buffer */
020: private static final int ZZ_BUFFERSIZE = 16384;
021:
022: /** lexical states */
023: public static final int BEFORE = 1;
024:
025: public static final int YYINITIAL = 0;
026:
027: public static final int COMMENT = 3;
028:
029: public static final int AFTER = 2;
030:
031: /**
032: * Translates characters to character classes
033: */
034: private static final String ZZ_CMAP_PACKED = "\11\0\1\1\1\3\1\0\1\1\1\2\22\0\1\1\1\0\1\5"
035: + "\11\0\1\4\57\0\1\6\uffa3\0";
036:
037: /**
038: * Translates characters to character classes
039: */
040: private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
041:
042: /**
043: * Translates DFA states to action switch labels.
044: */
045: private static final int[] ZZ_ACTION = zzUnpackAction();
046:
047: private static final String ZZ_ACTION_PACKED_0 = "\1\0\3\1\1\2\1\3\2\4\1\5\1\6\1\7"
048: + "\1\1\2\10\1\11\1\12\2\1\1\13\1\1\2\0"
049: + "\1\14\2\0\1\15\1\0";
050:
051: private static int[] zzUnpackAction() {
052: int[] result = new int[27];
053: int offset = 0;
054: offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
055: return result;
056: }
057:
058: private static int zzUnpackAction(String packed, int offset,
059: int[] result) {
060: int i = 0; /* index in packed string */
061: int j = offset; /* index in unpacked array */
062: int l = packed.length();
063: while (i < l) {
064: int count = packed.charAt(i++);
065: int value = packed.charAt(i++);
066: do
067: result[j++] = value;
068: while (--count > 0);
069: }
070: return j;
071: }
072:
073: /**
074: * Translates a state to a row index in the transition table
075: */
076: private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
077:
078: private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\7\0\16\0\25\0\34\0\43\0\52\0\61"
079: + "\0\61\0\70\0\77\0\106\0\115\0\61\0\61\0\124"
080: + "\0\133\0\142\0\61\0\151\0\34\0\43\0\61\0\160"
081: + "\0\77\0\61\0\167";
082:
083: private static int[] zzUnpackRowMap() {
084: int[] result = new int[27];
085: int offset = 0;
086: offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
087: return result;
088: }
089:
090: private static int zzUnpackRowMap(String packed, int offset,
091: int[] result) {
092: int i = 0; /* index in packed string */
093: int j = offset; /* index in unpacked array */
094: int l = packed.length();
095: while (i < l) {
096: int high = packed.charAt(i++) << 16;
097: result[j++] = high | packed.charAt(i++);
098: }
099: return j;
100: }
101:
102: /**
103: * The transition table of the DFA
104: */
105: private static final int[] ZZ_TRANS = zzUnpackTrans();
106:
107: private static final String ZZ_TRANS_PACKED_0 = "\1\5\1\6\1\7\1\10\1\11\1\12\1\5\1\13"
108: + "\1\14\1\15\1\16\1\17\1\20\1\13\1\21\1\22"
109: + "\1\7\1\10\1\23\2\21\1\24\1\4\1\7\1\10"
110: + "\3\24\1\5\1\25\3\0\2\5\1\0\1\26\1\7"
111: + "\1\10\6\0\1\10\12\0\5\12\1\27\1\30\1\13"
112: + "\1\31\3\0\2\13\1\0\1\14\10\0\1\16\3\0"
113: + "\5\20\1\32\1\33\2\21\3\0\3\21\1\22\1\7"
114: + "\1\10\1\0\2\21\2\24\2\0\3\24\7\12\7\20";
115:
116: private static int[] zzUnpackTrans() {
117: int[] result = new int[126];
118: int offset = 0;
119: offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
120: return result;
121: }
122:
123: private static int zzUnpackTrans(String packed, int offset,
124: int[] result) {
125: int i = 0; /* index in packed string */
126: int j = offset; /* index in unpacked array */
127: int l = packed.length();
128: while (i < l) {
129: int count = packed.charAt(i++);
130: int value = packed.charAt(i++);
131: value--;
132: do
133: result[j++] = value;
134: while (--count > 0);
135: }
136: return j;
137: }
138:
139: /* error codes */
140: private static final int ZZ_UNKNOWN_ERROR = 0;
141:
142: private static final int ZZ_NO_MATCH = 1;
143:
144: private static final int ZZ_PUSHBACK_2BIG = 2;
145:
146: private char[] zzcmap_instance;
147:
148: /* error messages for the codes above */
149: private static final String ZZ_ERROR_MSG[] = {
150: "Unkown internal scanner error",
151: "Error: could not match input",
152: "Error: pushback value was too large" };
153:
154: /**
155: * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
156: */
157: private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
158:
159: private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\6\1\2\11\4\1\2\11\3\1\1\11\1\1"
160: + "\2\0\1\11\2\0\1\11\1\0";
161:
162: private static int[] zzUnpackAttribute() {
163: int[] result = new int[27];
164: int offset = 0;
165: offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset,
166: result);
167: return result;
168: }
169:
170: private static int zzUnpackAttribute(String packed, int offset,
171: int[] result) {
172: int i = 0; /* index in packed string */
173: int j = offset; /* index in unpacked array */
174: int l = packed.length();
175: while (i < l) {
176: int count = packed.charAt(i++);
177: int value = packed.charAt(i++);
178: do
179: result[j++] = value;
180: while (--count > 0);
181: }
182: return j;
183: }
184:
185: /** the input device */
186: private java.io.Reader zzReader;
187:
188: /** the current state of the DFA */
189: private int zzState;
190:
191: /** the current lexical state */
192: private int zzLexicalState = YYINITIAL;
193:
194: /**
195: * this buffer contains the current text to be matched and is the source of
196: * the yytext() string
197: */
198: private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
199:
200: /** the textposition at the last accepting state */
201: private int zzMarkedPos;
202:
203: /** the textposition at the last state to be included in yytext */
204: private int zzPushbackPos;
205:
206: /** the current text position in the buffer */
207: private int zzCurrentPos;
208:
209: /** startRead marks the beginning of the yytext() string in the buffer */
210: private int zzStartRead;
211:
212: /**
213: * endRead marks the last character in the buffer, that has been read from
214: * input
215: */
216: private int zzEndRead;
217:
218: /** zzAtEOF == true <=> the scanner is at the EOF */
219: private boolean zzAtEOF;
220:
221: /* user code: */
222: /**
223: * Prints out tokens and line numbers from a file or System.in. If no
224: * arguments are given, System.in will be used for input. If more arguments
225: * are given, the first argument will be used as the name of the file to use
226: * as input
227: *
228: * @param args
229: * program arguments, of which the first is a filename
230: *
231: * @since ostermillerutils 1.00.00
232: */
233: public static void main(String[] args) {
234: InputStream in;
235: try {
236: if (args.length > 0) {
237: File f = new File(args[0]);
238: if (f.exists()) {
239: if (f.canRead()) {
240: in = new FileInputStream(f);
241: } else {
242: throw new IOException("Could not open "
243: + args[0]);
244: }
245: } else {
246: throw new IOException("Could not find " + args[0]);
247: }
248: } else {
249: in = System.in;
250: }
251: CSVLexer shredder = new CSVLexer(in);
252: shredder.setCommentStart("#;!");
253: shredder.setEscapes("nrtf", "\n\r\t\f");
254: String t;
255: while ((t = shredder.getNextToken()) != null) {
256: System.out.println("" + shredder.getLineNumber() + " "
257: + t);
258: }
259: } catch (IOException e) {
260: System.out.println(e.getMessage());
261: }
262: }
263:
264: private char delimiter = ',';
265:
266: private char quote = '\"';
267:
268: /**
269: * Checks that zzcmap_instance is an instance variable (not just a pointer
270: * to a static variable). If it is a pointer to a static variable, it will
271: * be cloned.
272: *
273: * @since ostermillerutils 1.00.00
274: */
275: private void ensureCharacterMapIsInstance() {
276: if (ZZ_CMAP == zzcmap_instance) {
277: zzcmap_instance = new char[ZZ_CMAP.length];
278: System.arraycopy(ZZ_CMAP, 0, zzcmap_instance, 0,
279: ZZ_CMAP.length);
280: }
281: }
282:
283: /**
284: * Ensures that the given character is not used for some special purpose in
285: * parsing. This method should be called before setting some character to be
286: * a delimiter so that the parsing doesn't break. Examples of bad characters
287: * are quotes, commas, and whitespace.
288: *
289: * @since ostermillerutils 1.00.00
290: */
291: private boolean charIsSafe(char c) {
292: // There are two character classes that one could use as a delimiter.
293: // The first would be the class that most characters are in. These
294: // are normally data. The second is the class that the tab is usually
295: // in.
296: return (zzcmap_instance[c] == ZZ_CMAP['a'] || zzcmap_instance[c] == ZZ_CMAP['\t']);
297: }
298:
299: /**
300: * Change the character classes of the two given characters. This will make
301: * the state machine behave as if the characters were switched when they are
302: * encountered in the input.
303: *
304: * @param old
305: * the old character, its value will be returned to initial
306: * @param two
307: * second character
308: *
309: * @since ostermillerutils 1.00.00
310: */
311: private void updateCharacterClasses(char oldChar, char newChar) {
312: // before modifying the character map, make sure it isn't static.
313: ensureCharacterMapIsInstance();
314: // make the newChar behave like the oldChar
315: zzcmap_instance[newChar] = zzcmap_instance[oldChar];
316: // make the oldChar behave like it isn't special.
317: switch (oldChar) {
318: case ',':
319: case '"': {
320: // These should act as normal character,
321: // not delimiters or quotes right now.
322: zzcmap_instance[oldChar] = ZZ_CMAP['a'];
323: }
324: break;
325: default: {
326: // Set the it back to the way it would act
327: // if not used as a delimiter or quote.
328: zzcmap_instance[oldChar] = ZZ_CMAP[oldChar];
329: }
330: break;
331: }
332: }
333:
334: /**
335: * Change this Lexer so that it uses a new delimiter.
336: * <p>
337: * The initial character is a comma, the delimiter cannot be changed to a
338: * quote or other character that has special meaning in CSV.
339: *
340: * @param newDelim
341: * delimiter to which to switch.
342: * @throws BadDelimiterException
343: * if the character cannot be used as a delimiter.
344: *
345: * @since ostermillerutils 1.00.00
346: */
347: public void changeDelimiter(char newDelim)
348: throws BadDelimiterException {
349: if (newDelim == delimiter)
350: return; // no need to do anything.
351: if (!charIsSafe(newDelim)) {
352: throw new BadDelimiterException(newDelim
353: + " is not a safe delimiter.");
354: }
355: updateCharacterClasses(delimiter, newDelim);
356: // keep a record of the current delimiter.
357: delimiter = newDelim;
358: }
359:
360: /**
361: * Change this Lexer so that it uses a new character for quoting.
362: * <p>
363: * The initial character is a double quote ("), the delimiter cannot be
364: * changed to a comma or other character that has special meaning in CSV.
365: *
366: * @param newQuote
367: * character to use for quoting.
368: * @throws BadQuoteException
369: * if the character cannot be used as a quote.
370: *
371: * @since ostermillerutils 1.00.00
372: */
373: public void changeQuote(char newQuote) throws BadQuoteException {
374: if (newQuote == quote)
375: return; // no need to do anything.
376: if (!charIsSafe(newQuote)) {
377: throw new BadQuoteException(newQuote
378: + " is not a safe quote.");
379: }
380: updateCharacterClasses(quote, newQuote);
381: // keep a record of the current quote.
382: quote = newQuote;
383: }
384:
385: private String escapes = "";
386:
387: private String replacements = "";
388:
389: /**
390: * Specify escape sequences and their replacements. Escape sequences set
391: * here are in addition to \\ and \". \\ and \" are always valid escape
392: * sequences. This method allows standard escape sequenced to be used. For
393: * example "\n" can be set to be a newline rather than an 'n'. A common way
394: * to call this method might be:<br>
395: * <code>setEscapes("nrtf", "\n\r\t\f");</code><br>
396: * which would set the escape sequences to be the Java escape sequences.
397: * Characters that follow a \ that are not escape sequences will still be
398: * interpreted as that character.<br>
399: * The two arguemnts to this method must be the same length. If they are
400: * not, the longer of the two will be truncated.
401: *
402: * @param escapes
403: * a list of characters that will represent escape sequences.
404: * @param replacements
405: * the list of repacement characters for those escape sequences.
406: *
407: * @since ostermillerutils 1.00.00
408: */
409: public void setEscapes(String escapes, String replacements) {
410: int length = escapes.length();
411: if (replacements.length() < length) {
412: length = replacements.length();
413: }
414: this .escapes = escapes.substring(0, length);
415: this .replacements = replacements.substring(0, length);
416: }
417:
418: private String unescape(String s) {
419: if (s.indexOf('\\') == -1) {
420: return s.substring(1, s.length() - 1);
421: }
422: StringBuffer sb = new StringBuffer(s.length());
423: for (int i = 1; i < s.length() - 1; i++) {
424: char c = s.charAt(i);
425: if (c == '\\') {
426: char c1 = s.charAt(++i);
427: int index;
428: if (c1 == '\\' || c1 == '\"') {
429: sb.append(c1);
430: } else if ((index = escapes.indexOf(c1)) != -1) {
431: sb.append(replacements.charAt(index));
432: } else {
433: sb.append(c1);
434: }
435: } else {
436: sb.append(c);
437: }
438: }
439: return sb.toString();
440: }
441:
442: private String commentDelims = "";
443:
444: /**
445: * Set the characters that indicate a comment at the beginning of the line.
446: * For example if the string "#;!" were passed in, all of the following
447: * lines would be comments:<br>
448: *
449: * <pre>
450: * # Comment
451: * ; Another Comment
452: * ! Yet another comment
453: * </pre>
454: *
455: * By default there are no comments in CVS files. Commas and quotes may not
456: * be used to indicate comment lines.
457: *
458: * @param commentDelims
459: * list of characters a comment line may start with.
460: *
461: * @since ostermillerutils 1.00.00
462: */
463: public void setCommentStart(String commentDelims) {
464: this .commentDelims = commentDelims;
465: }
466:
467: private int addLine = 1;
468:
469: private int lines = 0;
470:
471: /**
472: * Get the line number that the last token came from.
473: * <p>
474: * New line breaks that occur in the middle of a token are not counted in
475: * the line number count.
476: * <p>
477: * If no tokens have been returned, the line number is undefined.
478: *
479: * @return line number of the last token.
480: *
481: * @since ostermillerutils 1.00.00
482: */
483: public int getLineNumber() {
484: return lines;
485: }
486:
487: /**
488: * Creates a new scanner There is also a java.io.InputStream version of this
489: * constructor.
490: *
491: * @param in
492: * the java.io.Reader to read input from.
493: */
494: public CSVLexer(java.io.Reader in) {
495: this .zzReader = in;
496: }
497:
498: /**
499: * Creates a new scanner. There is also java.io.Reader version of this
500: * constructor.
501: *
502: * @param in
503: * the java.io.Inputstream to read input from.
504: */
505: public CSVLexer(java.io.InputStream in) {
506: this (new java.io.InputStreamReader(in));
507: }
508:
509: /**
510: * Unpacks the compressed character translation table.
511: *
512: * @param packed
513: * the packed character translation table
514: * @return the unpacked character translation table
515: */
516: private static char[] zzUnpackCMap(String packed) {
517: char[] map = new char[0x10000];
518: int i = 0; /* index in packed string */
519: int j = 0; /* index in unpacked array */
520: while (i < 30) {
521: int count = packed.charAt(i++);
522: char value = packed.charAt(i++);
523: do
524: map[j++] = value;
525: while (--count > 0);
526: }
527: return map;
528: }
529:
530: /**
531: * Refills the input buffer.
532: *
533: * @return <code>false</code>, iff there was new input.
534: *
535: * @exception java.io.IOException
536: * if any I/O-Error occurs
537: */
538: private boolean zzRefill() throws java.io.IOException {
539:
540: /* first: make room (if you can) */
541: if (zzStartRead > 0) {
542: System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0,
543: zzEndRead - zzStartRead);
544:
545: /* translate stored positions */
546: zzEndRead -= zzStartRead;
547: zzCurrentPos -= zzStartRead;
548: zzMarkedPos -= zzStartRead;
549: zzPushbackPos -= zzStartRead;
550: zzStartRead = 0;
551: }
552:
553: /* is the buffer big enough? */
554: if (zzCurrentPos >= zzBuffer.length) {
555: /* if not: blow it up */
556: char newBuffer[] = new char[zzCurrentPos * 2];
557: System
558: .arraycopy(zzBuffer, 0, newBuffer, 0,
559: zzBuffer.length);
560: zzBuffer = newBuffer;
561: }
562:
563: /* finally: fill the buffer with new input */
564: int numRead = zzReader.read(zzBuffer, zzEndRead,
565: zzBuffer.length - zzEndRead);
566:
567: if (numRead < 0) {
568: return true;
569: } else {
570: zzEndRead += numRead;
571: return false;
572: }
573: }
574:
575: /**
576: * Closes the input stream.
577: */
578: public final void yyclose() throws java.io.IOException {
579: zzAtEOF = true; /* indicate end of file */
580: zzEndRead = zzStartRead; /* invalidate buffer */
581:
582: if (zzReader != null)
583: zzReader.close();
584: }
585:
586: /**
587: * Resets the scanner to read from a new input stream. Does not close the
588: * old reader.
589: *
590: * All internal variables are reset, the old input stream <b>cannot</b> be
591: * reused (internal buffer is discarded and lost). Lexical state is set to
592: * <tt>ZZ_INITIAL</tt>.
593: *
594: * @param reader
595: * the new input stream
596: */
597: public final void yyreset(java.io.Reader reader) {
598: zzReader = reader;
599: zzAtEOF = false;
600: zzEndRead = zzStartRead = 0;
601: zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
602: zzLexicalState = YYINITIAL;
603: }
604:
605: /**
606: * Returns the current lexical state.
607: */
608: public final int yystate() {
609: return zzLexicalState;
610: }
611:
612: /**
613: * Enters a new lexical state
614: *
615: * @param newState
616: * the new lexical state
617: */
618: public final void yybegin(int newState) {
619: zzLexicalState = newState;
620: }
621:
622: /**
623: * Returns the text matched by the current regular expression.
624: */
625: public final String yytext() {
626: return new String(zzBuffer, zzStartRead, zzMarkedPos
627: - zzStartRead);
628: }
629:
630: /**
631: * Returns the character at position <tt>pos</tt> from the matched text.
632: *
633: * It is equivalent to yytext().charAt(pos), but faster
634: *
635: * @param pos
636: * the position of the character to fetch. A value from 0 to
637: * yylength()-1.
638: *
639: * @return the character at position pos
640: */
641: public final char yycharat(int pos) {
642: return zzBuffer[zzStartRead + pos];
643: }
644:
645: /**
646: * Returns the length of the matched text region.
647: */
648: public final int yylength() {
649: return zzMarkedPos - zzStartRead;
650: }
651:
652: /**
653: * Reports an error that occured while scanning.
654: *
655: * In a wellformed scanner (no or only correct usage of yypushback(int) and
656: * a match-all fallback rule) this method will only be called with things
657: * that "Can't Possibly Happen". If this method is called, something is
658: * seriously wrong (e.g. a JFlex bug producing a faulty scanner etc.).
659: *
660: * Usual syntax/scanner level error handling should be done in error
661: * fallback rules.
662: *
663: * @param errorCode
664: * the code of the errormessage to display
665: */
666: private void zzScanError(int errorCode) {
667: String message;
668: try {
669: message = ZZ_ERROR_MSG[errorCode];
670: } catch (ArrayIndexOutOfBoundsException e) {
671: message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
672: }
673:
674: throw new Error(message);
675: }
676:
677: /**
678: * Pushes the specified amount of characters back into the input stream.
679: *
680: * They will be read again by then next call of the scanning method
681: *
682: * @param number
683: * the number of characters to be read again. This number must
684: * not be greater than yylength()!
685: */
686: public void yypushback(int number) {
687: if (number > yylength())
688: zzScanError(ZZ_PUSHBACK_2BIG);
689:
690: zzMarkedPos -= number;
691: }
692:
693: /**
694: * Resumes scanning until the next regular expression is matched, the end of
695: * input is encountered or an I/O-Error occurs.
696: *
697: * @return the next token
698: * @exception java.io.IOException
699: * if any I/O-Error occurs
700: */
701: public String getNextToken() throws java.io.IOException {
702: int zzInput;
703: int zzAction;
704:
705: // cached fields:
706: int zzCurrentPosL;
707: int zzMarkedPosL;
708: int zzEndReadL = zzEndRead;
709: char[] zzBufferL = zzBuffer;
710: char[] zzCMapL = ZZ_CMAP;
711:
712: int[] zzTransL = ZZ_TRANS;
713: int[] zzRowMapL = ZZ_ROWMAP;
714: int[] zzAttrL = ZZ_ATTRIBUTE;
715:
716: while (true) {
717: zzMarkedPosL = zzMarkedPos;
718:
719: zzAction = -1;
720:
721: zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
722:
723: zzState = zzLexicalState;
724:
725: zzForAction: {
726: while (true) {
727:
728: if (zzCurrentPosL < zzEndReadL)
729: zzInput = zzBufferL[zzCurrentPosL++];
730: else if (zzAtEOF) {
731: zzInput = YYEOF;
732: break zzForAction;
733: } else {
734: // store back cached positions
735: zzCurrentPos = zzCurrentPosL;
736: zzMarkedPos = zzMarkedPosL;
737: boolean eof = zzRefill();
738: // get translated positions and possibly new buffer
739: zzCurrentPosL = zzCurrentPos;
740: zzMarkedPosL = zzMarkedPos;
741: zzBufferL = zzBuffer;
742: zzEndReadL = zzEndRead;
743: if (eof) {
744: zzInput = YYEOF;
745: break zzForAction;
746: } else {
747: zzInput = zzBufferL[zzCurrentPosL++];
748: }
749: }
750: int zzNext = zzTransL[zzRowMapL[zzState]
751: + zzCMapL[zzInput]];
752: if (zzNext == -1)
753: break zzForAction;
754: zzState = zzNext;
755:
756: int zzAttributes = zzAttrL[zzState];
757: if ((zzAttributes & 1) == 1) {
758: zzAction = zzState;
759: zzMarkedPosL = zzCurrentPosL;
760: if ((zzAttributes & 8) == 8)
761: break zzForAction;
762: }
763:
764: }
765: }
766:
767: // store back cached position
768: zzMarkedPos = zzMarkedPosL;
769:
770: switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
771: case 2: {
772: lines += addLine;
773: addLine = 0;
774: String text = yytext();
775: if (commentDelims.indexOf(text.charAt(0)) == -1) {
776: yybegin(AFTER);
777: return (text);
778: } else {
779: yybegin(COMMENT);
780: }
781: }
782: case 14:
783: break;
784: case 8: {
785: addLine++;
786: yybegin(YYINITIAL);
787: return ("");
788: }
789: case 15:
790: break;
791: case 9: {
792: yybegin(BEFORE);
793: return ("");
794: }
795: case 16:
796: break;
797: case 4: {
798: addLine++;
799: yybegin(YYINITIAL);
800: }
801: case 17:
802: break;
803: case 5: {
804: lines += addLine;
805: addLine = 0;
806: yybegin(BEFORE);
807: return ("");
808: }
809: case 18:
810: break;
811: case 12: {
812: lines += addLine;
813: addLine = 0;
814: yybegin(AFTER);
815: return (unescape(yytext()));
816: }
817: case 19:
818: break;
819: case 7: {
820: yybegin(AFTER);
821: return (yytext());
822: }
823: case 20:
824: break;
825: case 6: {
826: lines += addLine;
827: addLine = 0;
828: yybegin(YYINITIAL);
829: return (yytext());
830: }
831: case 21:
832: break;
833: case 11: {
834: yybegin(BEFORE);
835: }
836: case 22:
837: break;
838: case 13: {
839: yybegin(AFTER);
840: return (unescape(yytext()));
841: }
842: case 23:
843: break;
844: case 10: {
845: yybegin(YYINITIAL);
846: return (yytext());
847: }
848: case 24:
849: break;
850: case 1: {
851: }
852: case 25:
853: break;
854: case 3: {
855: lines += addLine;
856: addLine = 0;
857: yybegin(BEFORE);
858: }
859: case 26:
860: break;
861: default:
862: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
863: zzAtEOF = true;
864: switch (zzLexicalState) {
865: case BEFORE: {
866: yybegin(YYINITIAL);
867: addLine++;
868: return ("");
869: }
870: case 28:
871: break;
872: default:
873: return null;
874: }
875: } else {
876: zzScanError(ZZ_NO_MATCH);
877: }
878: }
879: }
880: }
881:
882: }
|