0001: /* The following code was generated by JFlex 1.3.5 on 13-9-06 0:53 */
0002:
0003: package vqwiki.lex;
0004:
0005: /*
0006: Very Quick Wiki - WikiWikiWeb clone
0007: Copyright (C) 2001 Gareth Cronin
0008:
0009:
0010: This program is free software; you can redistribute it and/or modify
0011: it under the terms of the GNU General Public License as published by
0012: the Free Software Foundation; either version 2 of the License, or
0013: (at your option) any later version.
0014:
0015:
0016: This program is distributed in the hope that it will be useful,
0017: but WITHOUT ANY WARRANTY; without even the implied warranty of
0018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0019: GNU General Public License for more details.
0020:
0021:
0022: You should have received a copy of the GNU General Public License
0023: along with this program (gpl.txt); if not, write to the Free Software
0024: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0025: */
0026:
0027: import java.io.*;
0028: import org.apache.log4j.Logger;
0029: import vqwiki.*;
0030: import vqwiki.servlets.WikiServlet;
0031:
0032: /**
0033: * This class is a scanner generated by
0034: * <a href="http://www.jflex.de/">JFlex</a> 1.3.5
0035: * on 13-9-06 0:53 from the specification file
0036: * <tt>file:/C:/SourceForge/VQWiki_2X/vqwiki-classic/jlex/FritzLex</tt>
0037: */
0038: public class FritzLex implements vqwiki.lex.Lexer {
0039:
0040: /** This character denotes the end of file */
0041: final public static int YYEOF = -1;
0042:
0043: /** initial size of the lookahead buffer */
0044: final private static int YY_BUFFERSIZE = 16384;
0045:
0046: /** lexical states */
0047: final public static int ALLOWHTML = 2;
0048: final public static int YYINITIAL = 0;
0049: final public static int NORMAL = 1;
0050:
0051: /**
0052: * Translates characters to character classes
0053: */
0054: final private static String yycmap_packed = "\11\0\1\2\1\3\2\0\1\4\22\0\1\1\1\6\1\36\1\54"
0055: + "\2\6\1\50\1\47\2\6\1\53\2\6\1\7\1\41\1\6\2\5"
0056: + "\1\37\7\5\1\23\1\6\1\51\1\6\1\52\2\6\32\12\1\15"
0057: + "\1\10\1\16\1\46\1\0\1\14\1\17\1\40\1\21\1\13\1\34"
0058: + "\1\26\1\42\1\22\1\30\1\43\1\13\1\31\1\27\1\33\1\32"
0059: + "\1\24\2\13\1\25\1\20\2\13\1\35\3\13\1\44\1\0\1\45"
0060: + "\142\0\27\11\2\0\5\11\1\0\1\11\uff00\0";
0061:
0062: /**
0063: * Translates characters to character classes
0064: */
0065: final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
0066:
0067: /**
0068: * Translates a state to a row index in the transition table
0069: */
0070: final private static int yy_rowMap[] = { 0, 45, 90, 0, 135, 180,
0071: 225, 270, 315, 360, 405, 450, 495, 540, 585, 630, 675, 720,
0072: 765, 810, 855, 900, 0, 0, 945, 0, 0, 135, 990, 1035, 1080,
0073: 1125, 0, 1170, 1215, 1260, 1305, 1350, 1395, 1440, 1485,
0074: 1530, 1575, 1620, 1665, 1710, 1755, 1800, 1845, 1890, 1935,
0075: 1980, 2025, 2070, 2115, 2160, 2205, 2250, 2295, 0, 2340,
0076: 2385, 2430, 2475, 2520, 2565, 2610, 2655, 2700, 0, 0, 2745,
0077: 0, 2790, 0, 0, 2835, 0, 0, 0, 0, 2205, 2250, 2880, 2925,
0078: 2970, 3015, 3060, 3105, 3150, 3195, 3240, 0, 0, 0, 3285,
0079: 3330, 3375, 3420, 3465, 3510, 3555, 3600, 3645, 3690, 0,
0080: 3735, 3780, 3825, 3870, 3735, 3915, 3960, 4005, 4050, 4095,
0081: 4140, 3645 };
0082:
0083: /**
0084: * The packed transition table of the DFA (part 0)
0085: */
0086: final private static String yy_packed0 = "\55\0\3\4\1\5\1\6\2\4\1\7\1\10\1\4"
0087: + "\1\11\1\4\1\12\1\13\1\4\1\14\1\4\1\15"
0088: + "\1\16\3\4\1\17\1\20\3\4\1\21\10\4\1\22"
0089: + "\1\23\1\24\1\25\1\26\1\27\1\30\5\4\1\5"
0090: + "\1\6\2\4\1\7\1\10\1\4\1\11\1\4\1\12"
0091: + "\1\13\1\4\1\14\1\4\1\15\1\16\3\4\1\17"
0092: + "\1\20\3\4\1\21\10\4\1\22\1\23\1\24\1\25"
0093: + "\1\31\1\32\1\33\2\4\1\0\1\34\1\0\1\35"
0094: + "\1\36\51\0\1\34\1\0\1\37\1\36\57\0\1\40"
0095: + "\45\0\3\41\1\0\4\41\1\42\44\41\11\0\1\43"
0096: + "\1\0\1\43\3\0\4\43\1\0\12\43\2\0\1\43"
0097: + "\1\0\2\43\16\0\1\44\4\0\2\44\3\0\4\44"
0098: + "\1\0\12\44\1\0\2\44\1\0\2\44\26\0\1\45"
0099: + "\57\0\1\46\73\0\1\47\35\0\1\50\54\0\1\51"
0100: + "\7\0\1\52\43\0\1\53\20\0\1\54\50\0\1\55"
0101: + "\64\0\1\56\55\0\1\57\55\0\1\60\55\0\1\61"
0102: + "\24\0\1\62\11\0\1\63\10\0\1\64\31\0\1\65"
0103: + "\11\0\1\66\10\0\1\67\14\0\1\70\54\0\1\70"
0104: + "\1\35\52\0\1\34\1\70\1\35\1\36\57\0\1\71"
0105: + "\55\0\1\72\55\0\1\43\1\73\1\43\3\0\4\43"
0106: + "\1\0\12\43\2\0\1\43\1\0\2\43\16\0\1\44"
0107: + "\4\0\2\44\1\74\2\0\4\44\1\0\12\44\1\0"
0108: + "\2\44\1\0\2\44\16\0\1\75\4\0\2\75\3\0"
0109: + "\4\75\1\0\12\75\1\0\2\75\1\0\2\75\31\0"
0110: + "\1\76\57\0\1\77\51\0\1\100\60\0\1\101\61\0"
0111: + "\1\102\53\0\1\103\47\0\1\104\66\0\1\105\63\0"
0112: + "\1\106\55\0\1\107\55\0\1\110\55\0\1\111\34\0"
0113: + "\1\112\45\0\1\113\54\0\1\114\63\0\1\115\45\0"
0114: + "\1\116\54\0\1\117\107\0\1\120\1\121\7\0\1\122"
0115: + "\55\0\1\123\55\0\1\124\1\0\1\124\3\0\4\124"
0116: + "\1\0\12\124\2\0\1\124\1\0\2\124\16\0\1\75"
0117: + "\4\0\2\75\2\0\1\125\4\75\1\0\12\75\1\0"
0118: + "\2\75\1\0\2\75\30\0\1\126\47\0\1\127\66\0"
0119: + "\1\130\53\0\1\131\65\0\1\101\51\0\1\132\35\0"
0120: + "\1\133\67\0\1\101\75\0\1\134\32\0\1\135\54\0"
0121: + "\1\136\41\0\1\124\1\73\1\124\3\0\4\124\1\0"
0122: + "\12\124\2\0\1\124\1\0\2\124\27\0\1\137\57\0"
0123: + "\1\140\44\0\1\141\1\0\1\141\3\0\4\141\1\0"
0124: + "\12\141\2\0\1\141\1\0\2\141\34\0\1\131\1\0"
0125: + "\1\101\27\0\1\142\4\0\31\142\1\0\10\142\1\0"
0126: + "\1\142\2\0\2\142\20\0\1\143\45\0\1\144\1\0"
0127: + "\1\144\3\0\4\144\1\0\12\144\2\0\1\144\1\0"
0128: + "\2\144\57\0\1\145\30\0\1\146\43\0\1\141\1\147"
0129: + "\1\141\3\0\4\141\1\0\12\141\2\0\1\141\1\0"
0130: + "\2\141\11\0\1\142\4\0\1\150\4\142\2\150\3\142"
0131: + "\4\150\1\142\12\150\1\0\2\150\1\142\2\150\3\142"
0132: + "\1\0\1\142\2\0\2\142\32\0\1\101\33\0\1\144"
0133: + "\1\151\1\144\3\0\4\144\1\0\12\144\2\0\1\144"
0134: + "\1\0\2\144\57\0\1\152\31\0\1\153\42\0\1\154"
0135: + "\1\0\1\154\3\0\4\154\1\0\12\154\2\0\1\154"
0136: + "\1\0\2\154\11\0\1\142\4\0\1\150\4\142\2\150"
0137: + "\3\142\4\150\1\142\12\150\1\0\2\150\1\155\2\150"
0138: + "\3\142\1\0\1\142\2\0\2\142\11\0\1\156\1\0"
0139: + "\1\156\3\0\4\156\1\0\12\156\2\0\1\156\1\0"
0140: + "\2\156\12\0\1\157\3\0\3\157\2\0\2\157\3\0"
0141: + "\25\157\3\0\6\157\11\0\1\154\1\147\1\154\3\0"
0142: + "\4\154\1\0\12\154\2\0\1\154\1\0\2\154\11\0"
0143: + "\1\142\4\0\1\150\4\142\2\150\3\142\4\150\1\142"
0144: + "\1\160\11\150\1\0\2\150\1\142\1\161\1\162\3\142"
0145: + "\1\0\1\142\2\0\2\142\11\0\1\156\1\151\1\156"
0146: + "\3\0\4\156\1\0\12\156\2\0\1\156\1\0\2\156"
0147: + "\11\0\1\142\4\0\1\150\4\142\2\150\3\142\4\150"
0148: + "\1\142\7\150\1\163\2\150\1\0\2\150\1\155\2\150"
0149: + "\3\142\1\0\1\142\2\0\3\142\4\0\1\150\4\142"
0150: + "\2\150\3\142\4\150\1\142\4\150\1\164\5\150\1\0"
0151: + "\2\150\1\155\2\150\3\142\1\0\1\142\2\0\3\142"
0152: + "\4\0\1\150\4\142\2\150\3\142\4\150\1\142\1\165"
0153: + "\11\150\1\0\2\150\1\155\2\150\3\142\1\0\1\142"
0154: + "\2\0\3\142\4\0\1\150\4\142\2\150\3\142\4\150"
0155: + "\1\142\12\150\1\0\2\150\1\155\1\166\1\150\3\142"
0156: + "\1\0\1\142\2\0\3\142\4\0\1\150\4\142\2\150"
0157: + "\3\142\4\150\1\142\2\150\1\166\7\150\1\0\2\150"
0158: + "\1\155\2\150\3\142\1\0\1\142\2\0\3\142\4\0"
0159: + "\1\150\4\142\2\150\3\142\4\150\1\142\10\150\1\163"
0160: + "\1\150\1\0\2\150\1\155\1\166\1\150\3\142\1\0"
0161: + "\1\142\2\0\2\142";
0162:
0163: /**
0164: * The transition table of the DFA
0165: */
0166: final private static int yytrans[] = yy_unpack();
0167:
0168: /* error codes */
0169: final private static int YY_UNKNOWN_ERROR = 0;
0170: final private static int YY_ILLEGAL_STATE = 1;
0171: final private static int YY_NO_MATCH = 2;
0172: final private static int YY_PUSHBACK_2BIG = 3;
0173:
0174: /* error messages for the codes above */
0175: final private static String YY_ERROR_MSG[] = {
0176: "Unkown internal scanner error",
0177: "Internal error: unknown state",
0178: "Error: could not match input",
0179: "Error: pushback value was too large" };
0180:
0181: /**
0182: * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
0183: */
0184: private final static byte YY_ATTRIBUTE[] = { 8, 0, 0, 9, 1, 1, 1,
0185: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 1, 9, 9,
0186: 0, 1, 1, 1, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
0187: 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
0188: 0, 0, 9, 9, 1, 9, 0, 9, 9, 0, 9, 9, 9, 9, 1, 1, 1, 0, 0, 0,
0189: 0, 0, 0, 0, 1, 9, 9, 9, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 9, 0,
0190: 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
0191:
0192: /** the input device */
0193: private java.io.Reader yy_reader;
0194:
0195: /** the current state of the DFA */
0196: private int yy_state;
0197:
0198: /** the current lexical state */
0199: private int yy_lexical_state = YYINITIAL;
0200:
0201: /** this buffer contains the current text to be matched and is
0202: the source of the yytext() string */
0203: private char yy_buffer[] = new char[YY_BUFFERSIZE];
0204:
0205: /** the textposition at the last accepting state */
0206: private int yy_markedPos;
0207:
0208: /** the textposition at the last state to be included in yytext */
0209: private int yy_pushbackPos;
0210:
0211: /** the current text position in the buffer */
0212: private int yy_currentPos;
0213:
0214: /** startRead marks the beginning of the yytext() string in the buffer */
0215: private int yy_startRead;
0216:
0217: /** endRead marks the last character in the buffer, that has been read
0218: from input */
0219: private int yy_endRead;
0220:
0221: /** number of newlines encountered up to the start of the matched text */
0222: private int yyline;
0223:
0224: /** the number of characters up to the start of the matched text */
0225: private int yychar;
0226:
0227: /**
0228: * the number of characters from the last newline up to the start of the
0229: * matched text
0230: */
0231: private int yycolumn;
0232:
0233: /**
0234: * yy_atBOL == true <=> the scanner is currently at the beginning of a line
0235: */
0236: private boolean yy_atBOL = true;
0237:
0238: /** yy_atEOF == true <=> the scanner is at the EOF */
0239: private boolean yy_atEOF;
0240:
0241: /* user code: */
0242: protected boolean em, strong, unordered, ordered;
0243: boolean pre = false; // FEF.IV
0244: boolean code = false; // FEF.IV
0245: boolean wikiTransform = true; // FEF.IV
0246: boolean h1 = false;
0247: boolean h2 = false;
0248: boolean h3 = false;
0249: boolean h4 = false;
0250: boolean h5 = false;
0251: protected String virtualWiki;
0252: protected static Logger logger = Logger.getLogger(FritzLex.class);
0253:
0254: protected boolean exists(String topic) {
0255: try {
0256: return WikiBase.getInstance().exists(virtualWiki, topic);
0257: } catch (Exception err) {
0258: logger.error(err);
0259: }
0260: return false;
0261: }
0262:
0263: public void setVirtualWiki(String vWiki) {
0264: this .virtualWiki = vWiki;
0265: }
0266:
0267: // modified the following lines below:
0268: // hr = (----+)
0269: // hyperlink = (((https?)|(ftp)|(mailto)|(news)):[^\ \t\r\n<>'\"]+[a-zA-Z0-9])
0270:
0271: /**
0272: * Creates a new scanner
0273: * There is also a java.io.InputStream version of this constructor.
0274: *
0275: * @param in the java.io.Reader to read input from.
0276: */
0277: public FritzLex(java.io.Reader in) {
0278: boolean allowHtml = Environment.getInstance().getAllowHTML();
0279:
0280: if (allowHtml) {
0281: yybegin(ALLOWHTML);
0282: } else {
0283: yybegin(NORMAL);
0284: }
0285:
0286: this .yy_reader = in;
0287: }
0288:
0289: /**
0290: * Creates a new scanner.
0291: * There is also java.io.Reader version of this constructor.
0292: *
0293: * @param in the java.io.Inputstream to read input from.
0294: */
0295: public FritzLex(java.io.InputStream in) {
0296: this (new java.io.InputStreamReader(in));
0297: }
0298:
0299: /**
0300: * Unpacks the split, compressed DFA transition table.
0301: *
0302: * @return the unpacked transition table
0303: */
0304: private static int[] yy_unpack() {
0305: int[] trans = new int[4185];
0306: int offset = 0;
0307: offset = yy_unpack(yy_packed0, offset, trans);
0308: return trans;
0309: }
0310:
0311: /**
0312: * Unpacks the compressed DFA transition table.
0313: *
0314: * @param packed the packed transition table
0315: * @return the index of the last entry
0316: */
0317: private static int yy_unpack(String packed, int offset, int[] trans) {
0318: int i = 0; /* index in packed string */
0319: int j = offset; /* index in unpacked array */
0320: int l = packed.length();
0321: while (i < l) {
0322: int count = packed.charAt(i++);
0323: int value = packed.charAt(i++);
0324: value--;
0325: do
0326: trans[j++] = value;
0327: while (--count > 0);
0328: }
0329: return j;
0330: }
0331:
0332: /**
0333: * Unpacks the compressed character translation table.
0334: *
0335: * @param packed the packed character translation table
0336: * @return the unpacked character translation table
0337: */
0338: private static char[] yy_unpack_cmap(String packed) {
0339: char[] map = new char[0x10000];
0340: int i = 0; /* index in packed string */
0341: int j = 0; /* index in unpacked array */
0342: while (i < 134) {
0343: int count = packed.charAt(i++);
0344: char value = packed.charAt(i++);
0345: do
0346: map[j++] = value;
0347: while (--count > 0);
0348: }
0349: return map;
0350: }
0351:
0352: /**
0353: * Refills the input buffer.
0354: *
0355: * @return <code>false</code>, iff there was new input.
0356: *
0357: * @exception IOException if any I/O-Error occurs
0358: */
0359: private boolean yy_refill() throws java.io.IOException {
0360:
0361: /* first: make room (if you can) */
0362: if (yy_startRead > 0) {
0363: System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0,
0364: yy_endRead - yy_startRead);
0365:
0366: /* translate stored positions */
0367: yy_endRead -= yy_startRead;
0368: yy_currentPos -= yy_startRead;
0369: yy_markedPos -= yy_startRead;
0370: yy_pushbackPos -= yy_startRead;
0371: yy_startRead = 0;
0372: }
0373:
0374: /* is the buffer big enough? */
0375: if (yy_currentPos >= yy_buffer.length) {
0376: /* if not: blow it up */
0377: char newBuffer[] = new char[yy_currentPos * 2];
0378: System.arraycopy(yy_buffer, 0, newBuffer, 0,
0379: yy_buffer.length);
0380: yy_buffer = newBuffer;
0381: }
0382:
0383: /* finally: fill the buffer with new input */
0384: int numRead = yy_reader.read(yy_buffer, yy_endRead,
0385: yy_buffer.length - yy_endRead);
0386:
0387: if (numRead < 0) {
0388: return true;
0389: } else {
0390: yy_endRead += numRead;
0391: return false;
0392: }
0393: }
0394:
0395: /**
0396: * Closes the input stream.
0397: */
0398: final public void yyclose() throws java.io.IOException {
0399: yy_atEOF = true; /* indicate end of file */
0400: yy_endRead = yy_startRead; /* invalidate buffer */
0401:
0402: if (yy_reader != null)
0403: yy_reader.close();
0404: }
0405:
0406: /**
0407: * Closes the current stream, and resets the
0408: * scanner to read from a new input stream.
0409: *
0410: * All internal variables are reset, the old input stream
0411: * <b>cannot</b> be reused (internal buffer is discarded and lost).
0412: * Lexical state is set to <tt>YY_INITIAL</tt>.
0413: *
0414: * @param reader the new input stream
0415: */
0416: final public void yyreset(java.io.Reader reader)
0417: throws java.io.IOException {
0418: yyclose();
0419: yy_reader = reader;
0420: yy_atBOL = true;
0421: yy_atEOF = false;
0422: yy_endRead = yy_startRead = 0;
0423: yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
0424: yyline = yychar = yycolumn = 0;
0425: yy_lexical_state = YYINITIAL;
0426: }
0427:
0428: /**
0429: * Returns the current lexical state.
0430: */
0431: final public int yystate() {
0432: return yy_lexical_state;
0433: }
0434:
0435: /**
0436: * Enters a new lexical state
0437: *
0438: * @param newState the new lexical state
0439: */
0440: final public void yybegin(int newState) {
0441: yy_lexical_state = newState;
0442: }
0443:
0444: /**
0445: * Returns the text matched by the current regular expression.
0446: */
0447: final public String yytext() {
0448: return new String(yy_buffer, yy_startRead, yy_markedPos
0449: - yy_startRead);
0450: }
0451:
0452: /**
0453: * Returns the character at position <tt>pos</tt> from the
0454: * matched text.
0455: *
0456: * It is equivalent to yytext().charAt(pos), but faster
0457: *
0458: * @param pos the position of the character to fetch.
0459: * A value from 0 to yylength()-1.
0460: *
0461: * @return the character at position pos
0462: */
0463: final public char yycharat(int pos) {
0464: return yy_buffer[yy_startRead + pos];
0465: }
0466:
0467: /**
0468: * Returns the length of the matched text region.
0469: */
0470: final public int yylength() {
0471: return yy_markedPos - yy_startRead;
0472: }
0473:
0474: /**
0475: * Reports an error that occured while scanning.
0476: *
0477: * In a wellformed scanner (no or only correct usage of
0478: * yypushback(int) and a match-all fallback rule) this method
0479: * will only be called with things that "Can't Possibly Happen".
0480: * If this method is called, something is seriously wrong
0481: * (e.g. a JFlex bug producing a faulty scanner etc.).
0482: *
0483: * Usual syntax/scanner level error handling should be done
0484: * in error fallback rules.
0485: *
0486: * @param errorCode the code of the errormessage to display
0487: */
0488: private void yy_ScanError(int errorCode) {
0489: String message;
0490: try {
0491: message = YY_ERROR_MSG[errorCode];
0492: } catch (ArrayIndexOutOfBoundsException e) {
0493: message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
0494: }
0495:
0496: throw new Error(message);
0497: }
0498:
0499: /**
0500: * Pushes the specified amount of characters back into the input stream.
0501: *
0502: * They will be read again by then next call of the scanning method
0503: *
0504: * @param number the number of characters to be read again.
0505: * This number must not be greater than yylength()!
0506: */
0507: private void yypushback(int number) {
0508: if (number > yylength())
0509: yy_ScanError(YY_PUSHBACK_2BIG);
0510:
0511: yy_markedPos -= number;
0512: }
0513:
0514: /**
0515: * Resumes scanning until the next regular expression is matched,
0516: * the end of input is encountered or an I/O-Error occurs.
0517: *
0518: * @return the next token
0519: * @exception IOException if any I/O-Error occurs
0520: */
0521: public String yylex() throws java.io.IOException {
0522: int yy_input;
0523: int yy_action;
0524:
0525: // cached fields:
0526: int yy_currentPos_l;
0527: int yy_startRead_l;
0528: int yy_markedPos_l;
0529: int yy_endRead_l = yy_endRead;
0530: char[] yy_buffer_l = yy_buffer;
0531: char[] yycmap_l = yycmap;
0532:
0533: int[] yytrans_l = yytrans;
0534: int[] yy_rowMap_l = yy_rowMap;
0535: byte[] yy_attr_l = YY_ATTRIBUTE;
0536:
0537: while (true) {
0538: yy_markedPos_l = yy_markedPos;
0539:
0540: yy_action = -1;
0541:
0542: yy_startRead_l = yy_currentPos_l = yy_currentPos = yy_startRead = yy_markedPos_l;
0543:
0544: yy_state = yy_lexical_state;
0545:
0546: yy_forAction: {
0547: while (true) {
0548:
0549: if (yy_currentPos_l < yy_endRead_l)
0550: yy_input = yy_buffer_l[yy_currentPos_l++];
0551: else if (yy_atEOF) {
0552: yy_input = YYEOF;
0553: break yy_forAction;
0554: } else {
0555: // store back cached positions
0556: yy_currentPos = yy_currentPos_l;
0557: yy_markedPos = yy_markedPos_l;
0558: boolean eof = yy_refill();
0559: // get translated positions and possibly new buffer
0560: yy_currentPos_l = yy_currentPos;
0561: yy_markedPos_l = yy_markedPos;
0562: yy_buffer_l = yy_buffer;
0563: yy_endRead_l = yy_endRead;
0564: if (eof) {
0565: yy_input = YYEOF;
0566: break yy_forAction;
0567: } else {
0568: yy_input = yy_buffer_l[yy_currentPos_l++];
0569: }
0570: }
0571: int yy_next = yytrans_l[yy_rowMap_l[yy_state]
0572: + yycmap_l[yy_input]];
0573: if (yy_next == -1)
0574: break yy_forAction;
0575: yy_state = yy_next;
0576:
0577: int yy_attributes = yy_attr_l[yy_state];
0578: if ((yy_attributes & 1) == 1) {
0579: yy_action = yy_state;
0580: yy_markedPos_l = yy_currentPos_l;
0581: if ((yy_attributes & 8) == 8)
0582: break yy_forAction;
0583: }
0584:
0585: }
0586: }
0587:
0588: // store back cached position
0589: yy_markedPos = yy_markedPos_l;
0590:
0591: switch (yy_action) {
0592:
0593: case 4:
0594: case 5: {
0595: logger.debug("{newline}");
0596: if (!wikiTransform) // FEF.IV
0597: {
0598: return "<br>\n";
0599: }
0600: }
0601: case 119:
0602: break;
0603: case 69: { // FEF.IV
0604: if (!wikiTransform) // FEF.IV
0605: {
0606: return yytext();
0607: }
0608: code = true;
0609: return "<code>";
0610: }
0611: case 120:
0612: break;
0613: case 47: { // FEF.IV
0614: logger.debug("^^");
0615: if ((pre && code) || !wikiTransform) // FEF.IV
0616: {
0617: return yytext();
0618: }
0619: if (h1) {
0620: h1 = false;
0621: return ("</h1>");
0622: } else {
0623: h1 = true;
0624: return ("<h1>");
0625: }
0626: }
0627: case 121:
0628: break;
0629: case 46: { // FEF.IV
0630: if (!wikiTransform) // FEF.IV
0631: {
0632: return yytext();
0633: }
0634: pre = false;
0635: return "</pre>";
0636: }
0637: case 122:
0638: break;
0639: case 45: { // FEF.IV
0640: if (!wikiTransform) // FEF.IV
0641: {
0642: return yytext();
0643: }
0644: pre = true;
0645: return "<pre>";
0646: }
0647: case 123:
0648: break;
0649: case 32:
0650: case 33: { // FEF.IV
0651: logger.debug("{escaped}");
0652: if ((pre && code) || !wikiTransform) // FEF.IV
0653: {
0654: return yytext();
0655: }
0656: // return everything (1 char) after escape char
0657: return yytext().substring(1);
0658: }
0659: case 124:
0660: break;
0661: case 24: { // FEF.IV
0662: if ((pre && code)) {
0663: return "&";
0664: }
0665: return yytext();
0666: }
0667: case 125:
0668: break;
0669: case 25: { // FEF.IV
0670: if ((pre && code)) {
0671: return "<";
0672: }
0673: return yytext();
0674: }
0675: case 126:
0676: break;
0677: case 26: { // FEF.IV
0678: if ((pre && code)) {
0679: return ">";
0680: }
0681: return yytext();
0682: }
0683: case 127:
0684: break;
0685: case 71: { // FEF.IV
0686: logger.debug("^^^");
0687: if ((pre && code) || !wikiTransform) // FEF.IV
0688: {
0689: return yytext();
0690: }
0691: if (h2) {
0692: h2 = false;
0693: return ("</h2>");
0694: } else {
0695: h2 = true;
0696: return ("<h2>");
0697: }
0698: }
0699: case 128:
0700: break;
0701: case 77: { // FEF.IV
0702: if ((pre && code)) {
0703: return "&lt";
0704: }
0705: return yytext();
0706: }
0707: case 129:
0708: break;
0709: case 78: { // FEF.IV
0710: if ((pre && code)) {
0711: return "&gt";
0712: }
0713: return yytext();
0714: }
0715: case 130:
0716: break;
0717: case 82: { // FEF.IV
0718: logger.debug("{wikitoggle}");
0719: wikiTransform = !wikiTransform;
0720: return "";
0721: }
0722: case 131:
0723: break;
0724: case 91: { // FEF.IV
0725: logger.debug("^^^^");
0726: if ((pre && code) || !wikiTransform) // FEF.IV
0727: {
0728: return yytext();
0729: }
0730: if (h3) {
0731: h3 = false;
0732: return ("</h3>");
0733: } else {
0734: h3 = true;
0735: return ("<h3>");
0736: }
0737: }
0738: case 132:
0739: break;
0740: case 93: { // FEF.IV
0741: if ((pre && code)) {
0742: return "&amp";
0743: }
0744: return yytext();
0745: }
0746: case 133:
0747: break;
0748: case 100: { // FEF.IV
0749: logger.debug("^^^^^");
0750: if ((pre && code) || !wikiTransform) // FEF.IV
0751: {
0752: return yytext();
0753: }
0754: if (h4) {
0755: h4 = false;
0756: return ("</h4>");
0757: } else {
0758: h4 = true;
0759: return ("<h4>");
0760: }
0761: }
0762: case 134:
0763: break;
0764: case 70: { // FEF.IV
0765: if (!wikiTransform) // FEF.IV
0766: {
0767: return yytext();
0768: }
0769: code = false;
0770: return "</code>";
0771: }
0772: case 135:
0773: break;
0774: case 117: {
0775: logger.debug("{image}");
0776: if ((pre && code) || !wikiTransform) // FEF.IV
0777: {
0778: return yytext();
0779: }
0780: String link = yytext();
0781: return "<img src=\"" + link.trim() + "\">";
0782: }
0783: case 136:
0784: break;
0785: case 74: {
0786: return "&lt";
0787: }
0788: case 137:
0789: break;
0790: case 75: {
0791: return "&gt";
0792: }
0793: case 138:
0794: break;
0795: case 21: {
0796: return "&";
0797: }
0798: case 139:
0799: break;
0800: case 22: {
0801: return "<";
0802: }
0803: case 140:
0804: break;
0805: case 23: {
0806: return ">";
0807: }
0808: case 141:
0809: break;
0810: case 83: {
0811: logger.debug("{link} '" + yytext() + "'");
0812: if ((pre && code) || !wikiTransform) // FEF.IV
0813: {
0814: return yytext();
0815: }
0816: String link = yytext();
0817: if (exists(link.trim())) {
0818: return "<a href=\"Wiki?" + link.trim() + "\">"
0819: + link + "</a>";
0820: } else {
0821: return link + "<a href=\"Wiki?topic=" + link.trim()
0822: + "&action=" + WikiServlet.ACTION_EDIT
0823: + "\">?</a>";
0824: }
0825: }
0826: case 142:
0827: break;
0828: case 107: {
0829: logger.debug("{c2link}");
0830: if ((pre && code) || !wikiTransform) // FEF.IV
0831: {
0832: return yytext();
0833: }
0834: if (yytext().length() < 4)
0835: return "[bad C2 WikiLink]";
0836: String link = yytext().substring(3);
0837: return "<a href=\"http://c2.com/cgi/wiki?"
0838: + link.trim() + "\">c2Wiki:" + link + "</a>";
0839: }
0840: case 143:
0841: break;
0842: case 59: {
0843: logger.debug("{link2}");
0844: if ((pre && code) || !wikiTransform) // FEF.IV
0845: {
0846: return yytext();
0847: }
0848: String link = yytext();
0849: link = link.substring(1);
0850: link = link.substring(0, link.length() - 1);
0851: if (exists(link)) {
0852: return "<a href=\"Wiki?" + link.trim() + "\">"
0853: + link + "</a>";
0854: } else {
0855: return link + "<a href=\"Wiki?topic=" + link.trim()
0856: + "&action=" + WikiServlet.ACTION_EDIT
0857: + "\">?</a>";
0858: }
0859: }
0860: case 144:
0861: break;
0862: case 28:
0863: case 29:
0864: case 30: {
0865: logger.debug("{boundary}");
0866: if (pre || !wikiTransform) // FEF.IV
0867: {
0868: return yytext();
0869: }
0870: if (unordered) {
0871: unordered = false;
0872: return "</ul><p>\n";
0873: }
0874: if (ordered) {
0875: ordered = false;
0876: return "</ol><p>\n";
0877: }
0878: return "<p>\n";
0879: }
0880: case 145:
0881: break;
0882: case 81: {
0883: logger.debug("{hr}");
0884: if ((pre && code) || !wikiTransform) // FEF.IV
0885: {
0886: return yytext();
0887: }
0888: return "\n<hr>\n";
0889: }
0890: case 146:
0891: break;
0892: case 103:
0893: case 111:
0894: case 112:
0895: case 113:
0896: case 114:
0897: case 115:
0898: case 116: {
0899: logger.debug("{hyperlink}");
0900: if ((pre && code) || !wikiTransform) // FEF.IV
0901: {
0902: return yytext();
0903: }
0904: String link = yytext();
0905: return "<a href=\"" + link.trim() + "\">" + link
0906: + "</a>";
0907: }
0908: case 147:
0909: break;
0910: case 94: { // FEF.IV
0911: logger.debug("{link3}");
0912: if ((pre && code) || !wikiTransform) // FEF.IV
0913: {
0914: return yytext();
0915: }
0916: String link = yytext();
0917: link = link.substring(2);
0918: link = link.substring(0, link.length() - 2);
0919: if (exists(link)) {
0920: return "<a href=\"Wiki?" + link.trim() + "\">"
0921: + link + "</a>";
0922: } else {
0923: return link + "<a href=\"Wiki?topic=" + link.trim()
0924: + "&action=" + WikiServlet.ACTION_EDIT
0925: + "\">?</a>";
0926: }
0927: }
0928: case 148:
0929: break;
0930: case 105: {
0931: logger.debug("^^^^^^");
0932: if ((pre && code) || !wikiTransform) // FEF.IV
0933: {
0934: return yytext();
0935: }
0936: if (h5) {
0937: h5 = false;
0938: return ("</h5>");
0939: } else {
0940: h5 = true;
0941: return ("<h5>");
0942: }
0943: }
0944: case 149:
0945: break;
0946: case 110: {
0947: logger.debug("{attachment}");
0948: if ((pre && code) || !wikiTransform) // FEF.IV
0949: {
0950: return yytext();
0951: }
0952: String displayLink = yytext();
0953: String upDir = Environment.getInstance().getUploadDir();
0954: String baseContext = Environment.getInstance()
0955: .getBaseContext();
0956: if (!(upDir.charAt(0) == '/'))
0957: upDir = "/" + upDir;
0958: String link = baseContext + upDir + "/"
0959: + displayLink.substring(7);
0960: return "<a href=\"" + link + "\">att:"
0961: + displayLink.substring(7) + "</a>";
0962:
0963: }
0964: case 150:
0965: break;
0966: case 79: {
0967: logger.debug("{tab}*");
0968: if (pre || !wikiTransform) // FEF.IV
0969: {
0970: return yytext();
0971: }
0972: if (!unordered) {
0973: unordered = true;
0974: return "\n<ul>\n<li>";
0975: }
0976: return "\n<li>";
0977: }
0978: case 151:
0979: break;
0980: case 80: {
0981: logger.debug("{tab}#");
0982: if (pre || !wikiTransform) // FEF.IV
0983: {
0984: return yytext();
0985: }
0986: if (!ordered) {
0987: ordered = true;
0988: return "\n<ol>\n<li>";
0989: }
0990: return "\n<li>";
0991: }
0992: case 152:
0993: break;
0994: case 48: {
0995: logger.debug("''");
0996: if ((pre && code) || !wikiTransform) // FEF.IV
0997: {
0998: return yytext();
0999: }
1000: if (em) {
1001: em = false;
1002: return ("</em>");
1003: } else {
1004: em = true;
1005: return ("<em>");
1006: }
1007: }
1008: case 153:
1009: break;
1010: case 3:
1011: case 6:
1012: case 7:
1013: case 8:
1014: case 9:
1015: case 10:
1016: case 11:
1017: case 12:
1018: case 13:
1019: case 14:
1020: case 15:
1021: case 16:
1022: case 17:
1023: case 18:
1024: case 19:
1025: case 20: {
1026: logger.debug(". (" + yytext() + ")");
1027: return yytext();
1028: }
1029: case 154:
1030: break;
1031: case 72: {
1032: logger.debug("'''");
1033: if ((pre && code) || !wikiTransform) // FEF.IV
1034: {
1035: return yytext();
1036: }
1037: if (strong) {
1038: strong = false;
1039: return ("</strong>");
1040: } else {
1041: strong = true;
1042: return ("<strong>");
1043: }
1044: }
1045: case 155:
1046: break;
1047: case 109: {
1048: logger.debug("{mblink}");
1049: if ((pre && code) || !wikiTransform) // FEF.IV
1050: {
1051: return yytext();
1052: }
1053: if (yytext().length() < 4)
1054: return "[bad Meatball WikiLink]";
1055: String link = yytext().substring(3);
1056: return "<a href=\"http://usemod.com/cgi-bin/mb.pl?"
1057: + link.trim() + "\">MeatballWiki:" + link
1058: + "</a>";
1059: }
1060: case 156:
1061: break;
1062: case 92: {
1063: return "&amp";
1064: }
1065: case 157:
1066: break;
1067: default:
1068: if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
1069: yy_atEOF = true;
1070: {
1071: StringBuffer returnValue = new StringBuffer(64); // FEF.IV
1072: if (ordered) {
1073: ordered = false;
1074: //return "</ol>";
1075: returnValue.append("</ol>"); // FEF.IV
1076: }
1077: if (unordered) {
1078: unordered = false;
1079: //return "</ul>";
1080: returnValue.append("</ul>"); // FEF.IV
1081: }
1082: if (strong) {
1083: strong = false;
1084: //return( "</strong>" );
1085: returnValue.append("</strong>"); // FEF.IV
1086: }
1087: if (em) {
1088: em = false;
1089: //return( "</em>" );
1090: returnValue.append("</em>"); // FEF.IV
1091: }
1092: if (h1) // FEF.IV
1093: {
1094: h1 = false;
1095: returnValue.append("</h1>"); // FEF.IV
1096: }
1097: if (h2) // FEF.IV
1098: {
1099: h2 = false;
1100: returnValue.append("</h2>"); // FEF.IV
1101: }
1102: if (h3) // FEF.IV
1103: {
1104: h3 = false;
1105: returnValue.append("</h3>"); // FEF.IV
1106: }
1107: if (h4) // FEF.IV
1108: {
1109: h4 = false;
1110: returnValue.append("</h4>"); // FEF.IV
1111: }
1112: if (h5) // FEF.IV
1113: {
1114: h5 = false;
1115: returnValue.append("</h5>"); // FEF.IV
1116: }
1117: if (pre) // FEF.IV
1118: {
1119: pre = false;
1120: returnValue.append("</pre>"); // FEF.IV
1121: }
1122: if (code) // FEF.IV
1123: {
1124: pre = false;
1125: returnValue.append("</code>"); // FEF.IV
1126: }
1127: wikiTransform = true; // FEF.IV
1128: if (returnValue.length() > 0) // FEF.IV
1129: {
1130: return returnValue.toString();
1131: }
1132: return null;
1133: }
1134: } else {
1135: yy_ScanError(YY_NO_MATCH);
1136: }
1137: }
1138: }
1139: }
1140:
1141: }
|