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-2002 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 java.io.*;
025: import org.apache.log4j.*;
026: import vqwiki.*;
027: import vqwiki.utils.*;
028:
029: /**
030: * This class is a scanner generated by
031: * <a href="http://www.jflex.de/">JFlex</a> 1.3.5
032: * on 13-9-06 0:53 from the specification file
033: * <tt>file:/C:/SourceForge/VQWiki_2X/vqwiki-classic/jlex/LinkLexLoose</tt>
034: */
035: public class LinkLexLoose implements vqwiki.lex.Lexer {
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: final public static int EXTERNAL = 4;
046: final public static int PRE = 3;
047: final public static int OFF = 2;
048: final public static int NORMAL = 1;
049:
050: /**
051: * Translates characters to character classes
052: */
053: final private static String yycmap_packed = "\11\0\1\1\1\1\2\0\1\1\22\0\1\6\1\0\1\37\2\0"
054: + "\1\7\1\0\1\37\2\5\3\0\1\7\1\22\1\40\12\4\1\21"
055: + "\1\0\1\42\1\0\1\43\2\0\32\10\1\13\1\44\1\14\1\0"
056: + "\1\41\1\12\1\15\1\11\1\17\1\11\1\31\1\25\1\23\1\20"
057: + "\1\24\1\26\1\11\1\33\1\32\1\30\1\34\1\27\1\11\1\45"
058: + "\1\36\1\16\2\11\1\35\3\11\102\0\1\2\1\0\1\2\35\0"
059: + "\1\3\21\0\1\2\210\0\1\3\ufe87\0";
060:
061: /**
062: * Translates characters to character classes
063: */
064: final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
065:
066: /**
067: * Translates a state to a row index in the transition table
068: */
069: final private static int yy_rowMap[] = { 0, 38, 76, 114, 152, 0, 0,
070: 190, 228, 266, 304, 342, 380, 418, 456, 494, 532, 570, 608,
071: 646, 684, 722, 760, 798, 836, 874, 190, 228, 912, 266, 950,
072: 988, 1026, 1064, 1102, 1140, 1178, 1216, 1254, 1292, 1330,
073: 0, 1368, 1406, 0, 1444, 1482, 1520, 912, 1558, 0, 1596,
074: 1634, 1672, 1710, 1748, 1786, 1824, 1862, 1900, 1938, 0,
075: 1976, 2014, 1520, 1558, 2052, 2090, 2128, 2166, 2204, 2242,
076: 2280, 2318, 2356, 2394, 0, 0, 2432, 2470, 2508, 2546, 2584,
077: 0, 2622, 2660, 2698, 2736, 2774, 0, 0, 2812, 2850, 2888,
078: 2926, 2964, 3002, 3040, 3078, 3116, 3154, 3192, 3230, 3268,
079: 3306, 3344, 3382, 3420, 3458, 3496, 3534, 2736, 2774, 3572,
080: 3610, 3648, 2926 };
081:
082: /**
083: * The packed transition table of the DFA (part 0)
084: */
085: final private static String yy_packed0 = "\46\0\1\6\1\7\2\10\1\11\1\6\1\7\1\6"
086: + "\1\12\1\11\1\13\1\14\1\6\1\15\1\16\1\11"
087: + "\1\17\2\6\2\11\1\20\2\11\1\21\1\11\1\22"
088: + "\4\11\2\6\1\23\1\24\1\6\1\25\1\11\1\6"
089: + "\1\7\4\6\1\7\32\6\1\26\5\6\1\7\4\6"
090: + "\1\7\4\6\1\27\26\6\1\30\4\6\1\7\4\6"
091: + "\1\7\4\6\1\31\32\6\2\0\1\32\1\33\4\0"
092: + "\1\33\1\32\3\0\4\32\2\0\14\32\6\0\1\32"
093: + "\4\0\1\34\3\0\2\34\3\0\4\34\1\35\1\0"
094: + "\14\34\6\0\1\34\2\0\1\32\1\33\1\34\3\0"
095: + "\1\36\1\37\3\0\4\37\1\35\1\0\14\37\6\0"
096: + "\1\37\2\0\3\40\3\0\2\40\3\0\4\40\2\0"
097: + "\14\40\6\0\1\40\13\0\1\41\26\0\1\42\7\0"
098: + "\1\34\3\0\2\34\3\0\1\34\1\43\2\34\1\35"
099: + "\1\0\14\34\6\0\1\34\4\0\1\34\3\0\2\34"
100: + "\3\0\4\34\1\35\1\0\6\34\1\44\5\34\6\0"
101: + "\1\34\4\0\1\34\3\0\2\34\3\0\1\34\1\45"
102: + "\2\34\1\35\1\0\14\34\6\0\1\34\4\0\1\34"
103: + "\3\0\2\34\3\0\1\34\1\46\2\34\1\35\1\0"
104: + "\1\34\1\47\12\34\6\0\1\34\4\0\1\34\3\0"
105: + "\2\34\3\0\4\34\1\35\1\0\6\34\1\50\5\34"
106: + "\6\0\1\34\4\0\1\34\3\0\2\34\3\0\1\51"
107: + "\3\34\1\35\1\0\14\34\6\0\1\34\41\0\1\52"
108: + "\33\0\1\53\57\0\1\54\45\0\1\55\46\0\1\42"
109: + "\43\0\1\56\47\0\1\57\5\0\2\60\4\0\1\60"
110: + "\1\32\3\0\4\32\2\0\14\32\6\0\1\32\4\0"
111: + "\1\61\2\0\3\61\3\0\4\61\1\0\15\61\1\0"
112: + "\2\61\3\0\1\61\2\0\2\60\1\34\3\0\1\62"
113: + "\1\37\3\0\4\37\1\35\1\0\14\37\6\0\1\37"
114: + "\2\0\3\40\3\0\2\40\1\63\2\0\4\40\2\0"
115: + "\14\40\6\0\1\40\2\0\3\64\3\0\2\64\3\0"
116: + "\4\64\2\0\14\64\6\0\1\64\10\0\2\65\3\0"
117: + "\4\65\2\0\14\65\6\0\1\65\4\0\1\34\3\0"
118: + "\2\34\3\0\1\34\1\66\2\34\1\35\1\0\14\34"
119: + "\6\0\1\34\4\0\1\34\3\0\2\34\3\0\4\34"
120: + "\1\35\1\0\10\34\1\67\3\34\6\0\1\34\4\0"
121: + "\1\34\3\0\2\34\3\0\1\34\1\70\2\34\1\35"
122: + "\1\0\14\34\6\0\1\34\4\0\1\34\3\0\2\34"
123: + "\3\0\4\34\1\35\1\0\4\34\1\71\7\34\6\0"
124: + "\1\34\4\0\1\34\3\0\2\34\3\0\4\34\1\35"
125: + "\1\0\10\34\1\72\3\34\6\0\1\34\4\0\1\34"
126: + "\3\0\2\34\3\0\4\34\1\35\1\0\12\34\1\73"
127: + "\1\34\6\0\1\34\4\0\1\34\3\0\2\34\3\0"
128: + "\4\34\1\35\1\0\1\34\1\74\12\34\6\0\1\34"
129: + "\45\0\1\75\41\0\1\76\33\0\1\77\56\0\1\100"
130: + "\7\0\1\101\1\60\4\0\1\60\1\101\3\0\4\101"
131: + "\2\0\14\101\6\0\1\101\2\0\1\101\1\60\1\34"
132: + "\3\0\1\62\1\102\3\0\4\102\1\35\1\0\14\102"
133: + "\6\0\1\102\2\0\3\64\3\0\2\64\2\0\1\103"
134: + "\4\64\2\0\14\64\6\0\1\64\10\0\2\65\3\0"
135: + "\4\65\2\0\14\65\4\0\1\104\1\0\1\65\4\0"
136: + "\1\34\3\0\2\34\3\0\1\105\3\34\1\35\1\0"
137: + "\14\34\6\0\1\34\4\0\1\34\3\0\2\34\3\0"
138: + "\4\34\1\35\1\0\5\34\1\106\6\34\6\0\1\34"
139: + "\4\0\1\34\3\0\2\34\3\0\4\34\1\35\1\0"
140: + "\4\34\1\107\7\34\6\0\1\34\4\0\1\34\3\0"
141: + "\2\34\3\0\4\34\1\110\1\0\14\34\6\0\1\34"
142: + "\4\0\1\34\3\0\2\34\3\0\4\34\1\35\1\0"
143: + "\6\34\1\71\5\34\6\0\1\34\4\0\1\34\3\0"
144: + "\2\34\3\0\4\34\1\35\1\0\13\34\1\71\6\0"
145: + "\1\34\4\0\1\34\3\0\2\34\3\0\4\34\1\35"
146: + "\1\0\10\34\1\111\3\34\6\0\1\34\31\0\1\112"
147: + "\61\0\1\113\10\0\2\114\3\0\4\114\2\0\14\114"
148: + "\6\0\1\114\14\0\1\115\45\0\1\116\35\0\1\34"
149: + "\3\0\2\34\3\0\2\34\1\117\1\34\1\35\1\0"
150: + "\14\34\6\0\1\34\4\0\1\34\3\0\2\34\3\0"
151: + "\4\34\1\35\1\0\6\34\1\120\5\34\6\0\1\34"
152: + "\4\0\1\34\3\0\2\34\3\0\4\34\1\110\1\0"
153: + "\13\34\1\71\6\0\1\34\1\121\1\0\2\121\1\122"
154: + "\1\121\1\0\3\122\3\121\4\122\1\121\15\122\1\0"
155: + "\2\122\2\0\1\121\1\122\4\0\1\34\3\0\2\34"
156: + "\3\0\1\34\1\123\2\34\1\35\1\0\14\34\6\0"
157: + "\1\34\43\0\1\124\33\0\1\125\24\0\2\114\3\0"
158: + "\4\114\2\0\14\114\4\0\1\126\1\0\1\114\4\0"
159: + "\1\34\3\0\2\34\3\0\3\34\1\127\1\35\1\0"
160: + "\14\34\6\0\1\34\4\0\1\34\3\0\2\34\3\0"
161: + "\1\34\1\71\2\34\1\35\1\0\14\34\6\0\1\34"
162: + "\1\121\1\0\2\121\1\130\1\121\1\0\1\121\2\130"
163: + "\3\121\4\130\2\121\14\130\1\0\1\130\1\121\2\0"
164: + "\1\121\1\130\1\121\1\0\2\121\1\131\1\121\1\0"
165: + "\1\122\2\131\3\121\4\131\1\121\1\122\14\131\1\0"
166: + "\1\131\1\122\2\0\1\121\1\131\4\0\1\34\3\0"
167: + "\2\34\3\0\4\34\1\35\1\0\11\34\1\71\2\34"
168: + "\6\0\1\34\43\0\1\132\16\0\1\133\35\0\1\34"
169: + "\3\0\2\34\3\0\4\34\1\134\1\0\14\34\6\0"
170: + "\1\34\1\121\1\0\2\121\1\130\1\121\1\0\1\121"
171: + "\2\130\3\121\4\130\1\121\1\135\14\130\1\0\1\130"
172: + "\1\121\2\0\1\121\1\130\1\121\1\0\2\121\1\131"
173: + "\1\121\1\0\1\122\2\131\3\121\4\131\1\121\1\136"
174: + "\14\131\1\0\1\131\1\122\2\0\1\121\1\131\4\0"
175: + "\6\137\3\0\4\137\1\0\15\137\1\0\2\137\3\0"
176: + "\1\137\1\121\1\0\2\121\1\130\1\121\1\0\1\121"
177: + "\2\130\3\121\4\130\2\121\1\140\2\130\1\141\1\142"
178: + "\7\130\1\0\1\130\1\121\2\0\1\121\1\130\1\121"
179: + "\1\0\2\121\1\131\1\121\1\0\1\122\2\131\3\121"
180: + "\4\131\1\121\1\122\1\143\2\131\1\144\1\145\7\131"
181: + "\1\0\1\131\1\122\2\0\1\121\1\131\4\0\6\137"
182: + "\3\0\4\137\1\0\1\146\14\137\1\0\2\137\3\0"
183: + "\1\137\1\121\1\0\2\121\1\130\1\121\1\0\1\121"
184: + "\2\130\3\121\4\130\1\121\1\135\1\130\1\147\12\130"
185: + "\1\0\1\130\1\121\2\0\1\121\1\130\1\121\1\0"
186: + "\2\121\1\130\1\121\1\0\1\121\2\130\3\121\4\130"
187: + "\1\121\1\135\4\130\1\150\7\130\1\0\1\130\1\121"
188: + "\2\0\1\121\1\130\1\121\1\0\2\121\1\130\1\121"
189: + "\1\0\1\121\2\130\3\121\4\130\1\121\1\135\5\130"
190: + "\1\151\6\130\1\0\1\130\1\121\2\0\1\121\1\130"
191: + "\1\121\1\0\2\121\1\131\1\121\1\0\1\122\2\131"
192: + "\3\121\4\131\1\121\1\136\1\131\1\152\12\131\1\0"
193: + "\1\131\1\122\2\0\1\121\1\131\1\121\1\0\2\121"
194: + "\1\131\1\121\1\0\1\122\2\131\3\121\4\131\1\121"
195: + "\1\136\4\131\1\153\7\131\1\0\1\131\1\122\2\0"
196: + "\1\121\1\131\1\121\1\0\2\121\1\131\1\121\1\0"
197: + "\1\122\2\131\3\121\4\131\1\121\1\136\5\131\1\154"
198: + "\6\131\1\0\1\131\1\122\2\0\1\121\1\131\4\0"
199: + "\6\137\3\0\4\137\1\0\1\146\1\155\2\137\1\156"
200: + "\1\157\7\137\1\0\2\137\3\0\1\137\1\121\1\0"
201: + "\2\121\1\130\1\121\1\0\1\121\2\130\3\121\4\130"
202: + "\1\121\1\135\2\130\1\160\11\130\1\0\1\130\1\121"
203: + "\2\0\1\121\1\130\1\121\1\0\2\121\1\130\1\121"
204: + "\1\0\1\121\2\130\3\121\4\130\1\121\1\135\1\160"
205: + "\5\130\1\151\5\130\1\0\1\130\1\121\2\0\1\121"
206: + "\1\130\1\121\1\0\2\121\1\130\1\121\1\0\1\121"
207: + "\2\130\3\121\4\130\1\121\1\135\1\160\13\130\1\0"
208: + "\1\130\1\121\2\0\1\121\1\130\1\121\1\0\2\121"
209: + "\1\131\1\121\1\0\1\122\2\131\3\121\4\131\1\121"
210: + "\1\136\2\131\1\161\11\131\1\0\1\131\1\122\2\0"
211: + "\1\121\1\131\1\121\1\0\2\121\1\131\1\121\1\0"
212: + "\1\122\2\131\3\121\4\131\1\121\1\136\1\161\5\131"
213: + "\1\154\5\131\1\0\1\131\1\122\2\0\1\121\1\131"
214: + "\1\121\1\0\2\121\1\131\1\121\1\0\1\122\2\131"
215: + "\3\121\4\131\1\121\1\136\1\161\13\131\1\0\1\131"
216: + "\1\122\2\0\1\121\1\131\4\0\6\137\3\0\4\137"
217: + "\1\0\1\146\1\137\1\162\12\137\1\0\2\137\3\0"
218: + "\1\137\4\0\6\137\3\0\4\137\1\0\1\146\4\137"
219: + "\1\163\7\137\1\0\2\137\3\0\1\137\4\0\6\137"
220: + "\3\0\4\137\1\0\1\146\5\137\1\164\6\137\1\0"
221: + "\2\137\3\0\1\137\4\0\6\137\3\0\4\137\1\0"
222: + "\1\146\2\137\1\165\11\137\1\0\2\137\3\0\1\137"
223: + "\4\0\6\137\3\0\4\137\1\0\1\146\1\165\5\137"
224: + "\1\164\5\137\1\0\2\137\3\0\1\137\4\0\6\137"
225: + "\3\0\4\137\1\0\1\146\1\165\13\137\1\0\2\137"
226: + "\3\0\1\137";
227:
228: /**
229: * The transition table of the DFA
230: */
231: final private static int yytrans[] = yy_unpack();
232:
233: /* error codes */
234: final private static int YY_UNKNOWN_ERROR = 0;
235: final private static int YY_ILLEGAL_STATE = 1;
236: final private static int YY_NO_MATCH = 2;
237: final private static int YY_PUSHBACK_2BIG = 3;
238:
239: /* error messages for the codes above */
240: final private static String YY_ERROR_MSG[] = {
241: "Unkown internal scanner error",
242: "Internal error: unknown state",
243: "Error: could not match input",
244: "Error: pushback value was too large" };
245:
246: /**
247: * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
248: */
249: private final static byte YY_ATTRIBUTE[] = { 8, 0, 0, 0, 0, 9, 9,
250: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
251: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 9, 0, 0,
252: 0, 1, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 1, 1, 0,
253: 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 1, 0, 9, 0, 0, 0,
254: 1, 1, 9, 9, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
255: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
256:
257: /** the input device */
258: private java.io.Reader yy_reader;
259:
260: /** the current state of the DFA */
261: private int yy_state;
262:
263: /** the current lexical state */
264: private int yy_lexical_state = YYINITIAL;
265:
266: /** this buffer contains the current text to be matched and is
267: the source of the yytext() string */
268: private char yy_buffer[] = new char[YY_BUFFERSIZE];
269:
270: /** the textposition at the last accepting state */
271: private int yy_markedPos;
272:
273: /** the textposition at the last state to be included in yytext */
274: private int yy_pushbackPos;
275:
276: /** the current text position in the buffer */
277: private int yy_currentPos;
278:
279: /** startRead marks the beginning of the yytext() string in the buffer */
280: private int yy_startRead;
281:
282: /** endRead marks the last character in the buffer, that has been read
283: from input */
284: private int yy_endRead;
285:
286: /** number of newlines encountered up to the start of the matched text */
287: private int yyline;
288:
289: /** the number of characters up to the start of the matched text */
290: private int yychar;
291:
292: /**
293: * the number of characters from the last newline up to the start of the
294: * matched text
295: */
296: private int yycolumn;
297:
298: /**
299: * yy_atBOL == true <=> the scanner is currently at the beginning of a line
300: */
301: private boolean yy_atBOL = true;
302:
303: /** yy_atEOF == true <=> the scanner is at the EOF */
304: private boolean yy_atEOF;
305:
306: /* user code: */
307: protected static Category cat = Category.getInstance(LinkLex.class);
308: protected String virtualWiki;
309:
310: protected boolean exists(String topic) {
311: try {
312: return WikiBase.getInstance().exists(virtualWiki, topic);
313: } catch (Exception err) {
314: cat.error(err);
315: }
316: return false;
317: }
318:
319: protected boolean ignoreWikiname(String name) {
320: return Environment.getInstance().doIgnoreWikiname(name);
321: }
322:
323: public void setVirtualWiki(String vWiki) {
324: this .virtualWiki = vWiki;
325: }
326:
327: /**
328: * Creates a new scanner
329: * There is also a java.io.InputStream version of this constructor.
330: *
331: * @param in the java.io.Reader to read input from.
332: */
333: public LinkLexLoose(java.io.Reader in) {
334: yybegin(NORMAL);
335: this .yy_reader = in;
336: }
337:
338: /**
339: * Creates a new scanner.
340: * There is also java.io.Reader version of this constructor.
341: *
342: * @param in the java.io.Inputstream to read input from.
343: */
344: public LinkLexLoose(java.io.InputStream in) {
345: this (new java.io.InputStreamReader(in));
346: }
347:
348: /**
349: * Unpacks the split, compressed DFA transition table.
350: *
351: * @return the unpacked transition table
352: */
353: private static int[] yy_unpack() {
354: int[] trans = new int[3686];
355: int offset = 0;
356: offset = yy_unpack(yy_packed0, offset, trans);
357: return trans;
358: }
359:
360: /**
361: * Unpacks the compressed DFA transition table.
362: *
363: * @param packed the packed transition table
364: * @return the index of the last entry
365: */
366: private static int yy_unpack(String packed, int offset, int[] trans) {
367: int i = 0; /* index in packed string */
368: int j = offset; /* index in unpacked array */
369: int l = packed.length();
370: while (i < l) {
371: int count = packed.charAt(i++);
372: int value = packed.charAt(i++);
373: value--;
374: do
375: trans[j++] = value;
376: while (--count > 0);
377: }
378: return j;
379: }
380:
381: /**
382: * Unpacks the compressed character translation table.
383: *
384: * @param packed the packed character translation table
385: * @return the unpacked character translation table
386: */
387: private static char[] yy_unpack_cmap(String packed) {
388: char[] map = new char[0x10000];
389: int i = 0; /* index in packed string */
390: int j = 0; /* index in unpacked array */
391: while (i < 132) {
392: int count = packed.charAt(i++);
393: char value = packed.charAt(i++);
394: do
395: map[j++] = value;
396: while (--count > 0);
397: }
398: return map;
399: }
400:
401: /**
402: * Refills the input buffer.
403: *
404: * @return <code>false</code>, iff there was new input.
405: *
406: * @exception IOException if any I/O-Error occurs
407: */
408: private boolean yy_refill() throws java.io.IOException {
409:
410: /* first: make room (if you can) */
411: if (yy_startRead > 0) {
412: System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0,
413: yy_endRead - yy_startRead);
414:
415: /* translate stored positions */
416: yy_endRead -= yy_startRead;
417: yy_currentPos -= yy_startRead;
418: yy_markedPos -= yy_startRead;
419: yy_pushbackPos -= yy_startRead;
420: yy_startRead = 0;
421: }
422:
423: /* is the buffer big enough? */
424: if (yy_currentPos >= yy_buffer.length) {
425: /* if not: blow it up */
426: char newBuffer[] = new char[yy_currentPos * 2];
427: System.arraycopy(yy_buffer, 0, newBuffer, 0,
428: yy_buffer.length);
429: yy_buffer = newBuffer;
430: }
431:
432: /* finally: fill the buffer with new input */
433: int numRead = yy_reader.read(yy_buffer, yy_endRead,
434: yy_buffer.length - yy_endRead);
435:
436: if (numRead < 0) {
437: return true;
438: } else {
439: yy_endRead += numRead;
440: return false;
441: }
442: }
443:
444: /**
445: * Closes the input stream.
446: */
447: final public void yyclose() throws java.io.IOException {
448: yy_atEOF = true; /* indicate end of file */
449: yy_endRead = yy_startRead; /* invalidate buffer */
450:
451: if (yy_reader != null)
452: yy_reader.close();
453: }
454:
455: /**
456: * Closes the current stream, and resets the
457: * scanner to read from a new input stream.
458: *
459: * All internal variables are reset, the old input stream
460: * <b>cannot</b> be reused (internal buffer is discarded and lost).
461: * Lexical state is set to <tt>YY_INITIAL</tt>.
462: *
463: * @param reader the new input stream
464: */
465: final public void yyreset(java.io.Reader reader)
466: throws java.io.IOException {
467: yyclose();
468: yy_reader = reader;
469: yy_atBOL = true;
470: yy_atEOF = false;
471: yy_endRead = yy_startRead = 0;
472: yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
473: yyline = yychar = yycolumn = 0;
474: yy_lexical_state = YYINITIAL;
475: }
476:
477: /**
478: * Returns the current lexical state.
479: */
480: final public int yystate() {
481: return yy_lexical_state;
482: }
483:
484: /**
485: * Enters a new lexical state
486: *
487: * @param newState the new lexical state
488: */
489: final public void yybegin(int newState) {
490: yy_lexical_state = newState;
491: }
492:
493: /**
494: * Returns the text matched by the current regular expression.
495: */
496: final public String yytext() {
497: return new String(yy_buffer, yy_startRead, yy_markedPos
498: - yy_startRead);
499: }
500:
501: /**
502: * Returns the character at position <tt>pos</tt> from the
503: * matched text.
504: *
505: * It is equivalent to yytext().charAt(pos), but faster
506: *
507: * @param pos the position of the character to fetch.
508: * A value from 0 to yylength()-1.
509: *
510: * @return the character at position pos
511: */
512: final public char yycharat(int pos) {
513: return yy_buffer[yy_startRead + pos];
514: }
515:
516: /**
517: * Returns the length of the matched text region.
518: */
519: final public int yylength() {
520: return yy_markedPos - yy_startRead;
521: }
522:
523: /**
524: * Reports an error that occured while scanning.
525: *
526: * In a wellformed scanner (no or only correct usage of
527: * yypushback(int) and a match-all fallback rule) this method
528: * will only be called with things that "Can't Possibly Happen".
529: * If this method is called, something is seriously wrong
530: * (e.g. a JFlex bug producing a faulty scanner etc.).
531: *
532: * Usual syntax/scanner level error handling should be done
533: * in error fallback rules.
534: *
535: * @param errorCode the code of the errormessage to display
536: */
537: private void yy_ScanError(int errorCode) {
538: String message;
539: try {
540: message = YY_ERROR_MSG[errorCode];
541: } catch (ArrayIndexOutOfBoundsException e) {
542: message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
543: }
544:
545: throw new Error(message);
546: }
547:
548: /**
549: * Pushes the specified amount of characters back into the input stream.
550: *
551: * They will be read again by then next call of the scanning method
552: *
553: * @param number the number of characters to be read again.
554: * This number must not be greater than yylength()!
555: */
556: private void yypushback(int number) {
557: if (number > yylength())
558: yy_ScanError(YY_PUSHBACK_2BIG);
559:
560: yy_markedPos -= number;
561: }
562:
563: /**
564: * Resumes scanning until the next regular expression is matched,
565: * the end of input is encountered or an I/O-Error occurs.
566: *
567: * @return the next token
568: * @exception IOException if any I/O-Error occurs
569: */
570: public String yylex() throws java.io.IOException {
571: int yy_input;
572: int yy_action;
573:
574: // cached fields:
575: int yy_currentPos_l;
576: int yy_startRead_l;
577: int yy_markedPos_l;
578: int yy_endRead_l = yy_endRead;
579: char[] yy_buffer_l = yy_buffer;
580: char[] yycmap_l = yycmap;
581:
582: int[] yytrans_l = yytrans;
583: int[] yy_rowMap_l = yy_rowMap;
584: byte[] yy_attr_l = YY_ATTRIBUTE;
585:
586: while (true) {
587: yy_markedPos_l = yy_markedPos;
588:
589: yy_action = -1;
590:
591: yy_startRead_l = yy_currentPos_l = yy_currentPos = yy_startRead = yy_markedPos_l;
592:
593: yy_state = yy_lexical_state;
594:
595: yy_forAction: {
596: while (true) {
597:
598: if (yy_currentPos_l < yy_endRead_l)
599: yy_input = yy_buffer_l[yy_currentPos_l++];
600: else if (yy_atEOF) {
601: yy_input = YYEOF;
602: break yy_forAction;
603: } else {
604: // store back cached positions
605: yy_currentPos = yy_currentPos_l;
606: yy_markedPos = yy_markedPos_l;
607: boolean eof = yy_refill();
608: // get translated positions and possibly new buffer
609: yy_currentPos_l = yy_currentPos;
610: yy_markedPos_l = yy_markedPos;
611: yy_buffer_l = yy_buffer;
612: yy_endRead_l = yy_endRead;
613: if (eof) {
614: yy_input = YYEOF;
615: break yy_forAction;
616: } else {
617: yy_input = yy_buffer_l[yy_currentPos_l++];
618: }
619: }
620: int yy_next = yytrans_l[yy_rowMap_l[yy_state]
621: + yycmap_l[yy_input]];
622: if (yy_next == -1)
623: break yy_forAction;
624: yy_state = yy_next;
625:
626: int yy_attributes = yy_attr_l[yy_state];
627: if ((yy_attributes & 1) == 1) {
628: yy_action = yy_state;
629: yy_markedPos_l = yy_currentPos_l;
630: if ((yy_attributes & 8) == 8)
631: break yy_forAction;
632: }
633:
634: }
635: }
636:
637: // store back cached position
638: yy_markedPos = yy_markedPos_l;
639:
640: switch (yy_action) {
641:
642: case 94:
643: case 101:
644: case 108:
645: case 109:
646: case 110:
647: case 113:
648: case 114:
649: case 115: {
650: cat.debug("{attachment}");
651: String displayLink = yytext();
652: String attachmentName = displayLink.substring(7);
653: String link = "Wiki?action=action_view_attachment&attachment="
654: + JSPUtils.encodeURL(attachmentName);
655: StringBuffer buffer = new StringBuffer();
656: buffer.append("<a");
657: if (Environment.getInstance().getStringSetting(
658: Environment.PROPERTY_ATTACHMENT_TYPE).equals(
659: "inline"))
660: buffer.append(" target=\"_blank\"");
661: buffer.append(" href=\"");
662: buffer.append(link);
663: buffer.append("\" >att:");
664: buffer.append(attachmentName);
665: buffer.append("</a>");
666: return buffer.toString();
667: }
668: case 118:
669: break;
670: case 83: {
671: cat.debug("@@@@{newline} entering PRE");
672: yybegin(PRE);
673: return yytext();
674: }
675: case 119:
676: break;
677: case 5:
678: case 7:
679: case 8:
680: case 9:
681: case 10:
682: case 11:
683: case 12:
684: case 13:
685: case 14:
686: case 15:
687: case 16:
688: case 17:
689: case 18:
690: case 19:
691: case 20:
692: case 21:
693: case 22:
694: case 23:
695: case 24: {
696: cat.debug(". (" + yytext() + ")");
697: return yytext();
698: }
699: case 120:
700: break;
701: case 90: {
702: cat.debug("external end");
703: yybegin(NORMAL);
704: }
705: case 121:
706: break;
707: case 61: {
708: cat.debug("escaped double backslash");
709: return "__";
710: }
711: case 122:
712: break;
713: case 6: {
714: return yytext();
715: }
716: case 123:
717: break;
718: case 116: {
719: cat.debug("{imageattachment}");
720: String displayLink = yytext();
721: String attachmentName = displayLink.substring(7);
722: String link = "Wiki?action=action_view_attachment&attachment="
723: + JSPUtils.encodeURL(attachmentName);
724: return "<img src=\"" + link.trim() + "\"/>";
725: }
726: case 124:
727: break;
728: case 48:
729: case 81:
730: case 93: {
731: String text = yytext();
732: try {
733: return LinkExtender.generateLink(text.substring(0,
734: text.indexOf(':')), text.substring(text
735: .indexOf(':') + 1), text);
736: } catch (Exception err) {
737: cat.error(err);
738: return text;
739: }
740: }
741: case 125:
742: break;
743: case 64:
744: case 65: {
745: cat.debug("{link} '" + yytext() + "'");
746: String link = yytext();
747: if (ignoreWikiname(link))
748: return yytext();
749: if (exists(link.trim())) {
750: return "<a href=\"Wiki?" + link.trim() + "\">"
751: + link + "</a>";
752: } else {
753: return link + "<a href=\"Wiki?topic=" + link.trim()
754: + "&action=action_edit\">?</a>";
755: }
756: }
757: case 126:
758: break;
759: case 111:
760: case 112: {
761: cat.debug("{image}");
762: String link = yytext();
763: return "<img src=\"" + link.trim() + "\"/>";
764: }
765: case 127:
766: break;
767: case 87:
768: case 88:
769: case 95:
770: case 96:
771: case 97:
772: case 98:
773: case 99:
774: case 100:
775: case 102:
776: case 103:
777: case 104:
778: case 105:
779: case 106:
780: case 107: {
781: cat.debug("{hyperlink}");
782: String link = yytext();
783: // return "<a href=\"" + link.trim() + "\">" +
784: // link + "</a>";
785: return LinkExtender
786: .generateNonExpandedLink(link.trim());
787: }
788: case 128:
789: break;
790: case 50: {
791: cat.debug("{link2}");
792: if (!Environment.getInstance().isAllowBackTick()) {
793: cat.debug("No back-tick links allowed");
794: return yytext();
795: }
796: String link = yytext();
797: link = link.substring(1);
798: link = link.substring(0, link.length() - 1);
799: if (exists(link)) {
800: return "<a href=\"Wiki?" + link.trim() + "\">"
801: + link + "</a>";
802: } else {
803: return link + "<a href=\"Wiki?topic=" + link.trim()
804: + "&action=action_edit\">?</a>";
805: }
806: }
807: case 129:
808: break;
809: case 76: { // FEF.IV
810: cat.debug("{link3}");
811: String link = yytext();
812: link = link.substring(2);
813: link = link.substring(0, link.length() - 2);
814: if (exists(link)) {
815: return "<a href=\"Wiki?" + link.trim() + "\">"
816: + link + "</a>";
817: } else {
818: return link + "<a href=\"Wiki?topic=" + link.trim()
819: + "&action=action_edit\">?</a>";
820: }
821: }
822: case 130:
823: break;
824: case 89: {
825: cat.debug("{newline}x2 leaving pre");
826: yybegin(NORMAL);
827: return yytext();
828: }
829: case 131:
830: break;
831: case 77: {
832: cat.debug("external");
833: yybegin(EXTERNAL);
834: }
835: case 132:
836: break;
837: case 41: {
838: cat.debug("off");
839: yybegin(OFF);
840: }
841: case 133:
842: break;
843: case 44: {
844: cat.debug("on");
845: yybegin(NORMAL);
846: }
847: case 134:
848: break;
849: default:
850: if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
851: yy_atEOF = true;
852: {
853: return null;
854: }
855: } else {
856: yy_ScanError(YY_NO_MATCH);
857: }
858: }
859: }
860: }
861:
862: }
|