0001: package vqwiki.lex;
0002:
0003: /*
0004: Very Quick Wiki - WikiWikiWeb clone
0005: Copyright (C) 2001 Gareth Cronin
0006: This program is free software; you can redistribute it and/or modify
0007: it under the terms of the GNU General Public License as published by
0008: the Free Software Foundation; either version 2 of the License, or
0009: (at your option) any later version.
0010: This program is distributed in the hope that it will be useful,
0011: but WITHOUT ANY WARRANTY; without even the implied warranty of
0012: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013: GNU General Public License for more details.
0014: You should have received a copy of the GNU General Public License
0015: along with this program (gpl.txt); if not, write to the Free Software
0016: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0017: */
0018:
0019: import org.apache.log4j.Category;
0020: import vqwiki.Environment;
0021: import vqwiki.WikiBase;
0022: import vqwiki.utils.JSPUtils;
0023:
0024: public class Yylex implements vqwiki.lex.Lexer {
0025: private final int YY_BUFFER_SIZE = 512;
0026: private final int YY_F = -1;
0027: private final int YY_NO_STATE = -1;
0028: private final int YY_NOT_ACCEPT = 0;
0029: private final int YY_START = 1;
0030: private final int YY_END = 2;
0031: private final int YY_NO_ANCHOR = 4;
0032: private final int YY_BOL = 256;
0033: private final int YY_EOF = 257;
0034:
0035: protected boolean em, strong, unordered, ordered, table, row, pre,
0036: cell;
0037: protected static Category cat = Category.getInstance(Yylex.class);
0038: protected String virtualWiki;
0039: protected final static String mskb = "http://support.microsoft.com/default.aspx?scid=KB;EN-US;";
0040:
0041: protected boolean exists(String topic) {
0042: try {
0043: return WikiBase.getInstance().exists(virtualWiki, topic);
0044: } catch (Exception err) {
0045: cat.error(err);
0046: }
0047: return false;
0048: }
0049:
0050: public void setVirtualWiki(String vWiki) {
0051: this .virtualWiki = vWiki;
0052: }
0053:
0054: private java.io.BufferedReader yy_reader;
0055: private int yy_buffer_index;
0056: private int yy_buffer_read;
0057: private int yy_buffer_start;
0058: private int yy_buffer_end;
0059: private char yy_buffer[];
0060: private boolean yy_at_bol;
0061: private int yy_lexical_state;
0062:
0063: public Yylex(java.io.Reader reader) {
0064: this ();
0065: if (null == reader) {
0066: throw (new Error("Error: Bad input stream initializer."));
0067: }
0068: yy_reader = new java.io.BufferedReader(reader);
0069: }
0070:
0071: public Yylex(java.io.InputStream instream) {
0072: this ();
0073: if (null == instream) {
0074: throw (new Error("Error: Bad input stream initializer."));
0075: }
0076: yy_reader = new java.io.BufferedReader(
0077: new java.io.InputStreamReader(instream));
0078: }
0079:
0080: private Yylex() {
0081: yy_buffer = new char[YY_BUFFER_SIZE];
0082: yy_buffer_read = 0;
0083: yy_buffer_index = 0;
0084: yy_buffer_start = 0;
0085: yy_buffer_end = 0;
0086: yy_at_bol = true;
0087: yy_lexical_state = YYINITIAL;
0088:
0089: boolean allowHtml = Environment.getInstance().getAllowHTML();
0090: if (allowHtml) {
0091: yybegin(ALLOWHTML);
0092: } else {
0093: yybegin(NORMAL);
0094: }
0095: }
0096:
0097: private boolean yy_eof_done = false;
0098: private final int ALLOWHTML = 2;
0099: private final int YYINITIAL = 0;
0100: private final int PRE = 3;
0101: private final int NORMAL = 1;
0102: private final int yy_state_dtrans[] = { 0, 34, 118, 119 };
0103:
0104: private void yybegin(int state) {
0105: yy_lexical_state = state;
0106: }
0107:
0108: private int yy_advance() throws java.io.IOException {
0109: int next_read;
0110: int i;
0111: int j;
0112:
0113: if (yy_buffer_index < yy_buffer_read) {
0114: return yy_buffer[yy_buffer_index++];
0115: }
0116:
0117: if (0 != yy_buffer_start) {
0118: i = yy_buffer_start;
0119: j = 0;
0120: while (i < yy_buffer_read) {
0121: yy_buffer[j] = yy_buffer[i];
0122: ++i;
0123: ++j;
0124: }
0125: yy_buffer_end = yy_buffer_end - yy_buffer_start;
0126: yy_buffer_start = 0;
0127: yy_buffer_read = j;
0128: yy_buffer_index = j;
0129: next_read = yy_reader.read(yy_buffer, yy_buffer_read,
0130: yy_buffer.length - yy_buffer_read);
0131: if (-1 == next_read) {
0132: return YY_EOF;
0133: }
0134: yy_buffer_read = yy_buffer_read + next_read;
0135: }
0136:
0137: while (yy_buffer_index >= yy_buffer_read) {
0138: if (yy_buffer_index >= yy_buffer.length) {
0139: yy_buffer = yy_double(yy_buffer);
0140: }
0141: next_read = yy_reader.read(yy_buffer, yy_buffer_read,
0142: yy_buffer.length - yy_buffer_read);
0143: if (-1 == next_read) {
0144: return YY_EOF;
0145: }
0146: yy_buffer_read = yy_buffer_read + next_read;
0147: }
0148: return yy_buffer[yy_buffer_index++];
0149: }
0150:
0151: private void yy_move_end() {
0152: if (yy_buffer_end > yy_buffer_start
0153: && '\n' == yy_buffer[yy_buffer_end - 1])
0154: yy_buffer_end--;
0155: if (yy_buffer_end > yy_buffer_start
0156: && '\r' == yy_buffer[yy_buffer_end - 1])
0157: yy_buffer_end--;
0158: }
0159:
0160: private boolean yy_last_was_cr = false;
0161:
0162: private void yy_mark_start() {
0163: yy_buffer_start = yy_buffer_index;
0164: }
0165:
0166: private void yy_mark_end() {
0167: yy_buffer_end = yy_buffer_index;
0168: }
0169:
0170: private void yy_to_mark() {
0171: yy_buffer_index = yy_buffer_end;
0172: yy_at_bol = (yy_buffer_end > yy_buffer_start)
0173: && ('\r' == yy_buffer[yy_buffer_end - 1]
0174: || '\n' == yy_buffer[yy_buffer_end - 1]
0175: || 2028/*LS*/== yy_buffer[yy_buffer_end - 1] || 2029/*PS*/== yy_buffer[yy_buffer_end - 1]);
0176: }
0177:
0178: private java.lang.String yytext() {
0179: return (new java.lang.String(yy_buffer, yy_buffer_start,
0180: yy_buffer_end - yy_buffer_start));
0181: }
0182:
0183: private int yylength() {
0184: return yy_buffer_end - yy_buffer_start;
0185: }
0186:
0187: private char[] yy_double(char buf[]) {
0188: int i;
0189: char newbuf[];
0190: newbuf = new char[2 * buf.length];
0191: for (i = 0; i < buf.length; ++i) {
0192: newbuf[i] = buf[i];
0193: }
0194: return newbuf;
0195: }
0196:
0197: private final int YY_E_INTERNAL = 0;
0198: private final int YY_E_MATCH = 1;
0199: private java.lang.String yy_error_string[] = {
0200: "Error: Internal error.\n", "Error: Unmatched input.\n" };
0201:
0202: private void yy_error(int code, boolean fatal) {
0203: java.lang.System.out.print(yy_error_string[code]);
0204: java.lang.System.out.flush();
0205: if (fatal) {
0206: throw new Error("Fatal Error.\n");
0207: }
0208: }
0209:
0210: private int[][] unpackFromString(int size1, int size2, String st) {
0211: int colonIndex = -1;
0212: String lengthString;
0213: int sequenceLength = 0;
0214: int sequenceInteger = 0;
0215:
0216: int commaIndex;
0217: String workString;
0218:
0219: int res[][] = new int[size1][size2];
0220: for (int i = 0; i < size1; i++) {
0221: for (int j = 0; j < size2; j++) {
0222: if (sequenceLength != 0) {
0223: res[i][j] = sequenceInteger;
0224: sequenceLength--;
0225: continue;
0226: }
0227: commaIndex = st.indexOf(',');
0228: workString = (commaIndex == -1) ? st : st.substring(0,
0229: commaIndex);
0230: st = st.substring(commaIndex + 1);
0231: colonIndex = workString.indexOf(':');
0232: if (colonIndex == -1) {
0233: res[i][j] = Integer.parseInt(workString);
0234: continue;
0235: }
0236: lengthString = workString.substring(colonIndex + 1);
0237: sequenceLength = Integer.parseInt(lengthString);
0238: workString = workString.substring(0, colonIndex);
0239: sequenceInteger = Integer.parseInt(workString);
0240: res[i][j] = sequenceInteger;
0241: sequenceLength--;
0242: }
0243: }
0244: return res;
0245: }
0246:
0247: private int yy_acpt[] = {
0248: /* 0 */YY_NOT_ACCEPT,
0249: /* 1 */YY_NO_ANCHOR,
0250: /* 2 */YY_NO_ANCHOR,
0251: /* 3 */YY_NO_ANCHOR,
0252: /* 4 */YY_NO_ANCHOR,
0253: /* 5 */YY_NO_ANCHOR,
0254: /* 6 */YY_NO_ANCHOR,
0255: /* 7 */YY_NO_ANCHOR,
0256: /* 8 */YY_NO_ANCHOR,
0257: /* 9 */YY_NO_ANCHOR,
0258: /* 10 */YY_NO_ANCHOR,
0259: /* 11 */YY_NO_ANCHOR,
0260: /* 12 */YY_NO_ANCHOR,
0261: /* 13 */YY_NO_ANCHOR,
0262: /* 14 */YY_NO_ANCHOR,
0263: /* 15 */YY_NO_ANCHOR,
0264: /* 16 */YY_NO_ANCHOR,
0265: /* 17 */YY_NO_ANCHOR,
0266: /* 18 */YY_NO_ANCHOR,
0267: /* 19 */YY_NO_ANCHOR,
0268: /* 20 */YY_NO_ANCHOR,
0269: /* 21 */YY_NO_ANCHOR,
0270: /* 22 */YY_NO_ANCHOR,
0271: /* 23 */YY_NO_ANCHOR,
0272: /* 24 */YY_NO_ANCHOR,
0273: /* 25 */YY_NO_ANCHOR,
0274: /* 26 */YY_NO_ANCHOR,
0275: /* 27 */YY_NO_ANCHOR,
0276: /* 28 */YY_NO_ANCHOR,
0277: /* 29 */YY_NO_ANCHOR,
0278: /* 30 */YY_NO_ANCHOR,
0279: /* 31 */YY_NO_ANCHOR,
0280: /* 32 */YY_NO_ANCHOR,
0281: /* 33 */YY_NO_ANCHOR,
0282: /* 34 */YY_NOT_ACCEPT,
0283: /* 35 */YY_NO_ANCHOR,
0284: /* 36 */YY_NO_ANCHOR,
0285: /* 37 */YY_NO_ANCHOR,
0286: /* 38 */YY_NO_ANCHOR,
0287: /* 39 */YY_NO_ANCHOR,
0288: /* 40 */YY_NO_ANCHOR,
0289: /* 41 */YY_NO_ANCHOR,
0290: /* 42 */YY_NO_ANCHOR,
0291: /* 43 */YY_NO_ANCHOR,
0292: /* 44 */YY_NO_ANCHOR,
0293: /* 45 */YY_NOT_ACCEPT,
0294: /* 46 */YY_NO_ANCHOR,
0295: /* 47 */YY_NO_ANCHOR,
0296: /* 48 */YY_NO_ANCHOR,
0297: /* 49 */YY_NO_ANCHOR,
0298: /* 50 */YY_NO_ANCHOR,
0299: /* 51 */YY_NO_ANCHOR,
0300: /* 52 */YY_NOT_ACCEPT,
0301: /* 53 */YY_NO_ANCHOR,
0302: /* 54 */YY_NO_ANCHOR,
0303: /* 55 */YY_NO_ANCHOR,
0304: /* 56 */YY_NO_ANCHOR,
0305: /* 57 */YY_NO_ANCHOR,
0306: /* 58 */YY_NOT_ACCEPT,
0307: /* 59 */YY_NO_ANCHOR,
0308: /* 60 */YY_NO_ANCHOR,
0309: /* 61 */YY_NOT_ACCEPT,
0310: /* 62 */YY_NO_ANCHOR,
0311: /* 63 */YY_NOT_ACCEPT,
0312: /* 64 */YY_NO_ANCHOR,
0313: /* 65 */YY_NOT_ACCEPT,
0314: /* 66 */YY_NO_ANCHOR,
0315: /* 67 */YY_NOT_ACCEPT,
0316: /* 68 */YY_NO_ANCHOR,
0317: /* 69 */YY_NOT_ACCEPT,
0318: /* 70 */YY_NO_ANCHOR,
0319: /* 71 */YY_NOT_ACCEPT,
0320: /* 72 */YY_NO_ANCHOR,
0321: /* 73 */YY_NOT_ACCEPT,
0322: /* 74 */YY_NO_ANCHOR,
0323: /* 75 */YY_NOT_ACCEPT,
0324: /* 76 */YY_NO_ANCHOR,
0325: /* 77 */YY_NOT_ACCEPT,
0326: /* 78 */YY_NO_ANCHOR,
0327: /* 79 */YY_NOT_ACCEPT,
0328: /* 80 */YY_NOT_ACCEPT,
0329: /* 81 */YY_NOT_ACCEPT,
0330: /* 82 */YY_NOT_ACCEPT,
0331: /* 83 */YY_NOT_ACCEPT,
0332: /* 84 */YY_NOT_ACCEPT,
0333: /* 85 */YY_NOT_ACCEPT,
0334: /* 86 */YY_NOT_ACCEPT,
0335: /* 87 */YY_NOT_ACCEPT,
0336: /* 88 */YY_NOT_ACCEPT,
0337: /* 89 */YY_NOT_ACCEPT,
0338: /* 90 */YY_NOT_ACCEPT,
0339: /* 91 */YY_NOT_ACCEPT,
0340: /* 92 */YY_NOT_ACCEPT,
0341: /* 93 */YY_NOT_ACCEPT,
0342: /* 94 */YY_NOT_ACCEPT,
0343: /* 95 */YY_NOT_ACCEPT,
0344: /* 96 */YY_NOT_ACCEPT,
0345: /* 97 */YY_NOT_ACCEPT,
0346: /* 98 */YY_NOT_ACCEPT,
0347: /* 99 */YY_NOT_ACCEPT,
0348: /* 100 */YY_NOT_ACCEPT,
0349: /* 101 */YY_NOT_ACCEPT,
0350: /* 102 */YY_NOT_ACCEPT,
0351: /* 103 */YY_NOT_ACCEPT,
0352: /* 104 */YY_NOT_ACCEPT,
0353: /* 105 */YY_NOT_ACCEPT,
0354: /* 106 */YY_NOT_ACCEPT,
0355: /* 107 */YY_NOT_ACCEPT,
0356: /* 108 */YY_NOT_ACCEPT,
0357: /* 109 */YY_NOT_ACCEPT,
0358: /* 110 */YY_NOT_ACCEPT,
0359: /* 111 */YY_NOT_ACCEPT,
0360: /* 112 */YY_NOT_ACCEPT,
0361: /* 113 */YY_NOT_ACCEPT,
0362: /* 114 */YY_NOT_ACCEPT,
0363: /* 115 */YY_NOT_ACCEPT,
0364: /* 116 */YY_NOT_ACCEPT,
0365: /* 117 */YY_NOT_ACCEPT,
0366: /* 118 */YY_NOT_ACCEPT,
0367: /* 119 */YY_NOT_ACCEPT,
0368: /* 120 */YY_NOT_ACCEPT,
0369: /* 121 */YY_NOT_ACCEPT,
0370: /* 122 */YY_NOT_ACCEPT,
0371: /* 123 */YY_NOT_ACCEPT,
0372: /* 124 */YY_NOT_ACCEPT,
0373: /* 125 */YY_NO_ANCHOR,
0374: /* 126 */YY_NO_ANCHOR,
0375: /* 127 */YY_NO_ANCHOR,
0376: /* 128 */YY_NO_ANCHOR,
0377: /* 129 */YY_NOT_ACCEPT,
0378: /* 130 */YY_NO_ANCHOR,
0379: /* 131 */YY_NOT_ACCEPT,
0380: /* 132 */YY_NO_ANCHOR,
0381: /* 133 */YY_NOT_ACCEPT,
0382: /* 134 */YY_NO_ANCHOR,
0383: /* 135 */YY_NOT_ACCEPT,
0384: /* 136 */YY_NOT_ACCEPT,
0385: /* 137 */YY_NOT_ACCEPT,
0386: /* 138 */YY_NOT_ACCEPT,
0387: /* 139 */YY_NOT_ACCEPT,
0388: /* 140 */YY_NOT_ACCEPT,
0389: /* 141 */YY_NOT_ACCEPT,
0390: /* 142 */YY_NO_ANCHOR,
0391: /* 143 */YY_NOT_ACCEPT,
0392: /* 144 */YY_NO_ANCHOR,
0393: /* 145 */YY_NOT_ACCEPT,
0394: /* 146 */YY_NO_ANCHOR,
0395: /* 147 */YY_NOT_ACCEPT,
0396: /* 148 */YY_NOT_ACCEPT,
0397: /* 149 */YY_NOT_ACCEPT };
0398: private int yy_cmap[] = unpackFromString(
0399: 1,
0400: 258,
0401: "20:9,2,4,20:2,5,20:18,45,41,40,42,41:2,26,25,41:2,43,41:2,3,22,21,34:2,36,3"
0402: + "4:7,19,27,28,41,29,41,44,30:16,39,30:9,41:4,1,33,11,37,35,31,16,9,23,6,12,2"
0403: + "4,38,13,10,15,14,8,31:2,18,7,31:2,17,31:3,20:101,32:23,20:2,32:5,20,32,0:2")[0];
0404:
0405: private int yy_rmap[] = unpackFromString(
0406: 1,
0407: 150,
0408: "0,1,2,3,4,1:4,5,1,6,7,1:2,8,9,1:2,10,11,12,1,13,14,15,16,17,18,1,19,15,1,20"
0409: + ",21,22,23,24,25,1:3,26,27,28,29,30,31,32,33,34,35,36,37,32,1,38,1,39,40,41,"
0410: + "42,1,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,25,61,62,63,64,6"
0411: + "5,66,67,68,69,70,71,11,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,8"
0412: + "9,16,90,91,92,93,19,94,95,96,97,35,98,28,99,100,60,97,101,102,103,104,105,1"
0413: + "06,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121")[0];
0414:
0415: private int yy_nxt[][] = unpackFromString(
0416: 122,
0417: 46,
0418: "1,-1:92,45,-1:48,9,36,-1:51,73,-1,143,-1:9,145,-1:26,80,54,-1:65,13,-1:24,1"
0419: + "5,37,-1:36,92,-1:8,37,-1:36,138,-1:8,55,-1:46,19:13,-1:4,19:2,-1:5,91,19:2,"
0420: + "-1:2,19,-1,19:2,91,-1:7,20,129:2,-1:2,129:40,-1:5,39,-1:45,40,-1:45,41,-1:4"
0421: + "1,106,-1,106,-1:2,25:13,106:2,25,139,25:2,-1,106:2,-1:2,25:2,106:2,25:6,-1,"
0422: + "106:4,-1:35,26,-1,26,-1:15,27:13,-1:4,27:2,-1:5,113,27:2,-1:2,27,-1,27:2,11"
0423: + "3,-1:12,28:13,-1:4,28:2,-1:5,115,28:2,-1:2,28,-1,28:2,115,-1:7,30,-1,30,-1:"
0424: + "2,30:14,-1,30:11,-1:2,30:12,-1:5,57,-1:40,1,2,35,46,3,125,53,59,62,132,64,1"
0425: + "46,62:3,134,62:5,66,62:3,68,4,62,5,6,70,62:2,72,62,74,62:3,70,62:2,76,62,78"
0426: + ",62,-1:42,7,8,-1:6,60,54,-1:82,138,-1:7,16,55,-1:41,106,-1,106,-1:2,25:13,1"
0427: + "06:2,25,139,31,25,-1,106:2,-1:2,25:2,106:2,25:6,-1,106:4,-1:5,120,130,-1:44"
0428: + ",33,57,-1:41,129:3,-1:2,129:40,-1:3,52,-1:46,80,81,-1:44,127,38,-1:41,106,-"
0429: + "1,106,-1:2,25:3,31,25:9,106:2,25,139,25:2,-1,106:2,-1:2,25:2,106:2,25:6,-1,"
0430: + "106:4,-1:5,120,141,-1:44,128,44,-1:43,131,-1:49,58,-1:39,106,-1,106,-1:2,25"
0431: + ":10,42,25:2,106:2,25,139,31,25,-1,106:2,-1:2,25:2,106:2,25:6,-1,106:4,-1:8,"
0432: + "135,-1:54,61,-1:33,127,48,-1:53,82,-1:40,136,-1:48,65,-1:6,67,-1:18,69,-1:2"
0433: + "0,83,-1:54,10,-1:62,84,-1:32,11,-1:39,85,-1:32,75:13,-1:4,75:2,-1:6,75:2,-1"
0434: + ":2,75,-1,75:2,-1:24,87,-1:34,77:13,-1:4,77:2,-1:5,77:2,-1:2,77:6,-1:16,88,-"
0435: + "1:71,149,-1:15,75:13,-1:4,75:2,-1:5,91,75:2,-1:2,75,-1,75:2,91,-1:48,12,-1:"
0436: + "9,77:13,-1:4,77:2,-1:5,77:2,-1,14,77:6,-1:50,79,-1:45,137,-1:5,16,38,-1:55,"
0437: + "96,-1:43,98,-1:69,99,-1:38,100,-1:8,100,-1:17,101,-1:52,136,-1:35,102,-1:64"
0438: + ",17,-1:45,18,-1:24,19:13,-1:4,19:2,-1:6,19:2,-1:2,19,-1,19:2,-1:49,103,-1:7"
0439: + ",21,39,-1:58,136,97,-1:42,105,-1:30,106,-1,106,-1:2,106:19,-1,106:2,-1:2,10"
0440: + "6:10,-1,106:4,-1:8,107,-1:57,108,-1:32,109:13,-1:4,109:2,-1:6,109:2,-1:2,10"
0441: + "9,-1,109:2,-1:42,110,-1:37,22,-1:22,23,40,-1:44,24,41,-1:47,136,-1:39,106,-"
0442: + "1,106,-1:2,25:13,106:2,25,106,25:2,-1,106:2,-1:2,25:2,106:2,25:6,-1,106:4,-"
0443: + "1:15,136,-1:70,112,-1:12,109:13,-1:4,109:2,-1:5,113,109:2,-1:2,109,-1,109:2"
0444: + ",113,-1:12,114,-1:81,116,-1:9,27:13,-1:4,27:2,-1:6,27:2,-1:2,27,-1,27:2,-1:"
0445: + "26,117,-1:32,28:13,-1:4,28:2,-1:6,28:2,-1:2,28,-1,28:2,-1:49,29,-1:3,1,2,35"
0446: + ",46,3,125,53,59,62,132,64,146,62:3,134,62:5,66,62:3,68,62:4,70,62:2,72,62,7"
0447: + "4,62:3,70,62:2,76,62,78,62,1,62,32,62,43,50,62:39,32,-1:4,121,122,-1:44,33,"
0448: + "44,-1:44,128,51,-1:44,9,47,-1:41,106,-1,106,-1:2,25:9,42,25:3,106:2,25,139,"
0449: + "25:2,-1,106:2,-1:2,25:2,106:2,25:6,-1,106:4,-1:2,93,129:2,-1:2,129:40,-1:4,"
0450: + "123,122,-1:43,94,-1:49,63,-1:45,86,-1:54,71,-1:37,95,-1:56,97,-1:70,104,-1:"
0451: + "43,111,-1:4,106,-1,106,-1:2,25:2,126,25:10,106:2,25,106,142,144,-1,106:2,-1"
0452: + ":2,25:2,106:2,25:6,-1,106:4,-1:7,140:13,-1:4,140:2,-1:5,115,140:2,-1:2,140,"
0453: + "-1,140:2,115,-1:10,121,124,-1:41,106,-1,106,-1:2,25:6,49,25:6,106:2,25,139,"
0454: + "25:2,-1,106:2,-1:2,25:2,106:2,25:6,-1,106:4,-1:8,89,-1:39,106,-1,106,-1:2,2"
0455: + "5:2,56,25:10,106:2,25,139,25:2,-1,106:2,-1:2,25:2,106:2,25:6,-1,106:4,-1:8,"
0456: + "90,-1:45,133,-1:44,140:13,-1:4,140:2,-1:6,140:2,-1:2,140,-1,140:2,-1:37,147"
0457: + ",-1:8,147,-1:25,148,-1:26");
0458:
0459: public String yylex() throws java.io.IOException {
0460: int yy_lookahead;
0461: int yy_anchor = YY_NO_ANCHOR;
0462: int yy_state = yy_state_dtrans[yy_lexical_state];
0463: int yy_next_state = YY_NO_STATE;
0464: int yy_last_accept_state = YY_NO_STATE;
0465: boolean yy_initial = true;
0466: int yy_this _accept;
0467:
0468: yy_mark_start();
0469: yy_this _accept = yy_acpt[yy_state];
0470: if (YY_NOT_ACCEPT != yy_this _accept) {
0471: yy_last_accept_state = yy_state;
0472: yy_mark_end();
0473: }
0474: while (true) {
0475: if (yy_initial && yy_at_bol)
0476: yy_lookahead = YY_BOL;
0477: else
0478: yy_lookahead = yy_advance();
0479: yy_next_state = YY_F;
0480: yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
0481: if (YY_EOF == yy_lookahead && true == yy_initial) {
0482:
0483: if (ordered) {
0484: ordered = false;
0485: return "</ol>";
0486: }
0487: if (unordered) {
0488: unordered = false;
0489: return "</ul>";
0490: }
0491: if (strong) {
0492: strong = false;
0493: return ("</strong>");
0494: }
0495: if (em) {
0496: em = false;
0497: return ("</em>");
0498: }
0499: if (pre) {
0500: return ("</pre>");
0501: }
0502: return null;
0503: }
0504: if (YY_F != yy_next_state) {
0505: yy_state = yy_next_state;
0506: yy_initial = false;
0507: yy_this _accept = yy_acpt[yy_state];
0508: if (YY_NOT_ACCEPT != yy_this _accept) {
0509: yy_last_accept_state = yy_state;
0510: yy_mark_end();
0511: }
0512: } else {
0513: if (YY_NO_STATE == yy_last_accept_state) {
0514: throw (new Error("Lexical Error: Unmatched Input."));
0515: } else {
0516: yy_anchor = yy_acpt[yy_last_accept_state];
0517: if (0 != (YY_END & yy_anchor)) {
0518: yy_move_end();
0519: }
0520: yy_to_mark();
0521: switch (yy_last_accept_state) {
0522: case 1:
0523:
0524: case -2:
0525: break;
0526: case 2: {
0527: cat.debug(". (" + yytext() + ")");
0528: return yytext();
0529: }
0530: case -3:
0531: break;
0532: case 3: {
0533: cat.debug("{newline}");
0534: return " ";
0535: }
0536: case -4:
0537: break;
0538: case 4: {
0539: return "&";
0540: }
0541: case -5:
0542: break;
0543: case 5: {
0544: return "<";
0545: }
0546: case -6:
0547: break;
0548: case 6: {
0549: return ">";
0550: }
0551: case -7:
0552: break;
0553: case 7: {
0554: cat.debug("{tab}#");
0555: if (!ordered) {
0556: ordered = true;
0557: return "\n<ol>\n<li>";
0558: }
0559: return "\n<li>";
0560: }
0561: case -8:
0562: break;
0563: case 8: {
0564: cat.debug("{newline}{tab}*");
0565: if (!unordered) {
0566: unordered = true;
0567: return "\n<ul>\n<li>";
0568: }
0569: return "\n<li>";
0570: }
0571: case -9:
0572: break;
0573: case 9: {
0574: cat.debug("{newline}{newline}");
0575: if (!ordered && !unordered)
0576: return "\n<br/><br/>\n";
0577: }
0578: case -10:
0579: break;
0580: case 10: {
0581: if (cell)
0582: return "<br/>";
0583: return "//";
0584: }
0585: case -11:
0586: break;
0587: case 11: {
0588: cat.debug("''");
0589: if (em) {
0590: em = false;
0591: return ("</em>");
0592: } else {
0593: em = true;
0594: return ("<em>");
0595: }
0596: }
0597: case -12:
0598: break;
0599: case 12: {
0600: cat.debug("tablecellboundary");
0601: if (cell) {
0602: return "</td><td>";
0603: }
0604: cell = true;
0605: return "<td>";
0606: }
0607: case -13:
0608: break;
0609: case 13: {
0610: cat.debug("'''");
0611: if (strong) {
0612: strong = false;
0613: return ("</strong>");
0614: } else {
0615: strong = true;
0616: return ("<strong>");
0617: }
0618: }
0619: case -14:
0620: break;
0621: case 14: {
0622: cat.debug("{link2}");
0623: if (!Environment.getInstance()
0624: .isAllowBackTick()) {
0625: cat.debug("No back-tick links allowed");
0626: return yytext();
0627: }
0628: String link = yytext();
0629: link = link.substring(1);
0630: link = link.substring(0, link.length() - 1);
0631: if (exists(link)) {
0632: return "<a href=\"Wiki?" + link.trim()
0633: + "\">" + link + "</a>";
0634: } else {
0635: return link + "<a href=\"Wiki?topic="
0636: + link.trim()
0637: + "&action=action_edit\">?</a>";
0638: }
0639: }
0640: case -15:
0641: break;
0642: case 15: {
0643: cat.debug("tablerowend");
0644: return "</td></tr><tr><td>";
0645: }
0646: case -16:
0647: break;
0648: case 16: {
0649: if (unordered) {
0650: unordered = false;
0651: return "</ul>\n<br/>\n";
0652: }
0653: if (ordered) {
0654: ordered = false;
0655: return "</ol>\n<br/>\n";
0656: } else
0657: return "\n<br/><br/>\n";
0658: }
0659: case -17:
0660: break;
0661: case 17: {
0662: return "&lt;";
0663: }
0664: case -18:
0665: break;
0666: case 18: {
0667: return "&gt;";
0668: }
0669: case -19:
0670: break;
0671: case 19: {
0672: cat.debug("{link} '" + yytext() + "'");
0673: String link = yytext();
0674: if (exists(link.trim())) {
0675: return "<a href=\"Wiki?" + link.trim()
0676: + "\">" + link + "</a>";
0677: } else {
0678: return link + "<a href=\"Wiki?topic="
0679: + link.trim()
0680: + "&action=action_edit\">?</a>";
0681: }
0682: }
0683: case -20:
0684: break;
0685: case 20: {
0686: return yytext().substring(2,
0687: yytext().length() - 2);
0688: }
0689: case -21:
0690: break;
0691: case 21: {
0692: cat.debug("{hr}");
0693: return "\n<hr>\n";
0694: }
0695: case -22:
0696: break;
0697: case 22: {
0698: return "&amp;";
0699: }
0700: case -23:
0701: break;
0702: case 23: {
0703: cat.debug("tableboundary");
0704: if (table) {
0705: table = false;
0706: cell = false;
0707: return "</td></tr></table>";
0708: }
0709: table = true;
0710: return "<table border=\"1\"><tr><td>";
0711: }
0712: case -24:
0713: break;
0714: case 24: {
0715: cat.debug("@@@@{newline} entering PRE");
0716: yybegin(PRE);
0717: return "<pre>";
0718: }
0719: case -25:
0720: break;
0721: case 25: {
0722: cat.debug("{hyperlink}");
0723: String link = yytext();
0724: return "<a href=\"" + link.trim() + "\">"
0725: + link + "</a>";
0726: }
0727: case -26:
0728: break;
0729: case 26: {
0730: cat.debug("{mblink}");
0731: if (yytext().length() < 6)
0732: return "[bad Microsoft KB link]";
0733: String link = yytext().substring(5);
0734: return "<a href=\"" + mskb + link.trim()
0735: + "\">MicrosoftKB:" + link + "</a>";
0736: }
0737: case -27:
0738: break;
0739: case 27: {
0740: cat.debug("{mblink}");
0741: if (yytext().length() < 4)
0742: return "[bad Meatball WikiLink]";
0743: String link = yytext().substring(3);
0744: return "<a href=\"http://usemod.com/cgi-bin/mb.pl?"
0745: + link.trim()
0746: + "\">MeatballWiki:"
0747: + link + "</a>";
0748: }
0749: case -28:
0750: break;
0751: case 28: {
0752: cat.debug("{c2link}");
0753: if (yytext().length() < 4)
0754: return "[bad C2 WikiLink]";
0755: String link = yytext().substring(3);
0756: return "<a href=\"http://c2.com/cgi/wiki?"
0757: + link.trim() + "\">c2Wiki:" + link
0758: + "</a>";
0759: }
0760: case -29:
0761: break;
0762: case 29: {
0763: cat.debug("tablerowend,tableboundary");
0764: table = false;
0765: cell = false;
0766: return "</td></tr></table>";
0767: }
0768: case -30:
0769: break;
0770: case 30: {
0771: cat.debug("{attachment}");
0772: String displayLink = yytext();
0773: String attachmentName = displayLink
0774: .substring(7);
0775: String link = "Wiki?action=action_view_attachment&attachment="
0776: + JSPUtils.encodeURL(attachmentName);
0777: return "<a href=\"" + link
0778: + "\" target=\"_blank\">att:"
0779: + attachmentName + "</a>";
0780: }
0781: case -31:
0782: break;
0783: case 31: {
0784: cat.debug("{image}");
0785: String link = yytext();
0786: return "<img src=\"" + link.trim() + "\">";
0787: }
0788: case -32:
0789: break;
0790: case 32: {
0791: return yytext();
0792: }
0793: case -33:
0794: break;
0795: case 33: {
0796: cat.debug("{newline}x2 leaving pre");
0797: if (Environment.getInstance().getAllowHTML()) {
0798: yybegin(ALLOWHTML);
0799: } else {
0800: yybegin(NORMAL);
0801: }
0802: return "</pre>";
0803: }
0804: case -34:
0805: break;
0806: case 35: {
0807: cat.debug(". (" + yytext() + ")");
0808: return yytext();
0809: }
0810: case -35:
0811: break;
0812: case 36: {
0813: cat.debug("{newline}{newline}");
0814: if (!ordered && !unordered)
0815: return "\n<br/><br/>\n";
0816: }
0817: case -36:
0818: break;
0819: case 37: {
0820: cat.debug("tablerowend");
0821: return "</td></tr><tr><td>";
0822: }
0823: case -37:
0824: break;
0825: case 38: {
0826: if (unordered) {
0827: unordered = false;
0828: return "</ul>\n<br/>\n";
0829: }
0830: if (ordered) {
0831: ordered = false;
0832: return "</ol>\n<br/>\n";
0833: } else
0834: return "\n<br/><br/>\n";
0835: }
0836: case -38:
0837: break;
0838: case 39: {
0839: cat.debug("{hr}");
0840: return "\n<hr>\n";
0841: }
0842: case -39:
0843: break;
0844: case 40: {
0845: cat.debug("tableboundary");
0846: if (table) {
0847: table = false;
0848: cell = false;
0849: return "</td></tr></table>";
0850: }
0851: table = true;
0852: return "<table border=\"1\"><tr><td>";
0853: }
0854: case -40:
0855: break;
0856: case 41: {
0857: cat.debug("@@@@{newline} entering PRE");
0858: yybegin(PRE);
0859: return "<pre>";
0860: }
0861: case -41:
0862: break;
0863: case 42: {
0864: cat.debug("{hyperlink}");
0865: String link = yytext();
0866: return "<a href=\"" + link.trim() + "\">"
0867: + link + "</a>";
0868: }
0869: case -42:
0870: break;
0871: case 43: {
0872: return yytext();
0873: }
0874: case -43:
0875: break;
0876: case 44: {
0877: cat.debug("{newline}x2 leaving pre");
0878: if (Environment.getInstance().getAllowHTML()) {
0879: yybegin(ALLOWHTML);
0880: } else {
0881: yybegin(NORMAL);
0882: }
0883: return "</pre>";
0884: }
0885: case -44:
0886: break;
0887: case 46: {
0888: cat.debug(". (" + yytext() + ")");
0889: return yytext();
0890: }
0891: case -45:
0892: break;
0893: case 47: {
0894: cat.debug("{newline}{newline}");
0895: if (!ordered && !unordered)
0896: return "\n<br/><br/>\n";
0897: }
0898: case -46:
0899: break;
0900: case 48: {
0901: if (unordered) {
0902: unordered = false;
0903: return "</ul>\n<br/>\n";
0904: }
0905: if (ordered) {
0906: ordered = false;
0907: return "</ol>\n<br/>\n";
0908: } else
0909: return "\n<br/><br/>\n";
0910: }
0911: case -47:
0912: break;
0913: case 49: {
0914: cat.debug("{hyperlink}");
0915: String link = yytext();
0916: return "<a href=\"" + link.trim() + "\">"
0917: + link + "</a>";
0918: }
0919: case -48:
0920: break;
0921: case 50: {
0922: return yytext();
0923: }
0924: case -49:
0925: break;
0926: case 51: {
0927: cat.debug("{newline}x2 leaving pre");
0928: if (Environment.getInstance().getAllowHTML()) {
0929: yybegin(ALLOWHTML);
0930: } else {
0931: yybegin(NORMAL);
0932: }
0933: return "</pre>";
0934: }
0935: case -50:
0936: break;
0937: case 53: {
0938: cat.debug(". (" + yytext() + ")");
0939: return yytext();
0940: }
0941: case -51:
0942: break;
0943: case 54: {
0944: cat.debug("{newline}{newline}");
0945: if (!ordered && !unordered)
0946: return "\n<br/><br/>\n";
0947: }
0948: case -52:
0949: break;
0950: case 55: {
0951: if (unordered) {
0952: unordered = false;
0953: return "</ul>\n<br/>\n";
0954: }
0955: if (ordered) {
0956: ordered = false;
0957: return "</ol>\n<br/>\n";
0958: } else
0959: return "\n<br/><br/>\n";
0960: }
0961: case -53:
0962: break;
0963: case 56: {
0964: cat.debug("{hyperlink}");
0965: String link = yytext();
0966: return "<a href=\"" + link.trim() + "\">"
0967: + link + "</a>";
0968: }
0969: case -54:
0970: break;
0971: case 57: {
0972: cat.debug("{newline}x2 leaving pre");
0973: if (Environment.getInstance().getAllowHTML()) {
0974: yybegin(ALLOWHTML);
0975: } else {
0976: yybegin(NORMAL);
0977: }
0978: return "</pre>";
0979: }
0980: case -55:
0981: break;
0982: case 59: {
0983: cat.debug(". (" + yytext() + ")");
0984: return yytext();
0985: }
0986: case -56:
0987: break;
0988: case 60: {
0989: cat.debug("{newline}{newline}");
0990: if (!ordered && !unordered)
0991: return "\n<br/><br/>\n";
0992: }
0993: case -57:
0994: break;
0995: case 62: {
0996: cat.debug(". (" + yytext() + ")");
0997: return yytext();
0998: }
0999: case -58:
1000: break;
1001: case 64: {
1002: cat.debug(". (" + yytext() + ")");
1003: return yytext();
1004: }
1005: case -59:
1006: break;
1007: case 66: {
1008: cat.debug(". (" + yytext() + ")");
1009: return yytext();
1010: }
1011: case -60:
1012: break;
1013: case 68: {
1014: cat.debug(". (" + yytext() + ")");
1015: return yytext();
1016: }
1017: case -61:
1018: break;
1019: case 70: {
1020: cat.debug(". (" + yytext() + ")");
1021: return yytext();
1022: }
1023: case -62:
1024: break;
1025: case 72: {
1026: cat.debug(". (" + yytext() + ")");
1027: return yytext();
1028: }
1029: case -63:
1030: break;
1031: case 74: {
1032: cat.debug(". (" + yytext() + ")");
1033: return yytext();
1034: }
1035: case -64:
1036: break;
1037: case 76: {
1038: cat.debug(". (" + yytext() + ")");
1039: return yytext();
1040: }
1041: case -65:
1042: break;
1043: case 78: {
1044: cat.debug(". (" + yytext() + ")");
1045: return yytext();
1046: }
1047: case -66:
1048: break;
1049: case 125: {
1050: cat.debug("{newline}");
1051: return " ";
1052: }
1053: case -67:
1054: break;
1055: case 126: {
1056: cat.debug("{hyperlink}");
1057: String link = yytext();
1058: return "<a href=\"" + link.trim() + "\">"
1059: + link + "</a>";
1060: }
1061: case -68:
1062: break;
1063: case 127: {
1064: if (unordered) {
1065: unordered = false;
1066: return "</ul>\n<br/>\n";
1067: }
1068: if (ordered) {
1069: ordered = false;
1070: return "</ol>\n<br/>\n";
1071: } else
1072: return "\n<br/><br/>\n";
1073: }
1074: case -69:
1075: break;
1076: case 128: {
1077: cat.debug("{newline}x2 leaving pre");
1078: if (Environment.getInstance().getAllowHTML()) {
1079: yybegin(ALLOWHTML);
1080: } else {
1081: yybegin(NORMAL);
1082: }
1083: return "</pre>";
1084: }
1085: case -70:
1086: break;
1087: case 130: {
1088: return yytext();
1089: }
1090: case -71:
1091: break;
1092: case 132: {
1093: cat.debug(". (" + yytext() + ")");
1094: return yytext();
1095: }
1096: case -72:
1097: break;
1098: case 134: {
1099: cat.debug(". (" + yytext() + ")");
1100: return yytext();
1101: }
1102: case -73:
1103: break;
1104: case 142: {
1105: cat.debug("{hyperlink}");
1106: String link = yytext();
1107: return "<a href=\"" + link.trim() + "\">"
1108: + link + "</a>";
1109: }
1110: case -74:
1111: break;
1112: case 144: {
1113: cat.debug("{hyperlink}");
1114: String link = yytext();
1115: return "<a href=\"" + link.trim() + "\">"
1116: + link + "</a>";
1117: }
1118: case -75:
1119: break;
1120: case 146: {
1121: cat.debug(". (" + yytext() + ")");
1122: return yytext();
1123: }
1124: case -76:
1125: break;
1126: default:
1127: yy_error(YY_E_INTERNAL, false);
1128: case -1:
1129: }
1130: yy_initial = true;
1131: yy_state = yy_state_dtrans[yy_lexical_state];
1132: yy_next_state = YY_NO_STATE;
1133: yy_last_accept_state = YY_NO_STATE;
1134: yy_mark_start();
1135: yy_this_accept = yy_acpt[yy_state];
1136: if (YY_NOT_ACCEPT != yy_this_accept) {
1137: yy_last_accept_state = yy_state;
1138: yy_mark_end();
1139: }
1140: }
1141: }
1142: }
1143: }
1144: }
|