0001 // $ANTLR 2.7.4: "yam.g" -> "YAMLexer.java"$
0002
0003 package gate.wiki.antlr;
0004 import java.util.*;
0005 import java.io.*;
0006
0007 import java.io.InputStream;
0008 import antlr.TokenStreamException;
0009 import antlr.TokenStreamIOException;
0010 import antlr.TokenStreamRecognitionException;
0011 import antlr.CharStreamException;
0012 import antlr.CharStreamIOException;
0013 import antlr.ANTLRException;
0014 import java.io.Reader;
0015 import java.util.Hashtable;
0016 import antlr.CharScanner;
0017 import antlr.InputBuffer;
0018 import antlr.ByteBuffer;
0019 import antlr.CharBuffer;
0020 import antlr.Token;
0021 import antlr.CommonToken;
0022 import antlr.RecognitionException;
0023 import antlr.NoViableAltForCharException;
0024 import antlr.MismatchedCharException;
0025 import antlr.TokenStream;
0026 import antlr.ANTLRHashString;
0027 import antlr.LexerSharedInputState;
0028 import antlr.collections.impl.BitSet;
0029 import antlr.SemanticException;
0030
0031 /** Parse and translate YAM input. All lexers for an input and included text
0032 * share the same context but each lexer can have their own translator target.
0033 * Most functionality is in the DefaultYAMEngine.
0034 */
0035 public abstract class YAMLexer extends antlr.CharScanner implements YAMLexerTokenTypes, TokenStream
0036 {
0037
0038
0039 /** Used by sublexers that handle plugin data; shares context with original */
0040 public YAMLexer(Reader in, YAMContext context) {
0041 this(in);
0042 setContext(context);
0043 }
0044
0045 /** Tracks variables and such; later track line number etc... */
0046 protected YAMContext context = new YAMContext(this);
0047
0048 /** Each lexer/translator can have it's own target language */
0049 public YAMTarget target = new NOPTarget(); // make sure not null
0050
0051 /** Can't do some things in tables like bullet lists */
0052 protected boolean inTable=false;
0053 protected boolean inTitle=false;
0054
0055 public YAMTarget getTarget() {
0056 return target;
0057 }
0058
0059 public YAMContext getContext() {
0060 return context;
0061 }
0062
0063 public void setContext(YAMContext context) {
0064 this.context = context;
0065 }
0066
0067 /** Begin on-the-fly syntax-directed translation */
0068 public abstract void translate(YAMTarget target)
0069 throws TokenStreamException;
0070 protected abstract void closeAllLists();
0071 protected abstract void closeAllLists(int level);
0072 protected abstract void closeList();
0073 protected abstract void captureText();
0074 protected abstract void ul(int level);
0075 protected abstract void ol(int level);
0076 protected abstract void closeSectionsToLevel(int level);
0077 protected abstract void section(String text, int level);
0078 protected abstract void title(String title);
0079 protected abstract void define(String id, String value);
0080 protected abstract void plugin(String id, Vector args);
0081 protected abstract void variable(String id);
0082 public YAMLexer(InputStream in) {
0083 this(new ByteBuffer(in));
0084 }
0085 public YAMLexer(Reader in) {
0086 this(new CharBuffer(in));
0087 }
0088 public YAMLexer(InputBuffer ib) {
0089 this(new LexerSharedInputState(ib));
0090 }
0091 public YAMLexer(LexerSharedInputState state) {
0092 super(state);
0093 caseSensitiveLiterals = true;
0094 setCaseSensitive(true);
0095 literals = new Hashtable();
0096 }
0097
0098 public Token nextToken() throws TokenStreamException {
0099 Token theRetToken=null;
0100 tryAgain:
0101 for (;;) {
0102 Token _token = null;
0103 int _ttype = Token.INVALID_TYPE;
0104 setCommitToPath(false);
0105 int _m;
0106 _m = mark();
0107 resetText();
0108 try { // for char stream error handling
0109 try { // for lexical error handling
0110 if (((_tokenSet_0.member(LA(1))) && (LA(2)=='('||LA(2)=='a'||LA(2)=='t') && (_tokenSet_1.member(LA(3))) && ((LA(4) >= '\u0003' && LA(4) <= '\ufffe')) && (true))&&(getLine()!=1)) {
0111 mLINK(true);
0112 theRetToken=_returnToken;
0113 }
0114 else if (((LA(1)=='-') && (LA(2)=='-') && (LA(3)=='-') && (LA(4)=='-') && (true))&&(context.inTable)) {
0115 mROW_SEP(true);
0116 theRetToken=_returnToken;
0117 }
0118 else if (((LA(1)=='*') && (_tokenSet_2.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true))&&(!inTitle)) {
0119 mBOLD(true);
0120 theRetToken=_returnToken;
0121 }
0122 else if (((LA(1)=='_') && (_tokenSet_3.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true))&&(!inTitle)) {
0123 mITALIC(true);
0124 theRetToken=_returnToken;
0125 }
0126 else if (((LA(1)=='=') && (_tokenSet_4.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true))&&(!inTitle)) {
0127 mTT(true);
0128 theRetToken=_returnToken;
0129 }
0130 else if ((LA(1)=='\\') && (LA(2)=='\n') && (true) && (true) && (true)) {
0131 mBR(true);
0132 theRetToken=_returnToken;
0133 }
0134 else if ((LA(1)=='\n') && (LA(2)=='\\')) {
0135 mBLANK(true);
0136 theRetToken=_returnToken;
0137 }
0138 else if (((LA(1)=='-') && (LA(2)=='-') && (true) && (true) && (true))&&(getColumn()!=1)) {
0139 mLONGDASH(true);
0140 theRetToken=_returnToken;
0141 }
0142 else if ((LA(1)=='%') && (_tokenSet_5.member(LA(2))) && (true) && (true) && (true)) {
0143 mPLUGIN(true);
0144 theRetToken=_returnToken;
0145 }
0146 else if ((LA(1)=='\\') && (_tokenSet_6.member(LA(2))) && (true) && (true) && (true)) {
0147 mESC(true);
0148 theRetToken=_returnToken;
0149 }
0150 else if (((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2))) && (true) && (true) && (true))&&(getColumn()==1)) {
0151 mLINE_START_THEN_MARKUP(true);
0152 theRetToken=_returnToken;
0153 }
0154 else if ((LA(1)=='\n') && (LA(2)=='\n')) {
0155 mBLANK_LINE_THEN_MARKUP(true);
0156 theRetToken=_returnToken;
0157 }
0158 else if ((LA(1)=='#')) {
0159 mANCHOR(true);
0160 theRetToken=_returnToken;
0161 }
0162 else if (((_tokenSet_9.member(LA(1))) && (true) && (true) && (true) && (true))&&(getLine()==1 && getColumn()==1 && !context.isNestedTranslator())) {
0163 mTITLE(true);
0164 theRetToken=_returnToken;
0165 }
0166 else if (((LA(1)=='|') && (true) && (true) && (true) && (true))&&(context.inTable)) {
0167 mCOL_SEP(true);
0168 theRetToken=_returnToken;
0169 }
0170 else {
0171 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
0172 else {
0173 commit();
0174 try {mTEXT(false);}
0175 catch(RecognitionException e) {
0176 // catastrophic failure
0177 reportError(e);
0178 consume();
0179 }
0180 continue tryAgain;
0181 }
0182 }
0183
0184 commit();
0185 if ( _returnToken==null ) continue tryAgain; // found SKIP token
0186 _ttype = _returnToken.getType();
0187 _ttype = testLiteralsTable(_ttype);
0188 _returnToken.setType(_ttype);
0189 return _returnToken;
0190 }
0191 catch (RecognitionException e) {
0192 if ( !getCommitToPath() ) {
0193 rewind(_m);
0194 resetText();
0195 try {mTEXT(false);}
0196 catch(RecognitionException ee) {
0197 // horrendous failure: error in filter rule
0198 reportError(ee);
0199 consume();
0200 }
0201 continue tryAgain;
0202 }
0203 throw new TokenStreamRecognitionException(e);
0204 }
0205 }
0206 catch (CharStreamException cse) {
0207 if ( cse instanceof CharStreamIOException ) {
0208 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
0209 }
0210 else {
0211 throw new TokenStreamException(cse.getMessage());
0212 }
0213 }
0214 }
0215 }
0216
0217 public final void mBOLD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0218 int _ttype; Token _token=null; int _begin=text.length();
0219 _ttype = BOLD;
0220 int _saveIndex;
0221
0222 if (!(!inTitle))
0223 throw new SemanticException("!inTitle");
0224 captureText();
0225 _saveIndex=text.length();
0226 match('*');
0227 text.setLength(_saveIndex);
0228 {
0229 int _cnt3=0;
0230 _loop3:
0231 do {
0232 if ((_tokenSet_2.member(LA(1)))) {
0233 matchNot('*');
0234 }
0235 else {
0236 if ( _cnt3>=1 ) { break _loop3; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0237 }
0238
0239 _cnt3++;
0240 } while (true);
0241 }
0242 _saveIndex=text.length();
0243 match('*');
0244 text.setLength(_saveIndex);
0245 target.bold(new String(text.getBuffer(),_begin,text.length()-_begin));
0246 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0247 _token = makeToken(_ttype);
0248 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0249 }
0250 _returnToken = _token;
0251 }
0252
0253 public final void mITALIC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0254 int _ttype; Token _token=null; int _begin=text.length();
0255 _ttype = ITALIC;
0256 int _saveIndex;
0257
0258 if (!(!inTitle))
0259 throw new SemanticException("!inTitle");
0260 captureText();
0261 _saveIndex=text.length();
0262 match('_');
0263 text.setLength(_saveIndex);
0264 {
0265 int _cnt6=0;
0266 _loop6:
0267 do {
0268 if ((_tokenSet_3.member(LA(1)))) {
0269 matchNot('_');
0270 }
0271 else {
0272 if ( _cnt6>=1 ) { break _loop6; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0273 }
0274
0275 _cnt6++;
0276 } while (true);
0277 }
0278 _saveIndex=text.length();
0279 match('_');
0280 text.setLength(_saveIndex);
0281 target.italic(new String(text.getBuffer(),_begin,text.length()-_begin));
0282 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0283 _token = makeToken(_ttype);
0284 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0285 }
0286 _returnToken = _token;
0287 }
0288
0289 public final void mTT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0290 int _ttype; Token _token=null; int _begin=text.length();
0291 _ttype = TT;
0292 int _saveIndex;
0293
0294 if (!(!inTitle))
0295 throw new SemanticException("!inTitle");
0296 captureText();
0297 _saveIndex=text.length();
0298 match('=');
0299 text.setLength(_saveIndex);
0300 {
0301 int _cnt9=0;
0302 _loop9:
0303 do {
0304 if ((_tokenSet_4.member(LA(1)))) {
0305 matchNot('=');
0306 }
0307 else {
0308 if ( _cnt9>=1 ) { break _loop9; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0309 }
0310
0311 _cnt9++;
0312 } while (true);
0313 }
0314 _saveIndex=text.length();
0315 match('=');
0316 text.setLength(_saveIndex);
0317 target.tt(new String(text.getBuffer(),_begin,text.length()-_begin));
0318 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0319 _token = makeToken(_ttype);
0320 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0321 }
0322 _returnToken = _token;
0323 }
0324
0325 /** A link looks like %(url,title) or %(url),
0326 * which is same as http://foo.com. An anchor ref to an image,
0327 * table or section will be %table(name).
0328 *
0329 * A wikilink looks like %(WikiLink) i.e. CamelCase within the
0330 * %() link indicators.
0331 */
0332 public final void mLINK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0333 int _ttype; Token _token=null; int _begin=text.length();
0334 _ttype = LINK;
0335 int _saveIndex;
0336
0337 String url=null, title=null;
0338
0339
0340 if (!(getLine()!=1))
0341 throw new SemanticException("getLine()!=1");
0342 captureText();
0343 {
0344 switch ( LA(1)) {
0345 case 'h':
0346 {
0347 match("http://");
0348 {
0349 int _cnt30=0;
0350 _loop30:
0351 do {
0352 if ((_tokenSet_10.member(LA(1)))) {
0353 {
0354 match(_tokenSet_10);
0355 }
0356 }
0357 else {
0358 if ( _cnt30>=1 ) { break _loop30; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0359 }
0360
0361 _cnt30++;
0362 } while (true);
0363 }
0364 target.link(new String(text.getBuffer(),_begin,text.length()-_begin),null);
0365 break;
0366 }
0367 case 'f':
0368 {
0369 match("ftp://");
0370 {
0371 int _cnt33=0;
0372 _loop33:
0373 do {
0374 if ((_tokenSet_10.member(LA(1)))) {
0375 {
0376 match(_tokenSet_10);
0377 }
0378 }
0379 else {
0380 if ( _cnt33>=1 ) { break _loop33; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0381 }
0382
0383 _cnt33++;
0384 } while (true);
0385 }
0386 target.link(new String(text.getBuffer(),_begin,text.length()-_begin),null);
0387 break;
0388 }
0389 case 'm':
0390 {
0391 _saveIndex=text.length();
0392 match("mailto:");
0393 text.setLength(_saveIndex);
0394 {
0395 int _cnt36=0;
0396 _loop36:
0397 do {
0398 if ((_tokenSet_10.member(LA(1)))) {
0399 {
0400 match(_tokenSet_10);
0401 }
0402 }
0403 else {
0404 if ( _cnt36>=1 ) { break _loop36; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0405 }
0406
0407 _cnt36++;
0408 } while (true);
0409 }
0410 target.link(new String(text.getBuffer(),_begin,text.length()-_begin),null);
0411 break;
0412 }
0413 default:
0414 if ((LA(1)=='%') && (LA(2)=='(') && ((LA(3) >= 'A' && LA(3) <= 'Z')) && ((LA(4) >= 'a' && LA(4) <= 'z')) && (_tokenSet_11.member(LA(5)))) {
0415 _saveIndex=text.length();
0416 match("%(");
0417 text.setLength(_saveIndex);
0418 {
0419 int _cnt16=0;
0420 _loop16:
0421 do {
0422 if (((LA(1) >= 'A' && LA(1) <= 'Z'))) {
0423 {
0424 matchRange('A','Z');
0425 }
0426 {
0427 int _cnt15=0;
0428 _loop15:
0429 do {
0430 if (((LA(1) >= 'a' && LA(1) <= 'z'))) {
0431 matchRange('a','z');
0432 }
0433 else {
0434 if ( _cnt15>=1 ) { break _loop15; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0435 }
0436
0437 _cnt15++;
0438 } while (true);
0439 }
0440 }
0441 else {
0442 if ( _cnt16>=1 ) { break _loop16; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0443 }
0444
0445 _cnt16++;
0446 } while (true);
0447 }
0448 url=new String(text.getBuffer(),_begin,text.length()-_begin); text.setLength(_begin); text.append("");
0449 {
0450 switch ( LA(1)) {
0451 case ',':
0452 {
0453 _saveIndex=text.length();
0454 match(',');
0455 text.setLength(_saveIndex);
0456 {
0457 int _cnt20=0;
0458 _loop20:
0459 do {
0460 if ((_tokenSet_12.member(LA(1)))) {
0461 {
0462 match(_tokenSet_12);
0463 }
0464 }
0465 else {
0466 if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0467 }
0468
0469 _cnt20++;
0470 } while (true);
0471 }
0472 title=new String(text.getBuffer(),_begin,text.length()-_begin);
0473 break;
0474 }
0475 case ')':
0476 {
0477 break;
0478 }
0479 default:
0480 {
0481 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
0482 }
0483 }
0484 }
0485 _saveIndex=text.length();
0486 match(')');
0487 text.setLength(_saveIndex);
0488 target.wikilink(url,title);
0489 }
0490 else if ((LA(1)=='%') && (LA(2)=='(') && (_tokenSet_1.member(LA(3))) && ((LA(4) >= '\u0003' && LA(4) <= '\ufffe')) && (true)) {
0491 _saveIndex=text.length();
0492 match("%(");
0493 text.setLength(_saveIndex);
0494 {
0495 int _cnt23=0;
0496 _loop23:
0497 do {
0498 if ((_tokenSet_1.member(LA(1)))) {
0499 {
0500 match(_tokenSet_1);
0501 }
0502 }
0503 else {
0504 if ( _cnt23>=1 ) { break _loop23; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0505 }
0506
0507 _cnt23++;
0508 } while (true);
0509 }
0510 url=new String(text.getBuffer(),_begin,text.length()-_begin); text.setLength(_begin); text.append("");
0511 {
0512 switch ( LA(1)) {
0513 case ',':
0514 {
0515 _saveIndex=text.length();
0516 match(',');
0517 text.setLength(_saveIndex);
0518 {
0519 int _cnt27=0;
0520 _loop27:
0521 do {
0522 if ((_tokenSet_12.member(LA(1)))) {
0523 {
0524 match(_tokenSet_12);
0525 }
0526 }
0527 else {
0528 if ( _cnt27>=1 ) { break _loop27; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0529 }
0530
0531 _cnt27++;
0532 } while (true);
0533 }
0534 title=new String(text.getBuffer(),_begin,text.length()-_begin);
0535 break;
0536 }
0537 case ')':
0538 {
0539 break;
0540 }
0541 default:
0542 {
0543 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
0544 }
0545 }
0546 }
0547 _saveIndex=text.length();
0548 match(')');
0549 text.setLength(_saveIndex);
0550 target.link(url,title);
0551 }
0552 else {
0553 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
0554 }
0555 }
0556 }
0557 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0558 _token = makeToken(_ttype);
0559 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0560 }
0561 _returnToken = _token;
0562 }
0563
0564 /** An anchor is a # followed by an ID */
0565 public final void mANCHOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0566 int _ttype; Token _token=null; int _begin=text.length();
0567 _ttype = ANCHOR;
0568 int _saveIndex;
0569
0570 _saveIndex=text.length();
0571 match('#');
0572 text.setLength(_saveIndex);
0573 {
0574 switch ( LA(1)) {
0575 case 'a': case 'b': case 'c': case 'd':
0576 case 'e': case 'f': case 'g': case 'h':
0577 case 'i': case 'j': case 'k': case 'l':
0578 case 'm': case 'n': case 'o': case 'p':
0579 case 'q': case 'r': case 's': case 't':
0580 case 'u': case 'v': case 'w': case 'x':
0581 case 'y': case 'z':
0582 {
0583 matchRange('a','z');
0584 break;
0585 }
0586 case 'A': case 'B': case 'C': case 'D':
0587 case 'E': case 'F': case 'G': case 'H':
0588 case 'I': case 'J': case 'K': case 'L':
0589 case 'M': case 'N': case 'O': case 'P':
0590 case 'Q': case 'R': case 'S': case 'T':
0591 case 'U': case 'V': case 'W': case 'X':
0592 case 'Y': case 'Z':
0593 {
0594 matchRange('A','Z');
0595 break;
0596 }
0597 case '_':
0598 {
0599 match('_');
0600 break;
0601 }
0602 default:
0603 {
0604 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
0605 }
0606 }
0607 }
0608 {
0609 _loop40:
0610 do {
0611 switch ( LA(1)) {
0612 case 'a': case 'b': case 'c': case 'd':
0613 case 'e': case 'f': case 'g': case 'h':
0614 case 'i': case 'j': case 'k': case 'l':
0615 case 'm': case 'n': case 'o': case 'p':
0616 case 'q': case 'r': case 's': case 't':
0617 case 'u': case 'v': case 'w': case 'x':
0618 case 'y': case 'z':
0619 {
0620 matchRange('a','z');
0621 break;
0622 }
0623 case 'A': case 'B': case 'C': case 'D':
0624 case 'E': case 'F': case 'G': case 'H':
0625 case 'I': case 'J': case 'K': case 'L':
0626 case 'M': case 'N': case 'O': case 'P':
0627 case 'Q': case 'R': case 'S': case 'T':
0628 case 'U': case 'V': case 'W': case 'X':
0629 case 'Y': case 'Z':
0630 {
0631 matchRange('A','Z');
0632 break;
0633 }
0634 case '_':
0635 {
0636 match('_');
0637 break;
0638 }
0639 case '-':
0640 {
0641 match('-');
0642 break;
0643 }
0644 case '0': case '1': case '2': case '3':
0645 case '4': case '5': case '6': case '7':
0646 case '8': case '9':
0647 {
0648 matchRange('0','9');
0649 break;
0650 }
0651 default:
0652 {
0653 break _loop40;
0654 }
0655 }
0656 } while (true);
0657 }
0658 target.anchor(new String(text.getBuffer(),_begin,text.length()-_begin));
0659 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0660 _token = makeToken(_ttype);
0661 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0662 }
0663 _returnToken = _token;
0664 }
0665
0666 /** First line of outermost file (stdin usually) is title */
0667 public final void mTITLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0668 int _ttype; Token _token=null; int _begin=text.length();
0669 _ttype = TITLE;
0670 int _saveIndex;
0671
0672 if (!(getLine()==1 && getColumn()==1 && !context.isNestedTranslator()))
0673 throw new SemanticException("getLine()==1 && getColumn()==1 && !context.isNestedTranslator()");
0674 this.inTitle=true;
0675 {
0676 _loop43:
0677 do {
0678 if ((LA(1)==' ') && (_tokenSet_9.member(LA(2))) && (true) && (true) && (true)) {
0679 _saveIndex=text.length();
0680 match(' ');
0681 text.setLength(_saveIndex);
0682 }
0683 else if ((LA(1)=='\t') && (_tokenSet_9.member(LA(2))) && (true) && (true) && (true)) {
0684 _saveIndex=text.length();
0685 match('\t');
0686 text.setLength(_saveIndex);
0687 }
0688 else {
0689 break _loop43;
0690 }
0691
0692 } while (true);
0693 }
0694 {
0695 int _cnt52=0;
0696 _loop52:
0697 do {
0698 switch ( LA(1)) {
0699 case '_':
0700 {
0701 _saveIndex=text.length();
0702 match('_');
0703 text.setLength(_saveIndex);
0704 text.append(target.beginEM());
0705 {
0706 int _cnt46=0;
0707 _loop46:
0708 do {
0709 if ((_tokenSet_3.member(LA(1)))) {
0710 matchNot('_');
0711 }
0712 else {
0713 if ( _cnt46>=1 ) { break _loop46; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0714 }
0715
0716 _cnt46++;
0717 } while (true);
0718 }
0719 text.append(target.endEM());
0720 _saveIndex=text.length();
0721 match('_');
0722 text.setLength(_saveIndex);
0723 break;
0724 }
0725 case '=':
0726 {
0727 _saveIndex=text.length();
0728 match('=');
0729 text.setLength(_saveIndex);
0730 text.append(target.beginTT());
0731 {
0732 int _cnt48=0;
0733 _loop48:
0734 do {
0735 if ((_tokenSet_4.member(LA(1)))) {
0736 matchNot('=');
0737 }
0738 else {
0739 if ( _cnt48>=1 ) { break _loop48; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0740 }
0741
0742 _cnt48++;
0743 } while (true);
0744 }
0745 text.append(target.endTT());
0746 _saveIndex=text.length();
0747 match('=');
0748 text.setLength(_saveIndex);
0749 break;
0750 }
0751 case '*':
0752 {
0753 _saveIndex=text.length();
0754 match('*');
0755 text.setLength(_saveIndex);
0756 {
0757 int _cnt50=0;
0758 _loop50:
0759 do {
0760 if ((_tokenSet_2.member(LA(1)))) {
0761 matchNot('*');
0762 }
0763 else {
0764 if ( _cnt50>=1 ) { break _loop50; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0765 }
0766
0767 _cnt50++;
0768 } while (true);
0769 }
0770 _saveIndex=text.length();
0771 match('*');
0772 text.setLength(_saveIndex);
0773 break;
0774 }
0775 default:
0776 if ((_tokenSet_13.member(LA(1)))) {
0777 {
0778 match(_tokenSet_13);
0779 }
0780 }
0781 else {
0782 if ( _cnt52>=1 ) { break _loop52; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
0783 }
0784 }
0785 _cnt52++;
0786 } while (true);
0787 }
0788 title(new String(text.getBuffer(),_begin,text.length()-_begin));this.inTitle=false;
0789 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0790 _token = makeToken(_ttype);
0791 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0792 }
0793 _returnToken = _token;
0794 }
0795
0796 protected final void mNOT_SPECIAL_CHAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0797 int _ttype; Token _token=null; int _begin=text.length();
0798 _ttype = NOT_SPECIAL_CHAR;
0799 int _saveIndex;
0800
0801 {
0802 match(_tokenSet_14);
0803 }
0804 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0805 _token = makeToken(_ttype);
0806 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0807 }
0808 _returnToken = _token;
0809 }
0810
0811 public final void mBR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0812 int _ttype; Token _token=null; int _begin=text.length();
0813 _ttype = BR;
0814 int _saveIndex;
0815
0816 _saveIndex=text.length();
0817 match('\\');
0818 text.setLength(_saveIndex);
0819 _saveIndex=text.length();
0820 match('\n');
0821 text.setLength(_saveIndex);
0822 captureText(); target.linebreak();
0823 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0824 _token = makeToken(_ttype);
0825 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0826 }
0827 _returnToken = _token;
0828 }
0829
0830 public final void mBLANK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0831 int _ttype; Token _token=null; int _begin=text.length();
0832 _ttype = BLANK;
0833 int _saveIndex;
0834
0835 _saveIndex=text.length();
0836 match('\n');
0837 text.setLength(_saveIndex);
0838 _saveIndex=text.length();
0839 match('\\');
0840 text.setLength(_saveIndex);
0841 _saveIndex=text.length();
0842 match('\n');
0843 text.setLength(_saveIndex);
0844 captureText(); target.blankline();
0845 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0846 _token = makeToken(_ttype);
0847 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0848 }
0849 _returnToken = _token;
0850 }
0851
0852 public final void mLONGDASH(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0853 int _ttype; Token _token=null; int _begin=text.length();
0854 _ttype = LONGDASH;
0855 int _saveIndex;
0856
0857 if (!(getColumn()!=1))
0858 throw new SemanticException("getColumn()!=1");
0859 match("--");
0860 captureText();target.longdash();
0861 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0862 _token = makeToken(_ttype);
0863 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0864 }
0865 _returnToken = _token;
0866 }
0867
0868 protected final void mTOP_PAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0869 int _ttype; Token _token=null; int _begin=text.length();
0870 _ttype = TOP_PAREN;
0871 int _saveIndex;
0872
0873 _saveIndex=text.length();
0874 match('(');
0875 text.setLength(_saveIndex);
0876 {
0877 _loop60:
0878 do {
0879 if ((LA(1)=='(')) {
0880 mNESTED_PAREN(false);
0881 }
0882 else if ((_tokenSet_15.member(LA(1)))) {
0883 matchNot(')');
0884 }
0885 else {
0886 break _loop60;
0887 }
0888
0889 } while (true);
0890 }
0891 _saveIndex=text.length();
0892 match(')');
0893 text.setLength(_saveIndex);
0894 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0895 _token = makeToken(_ttype);
0896 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0897 }
0898 _returnToken = _token;
0899 }
0900
0901 protected final void mNESTED_PAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0902 int _ttype; Token _token=null; int _begin=text.length();
0903 _ttype = NESTED_PAREN;
0904 int _saveIndex;
0905
0906 match('(');
0907 {
0908 _loop63:
0909 do {
0910 if ((LA(1)=='(')) {
0911 mNESTED_PAREN(false);
0912 }
0913 else if ((_tokenSet_15.member(LA(1)))) {
0914 matchNot(')');
0915 }
0916 else {
0917 break _loop63;
0918 }
0919
0920 } while (true);
0921 }
0922 match(')');
0923 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
0924 _token = makeToken(_ttype);
0925 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
0926 }
0927 _returnToken = _token;
0928 }
0929
0930 public final void mPLUGIN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
0931 int _ttype; Token _token=null; int _begin=text.length();
0932 _ttype = PLUGIN;
0933 int _saveIndex;
0934 Token id=null;
0935 Token a=null;
0936 Token out=null;
0937 Token id2=null;
0938 Token arg=null;
0939
0940 Vector args=null;
0941
0942
0943 {
0944 if ((LA(1)=='%') && (LA(2)=='d') && (LA(3)=='e') && (LA(4)=='f') && (LA(5)=='(')) {
0945 _saveIndex=text.length();
0946 match("%def");
0947 text.setLength(_saveIndex);
0948 match('(');
0949 mID(true);
0950 id=_returnToken;
0951 match(',');
0952 mWS(false);
0953 mARG(true);
0954 a=_returnToken;
0955 match(')');
0956 define(id.getText(),a.getText());
0957 }
0958 else if ((LA(1)=='%') && (LA(2)=='o') && (LA(3)=='u') && (LA(4)=='t') && (LA(5)=='p')) {
0959 _saveIndex=text.length();
0960 match("%output");
0961 text.setLength(_saveIndex);
0962 _saveIndex=text.length();
0963 mWS(false);
0964 text.setLength(_saveIndex);
0965 mTOP_PAREN(true);
0966 out=_returnToken;
0967 captureText(); target.verbatim(out.getText());
0968 }
0969 else if ((LA(1)=='%') && (LA(2)=='c') && (LA(3)=='o') && (LA(4)=='n') && (LA(5)=='t')) {
0970 _saveIndex=text.length();
0971 match("%contents");
0972 text.setLength(_saveIndex);
0973 captureText(); target.contents();
0974 }
0975 else if ((LA(1)=='%') && (_tokenSet_5.member(LA(2))) && (true) && (true) && (true)) {
0976 match('%');
0977 mID(true);
0978 id2=_returnToken;
0979 {
0980 if ((LA(1)=='(') && (LA(2)==')')) {
0981 match('(');
0982 match(')');
0983 captureText();plugin(id2.getText(), null);
0984 }
0985 else if ((LA(1)=='(') && (_tokenSet_1.member(LA(2)))) {
0986 match('(');
0987 args=mARGLIST(false);
0988 match(')');
0989 captureText(); plugin(id2.getText(), args);
0990 }
0991 else if ((_tokenSet_16.member(LA(1)))) {
0992 _saveIndex=text.length();
0993 mWS(false);
0994 text.setLength(_saveIndex);
0995 mCODE(true);
0996 arg=_returnToken;
0997 Vector v=new Vector(); v.addElement(arg.getText()); captureText();
0998 plugin(id2.getText(), v);
0999 }
1000 else {
1001 variable(id2.getText());
1002 }
1003
1004 }
1005 }
1006 else {
1007 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1008 }
1009
1010 }
1011 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1012 _token = makeToken(_ttype);
1013 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1014 }
1015 _returnToken = _token;
1016 }
1017
1018 protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1019 int _ttype; Token _token=null; int _begin=text.length();
1020 _ttype = ID;
1021 int _saveIndex;
1022
1023 {
1024 switch ( LA(1)) {
1025 case 'a': case 'b': case 'c': case 'd':
1026 case 'e': case 'f': case 'g': case 'h':
1027 case 'i': case 'j': case 'k': case 'l':
1028 case 'm': case 'n': case 'o': case 'p':
1029 case 'q': case 'r': case 's': case 't':
1030 case 'u': case 'v': case 'w': case 'x':
1031 case 'y': case 'z':
1032 {
1033 matchRange('a','z');
1034 break;
1035 }
1036 case 'A': case 'B': case 'C': case 'D':
1037 case 'E': case 'F': case 'G': case 'H':
1038 case 'I': case 'J': case 'K': case 'L':
1039 case 'M': case 'N': case 'O': case 'P':
1040 case 'Q': case 'R': case 'S': case 'T':
1041 case 'U': case 'V': case 'W': case 'X':
1042 case 'Y': case 'Z':
1043 {
1044 matchRange('A','Z');
1045 break;
1046 }
1047 case '_':
1048 {
1049 match('_');
1050 break;
1051 }
1052 default:
1053 {
1054 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1055 }
1056 }
1057 }
1058 {
1059 _loop81:
1060 do {
1061 switch ( LA(1)) {
1062 case 'a': case 'b': case 'c': case 'd':
1063 case 'e': case 'f': case 'g': case 'h':
1064 case 'i': case 'j': case 'k': case 'l':
1065 case 'm': case 'n': case 'o': case 'p':
1066 case 'q': case 'r': case 's': case 't':
1067 case 'u': case 'v': case 'w': case 'x':
1068 case 'y': case 'z':
1069 {
1070 matchRange('a','z');
1071 break;
1072 }
1073 case 'A': case 'B': case 'C': case 'D':
1074 case 'E': case 'F': case 'G': case 'H':
1075 case 'I': case 'J': case 'K': case 'L':
1076 case 'M': case 'N': case 'O': case 'P':
1077 case 'Q': case 'R': case 'S': case 'T':
1078 case 'U': case 'V': case 'W': case 'X':
1079 case 'Y': case 'Z':
1080 {
1081 matchRange('A','Z');
1082 break;
1083 }
1084 case '_':
1085 {
1086 match('_');
1087 break;
1088 }
1089 case '0': case '1': case '2': case '3':
1090 case '4': case '5': case '6': case '7':
1091 case '8': case '9':
1092 {
1093 matchRange('0','9');
1094 break;
1095 }
1096 default:
1097 {
1098 break _loop81;
1099 }
1100 }
1101 } while (true);
1102 }
1103 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1104 _token = makeToken(_ttype);
1105 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1106 }
1107 _returnToken = _token;
1108 }
1109
1110 protected final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1111 int _ttype; Token _token=null; int _begin=text.length();
1112 _ttype = WS;
1113 int _saveIndex;
1114
1115 {
1116 _loop123:
1117 do {
1118 if ((LA(1)==' ') && (_tokenSet_1.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true)) {
1119 _saveIndex=text.length();
1120 match(' ');
1121 text.setLength(_saveIndex);
1122 }
1123 else if ((LA(1)=='\t') && (_tokenSet_1.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true)) {
1124 _saveIndex=text.length();
1125 match('\t');
1126 text.setLength(_saveIndex);
1127 }
1128 else if ((LA(1)=='\n') && (_tokenSet_1.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true)) {
1129 _saveIndex=text.length();
1130 match('\n');
1131 text.setLength(_saveIndex);
1132 newline();
1133 }
1134 else {
1135 break _loop123;
1136 }
1137
1138 } while (true);
1139 }
1140 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1141 _token = makeToken(_ttype);
1142 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1143 }
1144 _returnToken = _token;
1145 }
1146
1147 protected final void mARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1148 int _ttype; Token _token=null; int _begin=text.length();
1149 _ttype = ARG;
1150 int _saveIndex;
1151 Token id=null;
1152
1153 switch ( LA(1)) {
1154 case '"':
1155 {
1156 mSTRING(false);
1157 break;
1158 }
1159 case '%':
1160 {
1161 match('%');
1162 mID(true);
1163 id=_returnToken;
1164
1165 String value = (context.getVariable(id.getText())).toString();
1166 text.setLength(_begin); text.append(value);
1167
1168 break;
1169 }
1170 default:
1171 if ((_tokenSet_17.member(LA(1)))) {
1172 mTEXT_TIL_END_ARG(false);
1173 }
1174 else {
1175 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1176 }
1177 }
1178 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1179 _token = makeToken(_ttype);
1180 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1181 }
1182 _returnToken = _token;
1183 }
1184
1185 protected final Vector mARGLIST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1186 Vector args=new Vector();
1187 int _ttype; Token _token=null; int _begin=text.length();
1188 _ttype = ARGLIST;
1189 int _saveIndex;
1190 Token a1=null;
1191 Token a2=null;
1192
1193 mARG(true);
1194 a1=_returnToken;
1195 args.addElement(a1.getText());
1196 {
1197 _loop69:
1198 do {
1199 if ((LA(1)==',')) {
1200 match(',');
1201 mWS(false);
1202 mARG(true);
1203 a2=_returnToken;
1204 args.addElement(a2.getText());
1205 }
1206 else {
1207 break _loop69;
1208 }
1209
1210 } while (true);
1211 }
1212 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1213 _token = makeToken(_ttype);
1214 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1215 }
1216 _returnToken = _token;
1217 return args;
1218 }
1219
1220 protected final void mCODE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1221 int _ttype; Token _token=null; int _begin=text.length();
1222 _ttype = CODE;
1223 int _saveIndex;
1224
1225 _saveIndex=text.length();
1226 match("<<");
1227 text.setLength(_saveIndex);
1228 {
1229 _loop103:
1230 do {
1231 // nongreedy exit test
1232 if ((LA(1)=='>') && (LA(2)=='>') && (true)) break _loop103;
1233 if ((LA(1)=='\\') && (_tokenSet_6.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && ((LA(4) >= '\u0003' && LA(4) <= '\ufffe')) && (true)) {
1234 mESC2(false);
1235 }
1236 else if ((LA(1)=='\n') && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe')) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true)) {
1237 match('\n');
1238 newline();
1239 }
1240 else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe')) && ((LA(3) >= '\u0003' && LA(3) <= '\ufffe')) && (true) && (true)) {
1241 matchNot(EOF_CHAR);
1242 }
1243 else {
1244 break _loop103;
1245 }
1246
1247 } while (true);
1248 }
1249 _saveIndex=text.length();
1250 match(">>");
1251 text.setLength(_saveIndex);
1252 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1253 _token = makeToken(_ttype);
1254 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1255 }
1256 _returnToken = _token;
1257 }
1258
1259 protected final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1260 int _ttype; Token _token=null; int _begin=text.length();
1261 _ttype = STRING;
1262 int _saveIndex;
1263
1264 _saveIndex=text.length();
1265 match('"');
1266 text.setLength(_saveIndex);
1267 {
1268 _loop73:
1269 do {
1270 if ((_tokenSet_18.member(LA(1)))) {
1271 matchNot('"');
1272 }
1273 else {
1274 break _loop73;
1275 }
1276
1277 } while (true);
1278 }
1279 _saveIndex=text.length();
1280 match('"');
1281 text.setLength(_saveIndex);
1282 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1283 _token = makeToken(_ttype);
1284 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1285 }
1286 _returnToken = _token;
1287 }
1288
1289 protected final void mTEXT_TIL_END_ARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1290 int _ttype; Token _token=null; int _begin=text.length();
1291 _ttype = TEXT_TIL_END_ARG;
1292 int _saveIndex;
1293
1294 {
1295 int _cnt77=0;
1296 _loop77:
1297 do {
1298 if ((_tokenSet_17.member(LA(1)))) {
1299 {
1300 match(_tokenSet_17);
1301 }
1302 }
1303 else {
1304 if ( _cnt77>=1 ) { break _loop77; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1305 }
1306
1307 _cnt77++;
1308 } while (true);
1309 }
1310 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1311 _token = makeToken(_ttype);
1312 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1313 }
1314 _returnToken = _token;
1315 }
1316
1317 public final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1318 int _ttype; Token _token=null; int _begin=text.length();
1319 _ttype = ESC;
1320 int _saveIndex;
1321 char c = '\0';
1322
1323 _saveIndex=text.length();
1324 match('\\');
1325 text.setLength(_saveIndex);
1326 c = LA(1);
1327 matchNot('\n');
1328 context.textBetweenMarkup.append(c);
1329 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1330 _token = makeToken(_ttype);
1331 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1332 }
1333 _returnToken = _token;
1334 }
1335
1336 protected final void mESC2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1337 int _ttype; Token _token=null; int _begin=text.length();
1338 _ttype = ESC2;
1339 int _saveIndex;
1340 char c = '\0';
1341
1342 _saveIndex=text.length();
1343 match('\\');
1344 text.setLength(_saveIndex);
1345 c = LA(1);
1346 matchNot('\n');
1347 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1348 _token = makeToken(_ttype);
1349 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1350 }
1351 _returnToken = _token;
1352 }
1353
1354 public final void mLINE_START_THEN_MARKUP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1355 int _ttype; Token _token=null; int _begin=text.length();
1356 _ttype = LINE_START_THEN_MARKUP;
1357 int _saveIndex;
1358
1359 if (!(getColumn()==1))
1360 throw new SemanticException("getColumn()==1");
1361 mLEFT_EDGE_MARKUP(false);
1362 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1363 _token = makeToken(_ttype);
1364 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1365 }
1366 _returnToken = _token;
1367 }
1368
1369 protected final void mLEFT_EDGE_MARKUP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1370 int _ttype; Token _token=null; int _begin=text.length();
1371 _ttype = LEFT_EDGE_MARKUP;
1372 int _saveIndex;
1373 int level = YAMContext.LOWEST_LEVEL;
1374
1375 {
1376 if ((LA(1)==' ') && (LA(2)==' ') && (LA(3)=='"')) {
1377 mBLOCKQUOTE(false);
1378 captureText(); closeAllLists(); target.blockquote(new String(text.getBuffer(),_begin,text.length()-_begin));
1379 }
1380 else if (((LA(1)==' '||LA(1)=='-'||LA(1)=='o') && (LA(2)==' ') && (true))&&(!inTable)) {
1381 {
1382 _loop89:
1383 do {
1384 if ((LA(1)==' ')) {
1385 match(" ");
1386 level++;
1387 }
1388 else {
1389 break _loop89;
1390 }
1391
1392 } while (true);
1393 }
1394 {
1395 switch ( LA(1)) {
1396 case 'o':
1397 {
1398 _saveIndex=text.length();
1399 match("o ");
1400 text.setLength(_saveIndex);
1401 captureText(); ol(level);
1402 break;
1403 }
1404 case '-':
1405 {
1406 _saveIndex=text.length();
1407 match("- ");
1408 text.setLength(_saveIndex);
1409 captureText(); ul(level);
1410 break;
1411 }
1412 default:
1413 {
1414 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1415 }
1416 }
1417 }
1418 }
1419 else if ((LA(1)=='%') && ((LA(2) >= '1' && LA(2) <= '4'))) {
1420 mSECTION(false);
1421 }
1422 else if ((LA(1)=='%') && (LA(2)=='[')) {
1423 mTABLE(false);
1424 inTable=true;
1425 }
1426 else if ((LA(1)=='%') && (LA(2)==']')) {
1427 mEND_TABLE(false);
1428 inTable=false;
1429 }
1430 else if ((LA(1)=='%') && (LA(2)=='%')) {
1431 match("%%");
1432 {
1433 _loop92:
1434 do {
1435 if ((LA(1)=='%')) {
1436 match('%');
1437 }
1438 else {
1439 break _loop92;
1440 }
1441
1442 } while (true);
1443 }
1444 captureText(); closeAllLists(); target.hr();
1445 }
1446 else if ((LA(1)=='<')) {
1447 mCODE(false);
1448 captureText(); target.code(new String(text.getBuffer(),_begin,text.length()-_begin));
1449 }
1450 else {
1451 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1452 }
1453
1454 }
1455 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1456 _token = makeToken(_ttype);
1457 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1458 }
1459 _returnToken = _token;
1460 }
1461
1462 public final void mBLANK_LINE_THEN_MARKUP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1463 int _ttype; Token _token=null; int _begin=text.length();
1464 _ttype = BLANK_LINE_THEN_MARKUP;
1465 int _saveIndex;
1466
1467 _saveIndex=text.length();
1468 match("\n\n");
1469 text.setLength(_saveIndex);
1470 context.textBetweenMarkup.append('\n');
1471 mLEFT_EDGE_MARKUP(false);
1472 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1473 _token = makeToken(_ttype);
1474 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1475 }
1476 _returnToken = _token;
1477 }
1478
1479 protected final void mBLOCKQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1480 int _ttype; Token _token=null; int _begin=text.length();
1481 _ttype = BLOCKQUOTE;
1482 int _saveIndex;
1483
1484 _saveIndex=text.length();
1485 match(" \"");
1486 text.setLength(_saveIndex);
1487 {
1488 int _cnt100=0;
1489 _loop100:
1490 do {
1491 if ((LA(1)=='\\') && (LA(2)=='"') && (_tokenSet_18.member(LA(3))) && ((LA(4) >= '\u0003' && LA(4) <= '\ufffe')) && ((LA(5) >= '\u0003' && LA(5) <= '\ufffe'))) {
1492 mINQUOTE(false);
1493 }
1494 else if ((_tokenSet_19.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe')) && (true) && (true) && (true)) {
1495 {
1496 match(_tokenSet_19);
1497 }
1498 }
1499 else if ((LA(1)=='\n')) {
1500 match('\n');
1501 newline();
1502 }
1503 else {
1504 if ( _cnt100>=1 ) { break _loop100; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1505 }
1506
1507 _cnt100++;
1508 } while (true);
1509 }
1510 _saveIndex=text.length();
1511 match('"');
1512 text.setLength(_saveIndex);
1513 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1514 _token = makeToken(_ttype);
1515 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1516 }
1517 _returnToken = _token;
1518 }
1519
1520 protected final void mSECTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1521 int _ttype; Token _token=null; int _begin=text.length();
1522 _ttype = SECTION;
1523 int _saveIndex;
1524 Token out=null;
1525 captureText();
1526
1527 _saveIndex=text.length();
1528 match('%');
1529 text.setLength(_saveIndex);
1530 _saveIndex=text.length();
1531 mLEVEL(true);
1532 text.setLength(_saveIndex);
1533 out=_returnToken;
1534 _saveIndex=text.length();
1535 match(' ');
1536 text.setLength(_saveIndex);
1537 this.inTitle=true;
1538 {
1539 int _cnt115=0;
1540 _loop115:
1541 do {
1542 switch ( LA(1)) {
1543 case '_':
1544 {
1545 _saveIndex=text.length();
1546 match('_');
1547 text.setLength(_saveIndex);
1548 text.append(target.beginEM());
1549 {
1550 int _cnt109=0;
1551 _loop109:
1552 do {
1553 if ((_tokenSet_3.member(LA(1)))) {
1554 matchNot('_');
1555 }
1556 else {
1557 if ( _cnt109>=1 ) { break _loop109; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1558 }
1559
1560 _cnt109++;
1561 } while (true);
1562 }
1563 text.append(target.endEM());
1564 _saveIndex=text.length();
1565 match('_');
1566 text.setLength(_saveIndex);
1567 break;
1568 }
1569 case '=':
1570 {
1571 _saveIndex=text.length();
1572 match('=');
1573 text.setLength(_saveIndex);
1574 text.append(target.beginTT());
1575 {
1576 int _cnt111=0;
1577 _loop111:
1578 do {
1579 if ((_tokenSet_4.member(LA(1)))) {
1580 matchNot('=');
1581 }
1582 else {
1583 if ( _cnt111>=1 ) { break _loop111; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1584 }
1585
1586 _cnt111++;
1587 } while (true);
1588 }
1589 text.append(target.endTT());
1590 _saveIndex=text.length();
1591 match('=');
1592 text.setLength(_saveIndex);
1593 break;
1594 }
1595 case '*':
1596 {
1597 _saveIndex=text.length();
1598 match('*');
1599 text.setLength(_saveIndex);
1600 text.append(target.beginTT());
1601 {
1602 int _cnt113=0;
1603 _loop113:
1604 do {
1605 if ((_tokenSet_2.member(LA(1)))) {
1606 matchNot('*');
1607 }
1608 else {
1609 if ( _cnt113>=1 ) { break _loop113; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1610 }
1611
1612 _cnt113++;
1613 } while (true);
1614 }
1615 text.append(target.endTT());
1616 _saveIndex=text.length();
1617 match('*');
1618 text.setLength(_saveIndex);
1619 break;
1620 }
1621 default:
1622 if ((_tokenSet_13.member(LA(1)))) {
1623 {
1624 match(_tokenSet_13);
1625 }
1626 }
1627 else {
1628 if ( _cnt115>=1 ) { break _loop115; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1629 }
1630 }
1631 _cnt115++;
1632 } while (true);
1633 }
1634 section(new String(text.getBuffer(),_begin,text.length()-_begin), Integer.parseInt(out.getText()));this.inTitle=false;
1635 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1636 _token = makeToken(_ttype);
1637 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1638 }
1639 _returnToken = _token;
1640 }
1641
1642 protected final void mTABLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1643 int _ttype; Token _token=null; int _begin=text.length();
1644 _ttype = TABLE;
1645 int _saveIndex;
1646
1647 _saveIndex=text.length();
1648 match("%[");
1649 text.setLength(_saveIndex);
1650 context.inTable=true; captureText(); target.begin_table();
1651 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1652 _token = makeToken(_ttype);
1653 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1654 }
1655 _returnToken = _token;
1656 }
1657
1658 protected final void mEND_TABLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1659 int _ttype; Token _token=null; int _begin=text.length();
1660 _ttype = END_TABLE;
1661 int _saveIndex;
1662
1663 _saveIndex=text.length();
1664 match("%]");
1665 text.setLength(_saveIndex);
1666 context.inTable=false; captureText(); target.end_table();
1667 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1668 _token = makeToken(_ttype);
1669 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1670 }
1671 _returnToken = _token;
1672 }
1673
1674 protected final void mINQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1675 int _ttype; Token _token=null; int _begin=text.length();
1676 _ttype = INQUOTE;
1677 int _saveIndex;
1678
1679 _saveIndex=text.length();
1680 match('\\');
1681 text.setLength(_saveIndex);
1682 match('"');
1683 {
1684 _loop96:
1685 do {
1686 if ((_tokenSet_19.member(LA(1))) && (_tokenSet_18.member(LA(2)))) {
1687 {
1688 match(_tokenSet_19);
1689 }
1690 }
1691 else if ((LA(1)=='\n')) {
1692 match('\n');
1693 newline();
1694 }
1695 else {
1696 break _loop96;
1697 }
1698
1699 } while (true);
1700 }
1701 _saveIndex=text.length();
1702 match('\\');
1703 text.setLength(_saveIndex);
1704 match('"');
1705 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1706 _token = makeToken(_ttype);
1707 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1708 }
1709 _returnToken = _token;
1710 }
1711
1712 protected final void mLEVEL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1713 int _ttype; Token _token=null; int _begin=text.length();
1714 _ttype = LEVEL;
1715 int _saveIndex;
1716
1717 {
1718 matchRange('1','4');
1719 }
1720 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1721 _token = makeToken(_ttype);
1722 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1723 }
1724 _returnToken = _token;
1725 }
1726
1727 public final void mCOL_SEP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1728 int _ttype; Token _token=null; int _begin=text.length();
1729 _ttype = COL_SEP;
1730 int _saveIndex;
1731
1732 if (!(context.inTable))
1733 throw new SemanticException("context.inTable");
1734 _saveIndex=text.length();
1735 match('|');
1736 text.setLength(_saveIndex);
1737 captureText(); target.col();
1738 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1739 _token = makeToken(_ttype);
1740 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1741 }
1742 _returnToken = _token;
1743 }
1744
1745 public final void mROW_SEP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1746 int _ttype; Token _token=null; int _begin=text.length();
1747 _ttype = ROW_SEP;
1748 int _saveIndex;
1749
1750 if (!(context.inTable))
1751 throw new SemanticException("context.inTable");
1752 match("----");
1753 captureText(); target.row();
1754 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1755 _token = makeToken(_ttype);
1756 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1757 }
1758 _returnToken = _token;
1759 }
1760
1761 /** The catch-all "else" rule. Anything not matched as a tag, gets
1762 * matched here. The chars are buffered up until the next tag is
1763 * recognized at which point the target.text() method gets the
1764 * text.
1765 */
1766 protected final void mTEXT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1767 int _ttype; Token _token=null; int _begin=text.length();
1768 _ttype = TEXT;
1769 int _saveIndex;
1770 char c = '\0';
1771
1772 if ((LA(1)=='\n') && (LA(2)=='\n')) {
1773 match("\n\n");
1774
1775 newline(); newline(); captureText(); closeAllLists();
1776 target.paragraph();
1777
1778 }
1779 else if ((LA(1)=='\n') && (true)) {
1780 match('\n');
1781 newline(); context.textBetweenMarkup.append('\n');
1782 }
1783 else if ((_tokenSet_6.member(LA(1)))) {
1784 c = LA(1);
1785 matchNot('\n');
1786 context.textBetweenMarkup.append(c);
1787 }
1788 else {
1789 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1790 }
1791
1792 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1793 _token = makeToken(_ttype);
1794 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1795 }
1796 _returnToken = _token;
1797 }
1798
1799 protected final void mWS2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1800 int _ttype; Token _token=null; int _begin=text.length();
1801 _ttype = WS2;
1802 int _saveIndex;
1803
1804 {
1805 int _cnt126=0;
1806 _loop126:
1807 do {
1808 switch ( LA(1)) {
1809 case ' ':
1810 {
1811 _saveIndex=text.length();
1812 match(' ');
1813 text.setLength(_saveIndex);
1814 break;
1815 }
1816 case '\t':
1817 {
1818 _saveIndex=text.length();
1819 match('\t');
1820 text.setLength(_saveIndex);
1821 break;
1822 }
1823 case '\n':
1824 {
1825 _saveIndex=text.length();
1826 match('\n');
1827 text.setLength(_saveIndex);
1828 newline();
1829 break;
1830 }
1831 default:
1832 {
1833 if ( _cnt126>=1 ) { break _loop126; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1834 }
1835 }
1836 _cnt126++;
1837 } while (true);
1838 }
1839 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1840 _token = makeToken(_ttype);
1841 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1842 }
1843 _returnToken = _token;
1844 }
1845
1846
1847 private static final long[] mk_tokenSet_0() {
1848 long[] data = new long[1025];
1849 data[0]=137438953472L;
1850 data[1]=36558761623552L;
1851 return data;
1852 }
1853 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1854 private static final long[] mk_tokenSet_1() {
1855 long[] data = new long[2048];
1856 data[0]=-19791209299976L;
1857 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1858 data[1023]=9223372036854775807L;
1859 return data;
1860 }
1861 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1862 private static final long[] mk_tokenSet_2() {
1863 long[] data = new long[2048];
1864 data[0]=-4398046511112L;
1865 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1866 data[1023]=9223372036854775807L;
1867 return data;
1868 }
1869 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1870 private static final long[] mk_tokenSet_3() {
1871 long[] data = new long[2048];
1872 data[0]=-8L;
1873 data[1]=-2147483649L;
1874 for (int i = 2; i<=1022; i++) { data[i]=-1L; }
1875 data[1023]=9223372036854775807L;
1876 return data;
1877 }
1878 public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1879 private static final long[] mk_tokenSet_4() {
1880 long[] data = new long[2048];
1881 data[0]=-2305843009213693960L;
1882 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1883 data[1023]=9223372036854775807L;
1884 return data;
1885 }
1886 public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1887 private static final long[] mk_tokenSet_5() {
1888 long[] data = new long[1025];
1889 data[1]=576460745995190270L;
1890 return data;
1891 }
1892 public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1893 private static final long[] mk_tokenSet_6() {
1894 long[] data = new long[2048];
1895 data[0]=-1032L;
1896 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1897 data[1023]=9223372036854775807L;
1898 return data;
1899 }
1900 public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1901 private static final long[] mk_tokenSet_7() {
1902 long[] data = new long[1025];
1903 data[0]=1152956830712856576L;
1904 data[1]=140737488355328L;
1905 return data;
1906 }
1907 public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
1908 private static final long[] mk_tokenSet_8() {
1909 long[] data = new long[1025];
1910 data[0]=1161365895642087424L;
1911 data[1]=671088640L;
1912 return data;
1913 }
1914 public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
1915 private static final long[] mk_tokenSet_9() {
1916 long[] data = new long[2048];
1917 data[0]=-34359739400L;
1918 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1919 data[1023]=9223372036854775807L;
1920 return data;
1921 }
1922 public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
1923 private static final long[] mk_tokenSet_10() {
1924 long[] data = new long[2048];
1925 data[0]=-4294968328L;
1926 data[1]=-268435457L;
1927 for (int i = 2; i<=1022; i++) { data[i]=-1L; }
1928 data[1023]=9223372036854775807L;
1929 return data;
1930 }
1931 public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10());
1932 private static final long[] mk_tokenSet_11() {
1933 long[] data = new long[1025];
1934 data[0]=19791209299968L;
1935 data[1]=576460743847706622L;
1936 return data;
1937 }
1938 public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11());
1939 private static final long[] mk_tokenSet_12() {
1940 long[] data = new long[2048];
1941 data[0]=-2199023255560L;
1942 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1943 data[1023]=9223372036854775807L;
1944 return data;
1945 }
1946 public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12());
1947 private static final long[] mk_tokenSet_13() {
1948 long[] data = new long[2048];
1949 data[0]=-2305847441619944456L;
1950 data[1]=-2147483649L;
1951 for (int i = 2; i<=1022; i++) { data[i]=-1L; }
1952 data[1023]=9223372036854775807L;
1953 return data;
1954 }
1955 public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13());
1956 private static final long[] mk_tokenSet_14() {
1957 long[] data = new long[2048];
1958 data[0]=-2305882763430986760L;
1959 data[1]=-2147483649L;
1960 for (int i = 2; i<=1022; i++) { data[i]=-1L; }
1961 data[1023]=9223372036854775807L;
1962 return data;
1963 }
1964 public static final BitSet _tokenSet_14 = new BitSet(mk_tokenSet_14());
1965 private static final long[] mk_tokenSet_15() {
1966 long[] data = new long[2048];
1967 data[0]=-3298534883336L;
1968 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1969 data[1023]=9223372036854775807L;
1970 return data;
1971 }
1972 public static final BitSet _tokenSet_15 = new BitSet(mk_tokenSet_15());
1973 private static final long[] mk_tokenSet_16() {
1974 long[] data = new long[1025];
1975 data[0]=1152921508901815808L;
1976 return data;
1977 }
1978 public static final BitSet _tokenSet_16 = new BitSet(mk_tokenSet_16());
1979 private static final long[] mk_tokenSet_17() {
1980 long[] data = new long[2048];
1981 data[0]=-19945828122632L;
1982 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1983 data[1023]=9223372036854775807L;
1984 return data;
1985 }
1986 public static final BitSet _tokenSet_17 = new BitSet(mk_tokenSet_17());
1987 private static final long[] mk_tokenSet_18() {
1988 long[] data = new long[2048];
1989 data[0]=-17179869192L;
1990 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1991 data[1023]=9223372036854775807L;
1992 return data;
1993 }
1994 public static final BitSet _tokenSet_18 = new BitSet(mk_tokenSet_18());
1995 private static final long[] mk_tokenSet_19() {
1996 long[] data = new long[2048];
1997 data[0]=-17179870216L;
1998 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1999 data[1023]=9223372036854775807L;
2000 return data;
2001 }
2002 public static final BitSet _tokenSet_19 = new BitSet(mk_tokenSet_19());
2003
2004 }
|