001: /* The following code was generated by JFlex 1.3.5 on 13-9-06 0:53 */
002:
003: package vqwiki.lex;
004:
005: /*
006: Very Quick Wiki - WikiWikiWeb clone
007: Copyright (C) 2001-2003 Gareth Cronin
008:
009: This program is free software; you can redistribute it and/or modify
010: it under the terms of the GNU Lesser General Public License as published by
011: the Free Software Foundation; either version 2 of the License, or
012: (at your option) any later version.
013:
014: This program is distributed in the hope that it will be useful,
015: but WITHOUT ANY WARRANTY; without even the implied warranty of
016: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
017: GNU General Public License for more details.
018:
019: You should have received a copy of the GNU Lesser General Public License
020: along with this program (gpl.txt); if not, write to the Free Software
021: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
022: */
023:
024: import org.apache.log4j.Logger;
025: import vqwiki.WikiBase;
026:
027: /**
028: * This class is a scanner generated by
029: * <a href="http://www.jflex.de/">JFlex</a> 1.3.5
030: * on 13-9-06 0:53 from the specification file
031: * <tt>file:/C:/SourceForge/VQWiki_2X/vqwiki-classic/jflex/format.jflex</tt>
032: */
033: public class FormatLex implements vqwiki.lex.Lexer {
034:
035: /** This character denotes the end of file */
036: final public static int YYEOF = -1;
037:
038: /** initial size of the lookahead buffer */
039: final private static int YY_BUFFERSIZE = 16384;
040:
041: /** lexical states */
042: final public static int YYINITIAL = 0;
043: final public static int EXTERNAL = 8;
044: final public static int PRE = 6;
045: final public static int OFF = 4;
046: final public static int NORMAL = 2;
047:
048: /**
049: * YY_LEXSTATE[l] is the state in the DFA for the lexical state l
050: * YY_LEXSTATE[l+1] is the state in the DFA for the lexical state l
051: * at the beginning of a line
052: * l is of the form l = 2*k, k a non negative integer
053: */
054: private final static int YY_LEXSTATE[] = { 0, 0, 1, 2, 3, 3, 4, 4,
055: 5, 5 };
056:
057: /**
058: * Translates characters to character classes
059: */
060: final private static String yycmap_packed = "\11\0\1\3\1\1\2\0\1\2\22\0\1\3\1\24\1\0\1\14"
061: + "\1\0\1\17\1\13\1\25\7\0\1\12\12\21\1\26\1\16\1\6"
062: + "\1\27\1\10\1\0\1\34\6\22\24\20\1\5\1\23\1\11\1\30"
063: + "\1\4\1\0\1\40\5\22\1\37\4\20\1\35\1\41\2\20\1\42"
064: + "\3\20\1\36\6\20\1\32\1\0\1\33\1\31\53\0\1\7\12\0"
065: + "\1\7\4\0\1\7\5\0\27\7\1\0\37\7\1\0\u0128\7\2\0"
066: + "\22\7\34\0\136\7\2\0\11\7\2\0\7\7\16\0\2\7\16\0"
067: + "\5\7\11\0\1\7\213\0\1\7\13\0\1\7\1\0\3\7\1\0"
068: + "\1\7\1\0\24\7\1\0\54\7\1\0\10\7\2\0\32\7\14\0"
069: + "\202\7\12\0\71\7\2\0\2\7\2\0\2\7\3\0\46\7\2\0"
070: + "\2\7\67\0\46\7\2\0\1\7\7\0\47\7\110\0\33\7\5\0"
071: + "\3\7\56\0\32\7\5\0\13\7\25\0\12\15\7\0\143\7\1\0"
072: + "\1\7\17\0\2\7\11\0\12\15\3\7\23\0\1\7\1\0\33\7"
073: + "\123\0\46\7\u015f\0\65\7\3\0\1\7\22\0\1\7\7\0\12\7"
074: + "\4\0\12\15\25\0\10\7\2\0\2\7\2\0\26\7\1\0\7\7"
075: + "\1\0\1\7\3\0\4\7\42\0\2\7\1\0\3\7\4\0\12\15"
076: + "\2\7\23\0\6\7\4\0\2\7\2\0\26\7\1\0\7\7\1\0"
077: + "\2\7\1\0\2\7\1\0\2\7\37\0\4\7\1\0\1\7\7\0"
078: + "\12\15\2\0\3\7\20\0\7\7\1\0\1\7\1\0\3\7\1\0"
079: + "\26\7\1\0\7\7\1\0\2\7\1\0\5\7\3\0\1\7\22\0"
080: + "\1\7\17\0\1\7\5\0\12\15\25\0\10\7\2\0\2\7\2\0"
081: + "\26\7\1\0\7\7\1\0\2\7\2\0\4\7\3\0\1\7\36\0"
082: + "\2\7\1\0\3\7\4\0\12\15\25\0\6\7\3\0\3\7\1\0"
083: + "\4\7\3\0\2\7\1\0\1\7\1\0\2\7\3\0\2\7\3\0"
084: + "\3\7\3\0\10\7\1\0\3\7\55\0\11\15\25\0\10\7\1\0"
085: + "\3\7\1\0\27\7\1\0\12\7\1\0\5\7\46\0\2\7\4\0"
086: + "\12\15\25\0\10\7\1\0\3\7\1\0\27\7\1\0\12\7\1\0"
087: + "\5\7\44\0\1\7\1\0\2\7\4\0\12\15\25\0\10\7\1\0"
088: + "\3\7\1\0\27\7\1\0\20\7\46\0\2\7\4\0\12\15\25\0"
089: + "\22\7\3\0\30\7\1\0\11\7\1\0\1\7\2\0\7\7\72\0"
090: + "\60\7\1\0\2\7\14\0\7\7\11\0\12\15\47\0\2\7\1\0"
091: + "\1\7\2\0\2\7\1\0\1\7\2\0\1\7\6\0\4\7\1\0"
092: + "\7\7\1\0\3\7\1\0\1\7\1\0\1\7\2\0\2\7\1\0"
093: + "\4\7\1\0\2\7\11\0\1\7\2\0\5\7\1\0\1\7\11\0"
094: + "\12\15\2\0\2\7\42\0\1\7\37\0\12\15\26\0\10\7\1\0"
095: + "\42\7\35\0\4\7\164\0\42\7\1\0\5\7\1\0\2\7\25\0"
096: + "\12\15\6\0\6\7\112\0\46\7\12\0\47\7\11\0\132\7\5\0"
097: + "\104\7\5\0\122\7\6\0\7\7\1\0\77\7\1\0\1\7\1\0"
098: + "\4\7\2\0\7\7\1\0\1\7\1\0\4\7\2\0\47\7\1\0"
099: + "\1\7\1\0\4\7\2\0\37\7\1\0\1\7\1\0\4\7\2\0"
100: + "\7\7\1\0\1\7\1\0\4\7\2\0\7\7\1\0\7\7\1\0"
101: + "\27\7\1\0\37\7\1\0\1\7\1\0\4\7\2\0\7\7\1\0"
102: + "\47\7\1\0\23\7\16\0\11\15\56\0\125\7\14\0\u026c\7\2\0"
103: + "\10\7\12\0\32\7\5\0\113\7\225\0\64\7\54\0\12\15\46\0"
104: + "\12\15\6\0\130\7\10\0\51\7\u0557\0\234\7\4\0\132\7\6\0"
105: + "\26\7\2\0\6\7\2\0\46\7\2\0\6\7\2\0\10\7\1\0"
106: + "\1\7\1\0\1\7\1\0\1\7\1\0\37\7\2\0\65\7\1\0"
107: + "\7\7\1\0\1\7\3\0\3\7\1\0\7\7\3\0\4\7\2\0"
108: + "\6\7\4\0\15\7\5\0\3\7\1\0\7\7\202\0\1\7\202\0"
109: + "\1\7\4\0\1\7\2\0\12\7\1\0\1\7\3\0\5\7\6\0"
110: + "\1\7\1\0\1\7\1\0\1\7\1\0\4\7\1\0\3\7\1\0"
111: + "\7\7\u0ecb\0\2\7\52\0\5\7\13\0\124\7\10\0\2\7\2\0"
112: + "\132\7\1\0\3\7\6\0\50\7\4\0\136\7\21\0\30\7\u0248\0"
113: + "\u19b6\7\112\0\u51a6\7\132\0\u048d\7\u0773\0\u2ba4\7\u215c\0\u012e\7\322\0"
114: + "\7\7\14\0\5\7\5\0\1\7\1\0\12\7\1\0\15\7\1\0"
115: + "\5\7\1\0\1\7\1\0\2\7\1\0\2\7\1\0\154\7\41\0"
116: + "\u016b\7\22\0\100\7\2\0\66\7\50\0\14\7\164\0\3\7\1\0"
117: + "\1\7\1\0\207\7\23\0\12\15\7\0\32\7\6\0\32\7\13\0"
118: + "\131\7\3\0\6\7\2\0\6\7\2\0\6\7\2\0\3\7\43\0";
119:
120: /**
121: * Translates characters to character classes
122: */
123: final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
124:
125: /**
126: * Translates a state to a row index in the transition table
127: */
128: final private static int yy_rowMap[] = { 0, 35, 70, 105, 140, 175,
129: 0, 0, 210, 0, 245, 280, 0, 0, 315, 350, 385, 420, 455, 490,
130: 525, 560, 595, 630, 665, 700, 735, 770, 805, 0, 840, 875,
131: 0, 0, 910, 945, 980, 1015, 1050, 1085, 0, 1120, 1155, 1190,
132: 0, 1225, 0, 0, 1260, 1295, 1330, 1365, 1400, 0, 0, 1435,
133: 770, 1470, 1505, 1540, 1575, 1610, 1645, 1680, 0, 0, 0, 0,
134: 0, 0, 1715, 1750, 1785, 1820, 1855, 1890, 0, 0, 0, 1925,
135: 1960, 1995, 0, 2030, 2065, 2100, 2135, 2170, 2205, 0, 0,
136: 2240, 0, 2275, 2310, 2345, 2380, 2415, 2450, 2485, 0, 2520,
137: 2555, 2590, 0, 2625, 2660, 2695, 0, 2730 };
138:
139: /**
140: * The packed transition table of the DFA (part 0)
141: */
142: final private static String yy_packed0 = "\43\0\1\7\1\10\1\11\1\12\1\13\1\14\1\15"
143: + "\1\7\1\16\2\7\1\17\3\7\1\20\3\7\1\21"
144: + "\1\7\1\22\1\23\1\24\1\25\1\26\1\27\1\30"
145: + "\1\31\7\7\1\10\1\11\1\12\1\13\1\14\1\15"
146: + "\1\7\1\16\2\7\1\17\3\7\1\20\3\7\1\21"
147: + "\1\32\1\22\1\23\1\24\1\25\1\26\1\27\1\30"
148: + "\1\31\7\7\1\10\1\11\1\12\1\33\1\7\1\15"
149: + "\1\7\1\16\2\7\1\17\30\7\1\34\1\35\1\36"
150: + "\1\37\1\14\1\15\1\7\1\16\2\7\1\17\7\7"
151: + "\1\21\20\7\3\12\1\7\1\40\35\7\1\0\1\10"
152: + "\45\0\1\41\6\0\1\42\35\0\1\43\50\0\1\44"
153: + "\20\0\1\45\1\0\1\46\1\47\16\0\1\50\2\0"
154: + "\1\51\1\52\1\0\1\52\12\0\6\52\4\0\1\53"
155: + "\63\0\1\54\43\0\1\55\43\0\1\56\43\0\1\57"
156: + "\43\0\1\60\43\0\1\61\43\0\1\62\43\0\1\63"
157: + "\6\0\1\64\1\0\22\64\1\65\16\64\4\0\1\66"
158: + "\37\0\1\67\1\70\41\0\1\71\45\0\1\41\44\0"
159: + "\1\72\43\0\1\73\10\0\1\73\1\0\1\73\12\0"
160: + "\6\73\15\0\1\74\3\0\1\74\57\0\1\75\42\0"
161: + "\1\76\45\0\1\77\22\0\2\100\15\0\1\100\21\0"
162: + "\1\101\1\52\1\0\1\52\12\0\6\52\4\0\1\102"
163: + "\63\0\1\103\44\0\1\104\45\0\1\105\43\0\1\106"
164: + "\43\0\1\107\6\0\1\64\1\0\22\64\1\110\16\64"
165: + "\1\111\1\0\22\111\1\112\16\111\1\0\1\67\53\0"
166: + "\1\113\37\0\1\73\1\114\7\0\1\73\1\0\1\73"
167: + "\12\0\6\73\15\0\1\74\1\115\2\0\1\74\37\0"
168: + "\1\116\42\0\1\117\66\0\1\120\21\0\2\121\15\0"
169: + "\1\121\36\0\1\122\6\0\1\64\1\123\1\124\21\64"
170: + "\1\110\16\64\1\111\1\0\22\111\1\125\16\111\1\126"
171: + "\1\123\1\127\21\126\1\130\16\126\7\0\1\131\10\0"
172: + "\1\131\1\0\1\131\12\0\6\131\11\0\1\132\47\0"
173: + "\1\133\45\0\2\134\15\0\1\134\3\0\1\135\1\136"
174: + "\40\0\1\64\1\123\22\64\1\110\16\64\1\111\1\123"
175: + "\1\137\21\111\1\140\16\111\1\126\1\0\22\126\1\141"
176: + "\17\126\1\123\22\126\1\141\17\126\1\123\1\127\21\126"
177: + "\1\142\16\126\7\0\1\131\1\143\7\0\1\131\1\0"
178: + "\1\131\12\0\6\131\21\0\2\144\15\0\1\144\3\0"
179: + "\1\135\41\0\1\111\1\123\22\111\1\125\17\111\1\145"
180: + "\1\146\21\111\1\140\16\111\1\126\1\123\1\127\21\126"
181: + "\1\147\17\126\1\145\1\150\21\126\1\147\16\126\11\0"
182: + "\1\151\52\0\2\152\15\0\1\152\2\0\1\111\1\145"
183: + "\22\111\1\125\16\111\1\126\1\145\1\150\21\126\1\153"
184: + "\17\126\1\145\22\126\1\141\16\126\21\0\2\154\15\0"
185: + "\1\154\2\0\1\126\1\155\1\156\21\126\1\153\16\126"
186: + "\17\0\1\101\23\0\1\126\1\155\22\126\1\141\16\126";
187:
188: /**
189: * The transition table of the DFA
190: */
191: final private static int yytrans[] = yy_unpack();
192:
193: /* error codes */
194: final private static int YY_UNKNOWN_ERROR = 0;
195: final private static int YY_ILLEGAL_STATE = 1;
196: final private static int YY_NO_MATCH = 2;
197: final private static int YY_PUSHBACK_2BIG = 3;
198:
199: /* error messages for the codes above */
200: final private static String YY_ERROR_MSG[] = {
201: "Unkown internal scanner error",
202: "Internal error: unknown state",
203: "Error: could not match input",
204: "Error: pushback value was too large" };
205:
206: /**
207: * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
208: */
209: private final static byte YY_ATTRIBUTE[] = { 8, 0, 0, 0, 0, 0, 9,
210: 9, 1, 9, 1, 1, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
211: 1, 1, 9, 1, 1, 9, 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 1, 9, 0, 9,
212: 9, 0, 0, 1, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9,
213: 9, 9, 9, 0, 0, 0, 0, 0, 0, 9, 9, 9, 0, 0, 0, 9, 0, 0, 0, 0,
214: 0, 0, 9, 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0,
215: 0, 9, 0 };
216:
217: /** the input device */
218: private java.io.Reader yy_reader;
219:
220: /** the current state of the DFA */
221: private int yy_state;
222:
223: /** the current lexical state */
224: private int yy_lexical_state = YYINITIAL;
225:
226: /** this buffer contains the current text to be matched and is
227: the source of the yytext() string */
228: private char yy_buffer[] = new char[YY_BUFFERSIZE];
229:
230: /** the textposition at the last accepting state */
231: private int yy_markedPos;
232:
233: /** the textposition at the last state to be included in yytext */
234: private int yy_pushbackPos;
235:
236: /** the current text position in the buffer */
237: private int yy_currentPos;
238:
239: /** startRead marks the beginning of the yytext() string in the buffer */
240: private int yy_startRead;
241:
242: /** endRead marks the last character in the buffer, that has been read
243: from input */
244: private int yy_endRead;
245:
246: /** number of newlines encountered up to the start of the matched text */
247: private int yyline;
248:
249: /** the number of characters up to the start of the matched text */
250: private int yychar;
251:
252: /**
253: * the number of characters from the last newline up to the start of the
254: * matched text
255: */
256: private int yycolumn;
257:
258: /**
259: * yy_atBOL == true <=> the scanner is currently at the beginning of a line
260: */
261: private boolean yy_atBOL = true;
262:
263: /** yy_atEOF == true <=> the scanner is at the EOF */
264: private boolean yy_atEOF;
265:
266: /* user code: */
267: protected boolean em, strong, underline, strike, sub, sup, center,
268: table, row, cell, allowHtml, code, h1, h2, h3, color;
269: protected int listLevel;
270: protected boolean ordered;
271: protected static Logger cat = Logger.getLogger(FormatLex.class);
272:
273: protected String virtualWiki;
274:
275: protected boolean exists(String topic) {
276: try {
277: return WikiBase.getInstance().exists(virtualWiki, topic);
278: } catch (Exception err) {
279: cat.error(err);
280: }
281: return false;
282: }
283:
284: public void setVirtualWiki(String vWiki) {
285: this .virtualWiki = vWiki;
286: }
287:
288: /**
289: * Creates a new scanner
290: * There is also a java.io.InputStream version of this constructor.
291: *
292: * @param in the java.io.Reader to read input from.
293: */
294: public FormatLex(java.io.Reader in) {
295: yybegin(NORMAL);
296: this .yy_reader = in;
297: }
298:
299: /**
300: * Creates a new scanner.
301: * There is also java.io.Reader version of this constructor.
302: *
303: * @param in the java.io.Inputstream to read input from.
304: */
305: public FormatLex(java.io.InputStream in) {
306: this (new java.io.InputStreamReader(in));
307: }
308:
309: /**
310: * Unpacks the split, compressed DFA transition table.
311: *
312: * @return the unpacked transition table
313: */
314: private static int[] yy_unpack() {
315: int[] trans = new int[2765];
316: int offset = 0;
317: offset = yy_unpack(yy_packed0, offset, trans);
318: return trans;
319: }
320:
321: /**
322: * Unpacks the compressed DFA transition table.
323: *
324: * @param packed the packed transition table
325: * @return the index of the last entry
326: */
327: private static int yy_unpack(String packed, int offset, int[] trans) {
328: int i = 0; /* index in packed string */
329: int j = offset; /* index in unpacked array */
330: int l = packed.length();
331: while (i < l) {
332: int count = packed.charAt(i++);
333: int value = packed.charAt(i++);
334: value--;
335: do
336: trans[j++] = value;
337: while (--count > 0);
338: }
339: return j;
340: }
341:
342: /**
343: * Unpacks the compressed character translation table.
344: *
345: * @param packed the packed character translation table
346: * @return the unpacked character translation table
347: */
348: private static char[] yy_unpack_cmap(String packed) {
349: char[] map = new char[0x10000];
350: int i = 0; /* index in packed string */
351: int j = 0; /* index in unpacked array */
352: while (i < 1180) {
353: int count = packed.charAt(i++);
354: char value = packed.charAt(i++);
355: do
356: map[j++] = value;
357: while (--count > 0);
358: }
359: return map;
360: }
361:
362: /**
363: * Refills the input buffer.
364: *
365: * @return <code>false</code>, iff there was new input.
366: *
367: * @exception IOException if any I/O-Error occurs
368: */
369: private boolean yy_refill() throws java.io.IOException {
370:
371: /* first: make room (if you can) */
372: if (yy_startRead > 0) {
373: System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0,
374: yy_endRead - yy_startRead);
375:
376: /* translate stored positions */
377: yy_endRead -= yy_startRead;
378: yy_currentPos -= yy_startRead;
379: yy_markedPos -= yy_startRead;
380: yy_pushbackPos -= yy_startRead;
381: yy_startRead = 0;
382: }
383:
384: /* is the buffer big enough? */
385: if (yy_currentPos >= yy_buffer.length) {
386: /* if not: blow it up */
387: char newBuffer[] = new char[yy_currentPos * 2];
388: System.arraycopy(yy_buffer, 0, newBuffer, 0,
389: yy_buffer.length);
390: yy_buffer = newBuffer;
391: }
392:
393: /* finally: fill the buffer with new input */
394: int numRead = yy_reader.read(yy_buffer, yy_endRead,
395: yy_buffer.length - yy_endRead);
396:
397: if (numRead < 0) {
398: return true;
399: } else {
400: yy_endRead += numRead;
401: return false;
402: }
403: }
404:
405: /**
406: * Closes the input stream.
407: */
408: final public void yyclose() throws java.io.IOException {
409: yy_atEOF = true; /* indicate end of file */
410: yy_endRead = yy_startRead; /* invalidate buffer */
411:
412: if (yy_reader != null)
413: yy_reader.close();
414: }
415:
416: /**
417: * Closes the current stream, and resets the
418: * scanner to read from a new input stream.
419: *
420: * All internal variables are reset, the old input stream
421: * <b>cannot</b> be reused (internal buffer is discarded and lost).
422: * Lexical state is set to <tt>YY_INITIAL</tt>.
423: *
424: * @param reader the new input stream
425: */
426: final public void yyreset(java.io.Reader reader)
427: throws java.io.IOException {
428: yyclose();
429: yy_reader = reader;
430: yy_atBOL = true;
431: yy_atEOF = false;
432: yy_endRead = yy_startRead = 0;
433: yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
434: yyline = yychar = yycolumn = 0;
435: yy_lexical_state = YYINITIAL;
436: }
437:
438: /**
439: * Returns the current lexical state.
440: */
441: final public int yystate() {
442: return yy_lexical_state;
443: }
444:
445: /**
446: * Enters a new lexical state
447: *
448: * @param newState the new lexical state
449: */
450: final public void yybegin(int newState) {
451: yy_lexical_state = newState;
452: }
453:
454: /**
455: * Returns the text matched by the current regular expression.
456: */
457: final public String yytext() {
458: return new String(yy_buffer, yy_startRead, yy_markedPos
459: - yy_startRead);
460: }
461:
462: /**
463: * Returns the character at position <tt>pos</tt> from the
464: * matched text.
465: *
466: * It is equivalent to yytext().charAt(pos), but faster
467: *
468: * @param pos the position of the character to fetch.
469: * A value from 0 to yylength()-1.
470: *
471: * @return the character at position pos
472: */
473: final public char yycharat(int pos) {
474: return yy_buffer[yy_startRead + pos];
475: }
476:
477: /**
478: * Returns the length of the matched text region.
479: */
480: final public int yylength() {
481: return yy_markedPos - yy_startRead;
482: }
483:
484: /**
485: * Reports an error that occured while scanning.
486: *
487: * In a wellformed scanner (no or only correct usage of
488: * yypushback(int) and a match-all fallback rule) this method
489: * will only be called with things that "Can't Possibly Happen".
490: * If this method is called, something is seriously wrong
491: * (e.g. a JFlex bug producing a faulty scanner etc.).
492: *
493: * Usual syntax/scanner level error handling should be done
494: * in error fallback rules.
495: *
496: * @param errorCode the code of the errormessage to display
497: */
498: private void yy_ScanError(int errorCode) {
499: String message;
500: try {
501: message = YY_ERROR_MSG[errorCode];
502: } catch (ArrayIndexOutOfBoundsException e) {
503: message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
504: }
505:
506: throw new Error(message);
507: }
508:
509: /**
510: * Pushes the specified amount of characters back into the input stream.
511: *
512: * They will be read again by then next call of the scanning method
513: *
514: * @param number the number of characters to be read again.
515: * This number must not be greater than yylength()!
516: */
517: private void yypushback(int number) {
518: if (number > yylength())
519: yy_ScanError(YY_PUSHBACK_2BIG);
520:
521: yy_markedPos -= number;
522: }
523:
524: /**
525: * Resumes scanning until the next regular expression is matched,
526: * the end of input is encountered or an I/O-Error occurs.
527: *
528: * @return the next token
529: * @exception IOException if any I/O-Error occurs
530: */
531: public String yylex() throws java.io.IOException {
532: int yy_input;
533: int yy_action;
534:
535: // cached fields:
536: int yy_currentPos_l;
537: int yy_startRead_l;
538: int yy_markedPos_l;
539: int yy_endRead_l = yy_endRead;
540: char[] yy_buffer_l = yy_buffer;
541: char[] yycmap_l = yycmap;
542:
543: int[] yytrans_l = yytrans;
544: int[] yy_rowMap_l = yy_rowMap;
545: byte[] yy_attr_l = YY_ATTRIBUTE;
546:
547: while (true) {
548: yy_markedPos_l = yy_markedPos;
549:
550: if (yy_markedPos_l > yy_startRead) {
551: switch (yy_buffer_l[yy_markedPos_l - 1]) {
552: case '\n':
553: case '\u000B':
554: case '\u000C':
555: case '\u0085':
556: case '\u2028':
557: case '\u2029':
558: yy_atBOL = true;
559: break;
560: case '\r':
561: if (yy_markedPos_l < yy_endRead_l)
562: yy_atBOL = yy_buffer_l[yy_markedPos_l] != '\n';
563: else if (yy_atEOF)
564: yy_atBOL = false;
565: else {
566: boolean eof = yy_refill();
567: yy_markedPos_l = yy_markedPos;
568: yy_buffer_l = yy_buffer;
569: if (eof)
570: yy_atBOL = false;
571: else
572: yy_atBOL = yy_buffer_l[yy_markedPos_l] != '\n';
573: }
574: break;
575: default:
576: yy_atBOL = false;
577: }
578: }
579: yy_action = -1;
580:
581: yy_startRead_l = yy_currentPos_l = yy_currentPos = yy_startRead = yy_markedPos_l;
582:
583: if (yy_atBOL)
584: yy_state = YY_LEXSTATE[yy_lexical_state + 1];
585: else
586: yy_state = YY_LEXSTATE[yy_lexical_state];
587:
588: yy_forAction: {
589: while (true) {
590:
591: if (yy_currentPos_l < yy_endRead_l)
592: yy_input = yy_buffer_l[yy_currentPos_l++];
593: else if (yy_atEOF) {
594: yy_input = YYEOF;
595: break yy_forAction;
596: } else {
597: // store back cached positions
598: yy_currentPos = yy_currentPos_l;
599: yy_markedPos = yy_markedPos_l;
600: boolean eof = yy_refill();
601: // get translated positions and possibly new buffer
602: yy_currentPos_l = yy_currentPos;
603: yy_markedPos_l = yy_markedPos;
604: yy_buffer_l = yy_buffer;
605: yy_endRead_l = yy_endRead;
606: if (eof) {
607: yy_input = YYEOF;
608: break yy_forAction;
609: } else {
610: yy_input = yy_buffer_l[yy_currentPos_l++];
611: }
612: }
613: int yy_next = yytrans_l[yy_rowMap_l[yy_state]
614: + yycmap_l[yy_input]];
615: if (yy_next == -1)
616: break yy_forAction;
617: yy_state = yy_next;
618:
619: int yy_attributes = yy_attr_l[yy_state];
620: if ((yy_attributes & 1) == 1) {
621: yy_action = yy_state;
622: yy_markedPos_l = yy_currentPos_l;
623: if ((yy_attributes & 8) == 8)
624: break yy_forAction;
625: }
626:
627: }
628: }
629:
630: // store back cached position
631: yy_markedPos = yy_markedPos_l;
632:
633: switch (yy_action) {
634:
635: case 92: {
636: cat.debug("@@@@{newline} entering PRE");
637: yybegin(PRE);
638: return yytext();
639: }
640: case 111:
641: break;
642: case 32: {
643: cat.debug("Format off");
644: yybegin(OFF);
645: return "__";
646: }
647: case 112:
648: break;
649: case 14: {
650: return "&";
651: }
652: case 113:
653: break;
654: case 13: {
655: return ">";
656: }
657: case 114:
658: break;
659: case 12: {
660: return "<";
661: }
662: case 115:
663: break;
664: case 6:
665: case 10:
666: case 11:
667: case 15:
668: case 16:
669: case 17:
670: case 18:
671: case 19:
672: case 20:
673: case 21:
674: case 22:
675: case 23:
676: case 24:
677: case 25:
678: case 26:
679: case 30:
680: case 31: {
681: cat.debug(". (" + yytext() + ")");
682: return yytext();
683: }
684: case 116:
685: break;
686: case 50: {
687: return "<br>";
688: }
689: case 117:
690: break;
691: case 8:
692: case 9: {
693: cat.debug("{whitespace}");
694: return yytext();
695: }
696: case 118:
697: break;
698: case 76: {
699: return yytext();
700: }
701: case 119:
702: break;
703: case 53: {
704: cat.debug("Format on");
705: yybegin(NORMAL);
706: return "__";
707: }
708: case 120:
709: break;
710: case 47: {
711: cat.debug("Subscripted text");
712: if (sub) {
713: sub = false;
714: return ("</sub>");
715: } else {
716: sub = true;
717: return ("<sub>");
718: }
719: }
720: case 121:
721: break;
722: case 100: {
723: cat.debug("!!...!!");
724: return "<h2>"
725: + yytext().substring(2,
726: yytext().substring(2).indexOf('!') + 2)
727: + "</h2>";
728: }
729: case 122:
730: break;
731: case 46: {
732: cat.debug("Superscripted text");
733: if (sup) {
734: sup = false;
735: return ("</sup>");
736: } else {
737: sup = true;
738: return ("<sup>");
739: }
740: }
741: case 123:
742: break;
743: case 108: {
744: cat.debug("!!!...!!!");
745: return "<h1>"
746: + yytext().substring(3,
747: yytext().substring(3).indexOf('!') + 3)
748: + "</h1>";
749: }
750: case 124:
751: break;
752: case 66: {
753: cat.debug("'''");
754: if (strong) {
755: strong = false;
756: return ("</strong>");
757: } else {
758: strong = true;
759: return ("<strong>");
760: }
761: }
762: case 125:
763: break;
764: case 82: {
765: cat.debug("!...!");
766: return "<h3>"
767: + yytext().substring(1,
768: yytext().substring(1).indexOf('!') + 1)
769: + "</h3>";
770: }
771: case 126:
772: break;
773: case 67: {
774: cat.debug("===");
775: if (underline) {
776: underline = false;
777: return ("</u>");
778: } else {
779: underline = true;
780: return ("<u>");
781: }
782: }
783: case 127:
784: break;
785: case 7: {
786: cat.debug("{newline}");
787: if (h1) {
788: h1 = false;
789: return ("</h1>");
790: }
791: if (h2) {
792: h2 = false;
793: return ("</h2>");
794: }
795: if (h3) {
796: h3 = false;
797: return ("</h3>");
798: }
799: return yytext();
800: }
801: case 128:
802: break;
803: case 54: {
804: cat.debug("{newline}x2 leaving pre");
805: yybegin(NORMAL);
806: return yytext();
807: }
808: case 129:
809: break;
810: case 64: {
811: cat.debug("color start");
812:
813: StringBuffer sb = new StringBuffer();
814: if (color) {
815: sb.append("</font>");
816: }
817: color = true;
818: sb.append("<font color=\"").append(
819: yytext().substring(1, yytext().length() - 1))
820: .append("\">");
821:
822: return sb.toString();
823: }
824: case 130:
825: break;
826: case 89: {
827: cat.debug("external");
828: yybegin(EXTERNAL);
829: return yytext();
830: }
831: case 131:
832: break;
833: case 40: {
834: if (color) {
835: cat.debug("color end");
836:
837: color = false;
838: return ("</font>");
839: } else {
840: return yytext();
841: }
842:
843: }
844: case 132:
845: break;
846: case 27:
847: case 28:
848: case 29: {
849: cat.debug("PRE {whitespace}");
850: return yytext();
851: }
852: case 133:
853: break;
854: case 104: {
855: cat.debug("external end");
856: yybegin(NORMAL);
857: return yytext();
858: }
859: case 134:
860: break;
861: case 65: {
862: cat.debug("escaped double backslash");
863: return "\\__";
864: }
865: case 135:
866: break;
867: case 43: {
868: cat.debug("''");
869: if (em) {
870: em = false;
871: return ("</em>");
872: } else {
873: em = true;
874: return ("<em>");
875: }
876: }
877: case 136:
878: break;
879: case 44: {
880: cat.debug("::");
881: if (center) {
882: center = false;
883: return ("</div>");
884: } else {
885: center = true;
886: return ("<div align=\"center\">");
887: }
888: }
889: case 137:
890: break;
891: case 90: {
892: return "&amp;";
893: }
894: case 138:
895: break;
896: case 78: {
897: return "&gt;";
898: }
899: case 139:
900: break;
901: case 77: {
902: return "&lt;";
903: }
904: case 140:
905: break;
906: case 69: {
907: return "</code>";
908: }
909: case 141:
910: break;
911: case 68: {
912: return "<code>";
913: }
914: case 142:
915: break;
916: case 33: {
917: return " ";
918: }
919: case 143:
920: break;
921: default:
922: if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
923: yy_atEOF = true;
924: {
925: if (strong) {
926: strong = false;
927: return ("</strong>");
928: }
929: if (em) {
930: em = false;
931: return ("</em>");
932: }
933: return null;
934: }
935: } else {
936: yy_ScanError(YY_NO_MATCH);
937: }
938: }
939: }
940: }
941:
942: }
|