0001 /* Generated By:JJTree&JavaCC: Do not edit this line. YamParser.java */
0002 package gate.yam.parse;
0003
0004 import java.io.*;
0005 import java.net.*;
0006 import java.util.*;
0007 import org.apache.log4j.Logger;
0008 import gate.util.*;
0009 import gate.yam.*;
0010
0011 /**
0012 * A parser for YAM.
0013 * @author Hamish Cunningham
0014 */
0015 public class YamParser/*@bgen(jjtree)*/implements YamParserTreeConstants, YamParserConstants {/*@bgen(jjtree)*/
0016 protected JJTYamParserState jjtree = new JJTYamParserState();/**
0017 * Perform parsing, and handle errors not dealt with in the grammar.
0018 */
0019 public YamParseTree parse() throws GateException {
0020 return parse(false, false, 0, doIncludes);
0021 } // parse()
0022
0023 /**
0024 * Perform parsing, and handle errors not dealt with in the grammar.
0025 * @param titleIsHeading
0026 * When we're including a file, the title is treated as a heading.
0027 * @param ignoreTitle
0028 * When we're recovering from an error don't look for a title.
0029 * @param headingIncrement
0030 * How much to increment heading levels (in an included file).
0031 * @param doIncludes
0032 * Should we process included files?
0033 */
0034 public YamParseTree parse(
0035 boolean titleIsHeading, boolean ignoreTitle, int headingIncrement,
0036 boolean doIncludes
0037 ) throws GateException {
0038 if(ioHandler == null) throw new GateException("parser lacks an IOHandler");
0039 this.ignoreTitle = ignoreTitle;
0040 this.titleIsHeading = titleIsHeading;
0041 this.headingIncrement = headingIncrement;
0042 this.doIncludes = doIncludes;
0043
0044 // handle errors
0045 try {
0046 YamDocument();
0047 } catch(ParseException e) {
0048 // read all the tokens into a list, setting before/after pointers
0049 // to where the error occurred (the EOF token is not added)
0050 List tokenList = new ArrayList();
0051 int beforeErrorPointer = 0, afterErrorPointer = 0, i = 0;
0052 if(firstToken == null)
0053 throw new GateException("first token null while processing:\n" + e);
0054 token = firstToken;
0055 do {
0056 tokenList.add(token);
0057 if(token == e.currentToken) beforeErrorPointer = afterErrorPointer = i;
0058 i++;
0059 } while( (token=getNextToken()).kind != EOF);
0060 if(i != tokenList.size())
0061 throw new GateException("tokenList is the wrong size");
0062
0063 // move the before error pointer to a sensible place
0064 if(beforeErrorPointer > 0) {
0065 Token t;
0066 do {
0067 t = (Token) tokenList.get(--beforeErrorPointer);
0068 } while(t.kind != sep && beforeErrorPointer > 0);
0069 }
0070
0071 // move the after error pointer to a sensible place
0072 if((afterErrorPointer + 1) < tokenList.size()) {
0073 Token t;
0074 do {
0075 t = (Token) tokenList.get(++afterErrorPointer);
0076 } while(t.kind != sep && afterErrorPointer + 1 < tokenList.size());
0077 }
0078
0079 // construct readers for the before and after error portions, and a
0080 // string for the error itself
0081 StringBuffer preError = new StringBuffer(); // before the error
0082 Token t;
0083 for(i = 0; i<beforeErrorPointer; i++) {
0084 t = (Token) tokenList.get(i);
0085 preError.append((t.image == null) ? "" : t.image);
0086 }
0087 Reader preErrorReader = new StringReader(preError.toString());
0088
0089 StringBuffer error = new StringBuffer(); // the error itself
0090 t = (Token) tokenList.get(i); // remember...
0091 int beginLine = t.beginLine; // ...where...
0092 int beginColumn = t.beginColumn; // ...it started
0093 for( ; i<afterErrorPointer; i++) {
0094 t = (Token) tokenList.get(i);
0095 error.append((t.image == null) ? "" : t.image);
0096 }
0097 int endLine = t.endLine; // remember where...
0098 int endColumn = t.endColumn; // ...it ended
0099
0100 StringBuffer postError = new StringBuffer(); // after the error
0101 for(int end = tokenList.size(); i<end; i++) {
0102 t = (Token) tokenList.get(i);
0103 postError.append((t.image == null) ? "" : t.image);
0104 }
0105 Reader postErrorReader = new StringReader(postError.toString());
0106
0107 // print out all this stuff to check it
0108 //Out.prln(">>>preError>>>" + preError.toString() + "<<<preError<<<");
0109 //Out.prln(">>>error>>>" + error.toString() + "<<<error<<<");
0110 //Out.prln(">>>postError>>>" + postError.toString() + "<<<postError<<<");
0111 //Out.prln(e);
0112
0113 // create and store an error in errorlist
0114 // Out.prln("parse METHOD CAUGHT: " + e.getMessage());
0115 parseTree.getErrors().add(
0116 new ParsingProblem(
0117 beginLine, beginColumn, endLine, endColumn,
0118 e, error.toString(), false
0119 )
0120 );
0121
0122 // parse the pre-error string
0123 YamParseTree preErrorTree;
0124 if(beforeErrorPointer == 0) {
0125 preErrorTree = new YamParseTree();
0126 preErrorTree.rootNode = new ASTYamDocument(JJTYAMDOCUMENT);
0127 } else {
0128 SimpleCharStream stream = new SimpleCharStream(
0129 preErrorReader, firstToken.beginLine, firstToken.beginColumn
0130 );
0131 YamParserTokenManager tokmgr = new YamParserTokenManager(this, stream);
0132 YamParser preErrorParser = new YamParser(tokmgr);
0133 preErrorParser.setIOHandler(ioHandler);
0134 preErrorTree = preErrorParser.parse(false, false, 0, doIncludes);
0135 }
0136
0137 // parse the post-error string
0138 YamParseTree postErrorTree;
0139 if(afterErrorPointer + 1 == tokenList.size()) {
0140 postErrorTree = new YamParseTree();
0141 postErrorTree.rootNode = new ASTYamDocument(JJTYAMDOCUMENT);
0142 } else {
0143 SimpleCharStream stream2 =
0144 new SimpleCharStream(postErrorReader, endLine, endColumn);
0145 YamParserTokenManager tokmgr2 =
0146 new YamParserTokenManager(this, stream2);
0147 YamParser postErrorParser = new YamParser(tokmgr2);
0148 postErrorParser.setIOHandler(ioHandler);
0149 postErrorTree = postErrorParser.parse(false, true, 0, doIncludes);
0150 }
0151
0152 // add a Word node for the error stuff to the pre-error tree
0153 ASTWord n = new ASTWord(JJTWORD);
0154 t = new Token();
0155 String errorString = error.toString();
0156 t.image = errorString;
0157 n.first = t;
0158 n.last = t;
0159 n.setBody(errorString);
0160 SimpleNode preErrorRootNode = preErrorTree.rootNode;
0161 preErrorRootNode.jjtAddChild(n, preErrorRootNode.jjtGetNumChildren());
0162
0163 // merge results and set as our current result
0164 preErrorTree.errors.addAll(parseTree.errors);
0165 preErrorTree.warnings.addAll(parseTree.warnings);
0166 preErrorTree.merge(postErrorTree);
0167 parseTree = preErrorTree;
0168 }
0169
0170 return parseTree;
0171 } // parse(boolean,boolean,int,boolean)
0172
0173 /**
0174 * Number of levels to add to headings. May be negative. This is used during
0175 * parsing of included files.
0176 */
0177 int headingIncrement = 0;
0178
0179 /** When we're recovering from an error don't look for a title. */
0180 boolean ignoreTitle = false;
0181
0182 /** Should we warn for single-item lists? */
0183 boolean singleItemListWarning = false;
0184
0185 /** In included files the title is treated as another heading. */
0186 boolean titleIsHeading = false;
0187
0188 /** The parser's IOHandler. */
0189 IOHandler ioHandler;
0190
0191 /** Should we process included files or not? */
0192 boolean doIncludes = true;
0193
0194 /** Should we process included files or not? */
0195 public void setDoIncludes(boolean b) { doIncludes = b; }
0196
0197 /**
0198 * Set the parser's IOHandler. This object is used when the parser
0199 * discovers an include directive.
0200 */
0201 public void setIOHandler(IOHandler ioh) { ioHandler = ioh; }
0202
0203 /**
0204 * The parse tree used to store the parse result, and returned by the
0205 * top-level production.
0206 */
0207 YamParseTree parseTree;
0208
0209 /** The first token of the first successfully constructed node. */
0210 Token firstToken = null;
0211
0212 /** Logger */
0213 static Logger log = Logger.getLogger("gate.yam.parse.YamParser");
0214
0215 /** Override node scope method to store first Token dominated by a node. */
0216 void jjtreeOpenNodeScope(Node n) {
0217 ((SimpleNode) n).setFirstToken(getToken(1));
0218 } // jjtreeOpenNodeScope(Node)
0219
0220 /** Override node scope method to store last Token dominated by a node. */
0221 void jjtreeCloseNodeScope(Node n) {
0222 ((SimpleNode) n).setLastToken(getToken(0));
0223 } // jjtreeCloseNodeScope(Node)
0224
0225 /** List item type. */
0226 final int OL = 0;
0227
0228 /** List item type. */
0229 final int UL = 1;
0230
0231 /** List item type. */
0232 final int NONE = -1;
0233
0234 /** Refactoring the list stuff... */
0235 boolean doListMunging = true;
0236
0237 /** The list stack needs to store OL/UL nodes and their indentation level. */
0238 class ListNodeHolder {
0239 SimpleNode listNode = null;
0240 int indent = 0;
0241 int type = NONE;
0242 public String toString() {
0243 return
0244 "ListNodeHolder: listNode: " + listNode + "; indent: " +
0245 indent + "; type: " + type;
0246 }
0247 } // ListNodeHolder
0248
0249 /** Figure out a list's type from its listItemStart token. */
0250 int getListType(Token t) {
0251 int type = NONE;
0252 String typeChar = t.image.trim();
0253
0254 if(typeChar.equals("-")) {
0255 type = UL;
0256 } else if(typeChar.equals("#")) {
0257 type = OL;
0258 } else { // should never happen!
0259 throw new GateRuntimeException("unknown list type: " + typeChar);
0260 }
0261
0262 return type;
0263 } // getListType(Token)
0264
0265 /**
0266 * Create a new ListNodeHolder with appropriate type and indent.
0267 */
0268 ListNodeHolder createNewList(
0269 int type, int indent, String itemSpacing, SimpleNode itemNode
0270 ) {
0271 ListNodeHolder newList = new ListNodeHolder();
0272 newList.indent = indent;
0273 newList.type = type;
0274
0275 if(type == OL) newList.listNode = new ASTOList(JJTOLIST);
0276 else if(type == UL) newList.listNode = new ASTUList(JJTULIST);
0277 else // should never happen!
0278 throw new GateRuntimeException("unknown list type: " + type);
0279
0280 newList.listNode.setBefore(itemSpacing);
0281 newList.listNode.jjtAddChild((Node) itemNode, 0);
0282 newList.listNode.first = itemNode.first;
0283 newList.listNode.last = itemNode.last; // in case this is the only item
0284 newList.listNode.setEnd(itemSpacing);
0285
0286 return newList;
0287 } // createNewList(int, int)
0288
0289 /** Create a new list and attach it to the parent Unit. */
0290 void createNewListAndAttachToParent(
0291 int itemType, int itemIndent, String itemSpacing, SimpleNode itemNode,
0292 Node parentUnit, Stack<ListNodeHolder> activeListStack
0293 ) {
0294 ListNodeHolder newList =
0295 createNewList(itemType, itemIndent, itemSpacing, itemNode);
0296 parentUnit.jjtAddChild( // attach new list to parent List
0297 (Node) newList.listNode, parentUnit.jjtGetNumChildren()
0298 );
0299 activeListStack.push(newList);
0300 } // createNewListAnd...(int,int,String,SimpleNode,SimpleNode,stack)
0301
0302 /**
0303 * Calculate the correct indentation level for a list from its start token.
0304 */
0305 int calculateListIndentLevel(Token t) {
0306 String typeChar = t.image.trim();
0307
0308 // ditch leading newline
0309 int i = 0;
0310 char c = t.image.charAt(i);
0311 while( c != ' ' && c != '\t' && c != typeChar.charAt(0) )
0312 c = t.image.charAt(++i);
0313 String spacing = t.image.substring(i, t.image.indexOf(typeChar));
0314
0315 return countSpaces(spacing);
0316 } // calculateListIndentLevel(Token)
0317
0318 /** Count spaces, taking account of tabs. */
0319 int countSpaces(String s) { return countSpaces(0, s); }
0320
0321 /** Count spaces, taking account of tabs. Counting starts offset chars in. */
0322 int countSpaces(int offset, String s) {
0323 int indent = 0;
0324 for( ; offset < s.length(); offset++)
0325 if(s.charAt(offset) == '\t') {
0326 indent += 8;
0327 indent -= indent % 8;
0328 } else
0329 indent++;
0330 return indent;
0331 } // countSpaces(int, String)
0332
0333 /** Get the initial spacing preceding a list item from its initial token. */
0334 String getListItemSpacing(Token t) {
0335 String typeChar = t.image.trim();
0336 String spacing = t.image.substring(0, t.image.indexOf(typeChar));
0337 return spacing;
0338 } // getListItemSpacing(Token)
0339
0340 /** Caclulate the arity of a list. */
0341 int getListArity(SimpleNode n) {
0342 int id = n.getId(), children = n.jjtGetNumChildren(), total = 0;
0343 if(id == JJTLIST || id == JJTOLIST || id == JJTULIST)
0344 for(int i=0; i<children; i++)
0345 total += getListArity((SimpleNode) n.jjtGetChild(i));
0346 else if(id == JJTLISTITEM)
0347 total++;
0348 return total;
0349 } // getListArity(SimpleNode)
0350
0351 /** Does the next token contain a space or tab? Used for lists. */
0352 boolean indentedTokenComing() {
0353 String s = getToken(1).image;
0354 return ( s.indexOf(" ") != -1 || s.indexOf("\t") != -1 );
0355 } // indentedTokenComing()
0356
0357 /**
0358 * Fill the body of a verbatim node with its token images, and its after
0359 * string with any trailing space.
0360 */
0361 void fillVerbatimBody(SimpleNode n, Token vstart, Token vend) {
0362 StringBuffer s = new StringBuffer();
0363 Token first = n.getFirstToken();
0364 Token last = n.getLastToken();
0365
0366 while(first != last && first != null && last != null) {
0367 if(first != vstart && first != vend)
0368 s.append(first.image);
0369 else if (first == vend) { // body complete; now collect trailing space
0370 n.setBody(s.toString());
0371 s.setLength(0);
0372 }
0373 first = first.next;
0374 }
0375 if( last != null && (last != vstart && last != vend) )
0376 s.append(last.image);
0377
0378 n.setAfter(s.toString());
0379 } // fillVerbatimBody(SimpleNode, Token, Token)
0380
0381 /** How deeply nested the current include is. */
0382 int includeDepth = 0;
0383
0384 /** How deeply nested the current include is. */
0385 void setIncludeDepth(int i) { includeDepth = i; }
0386
0387 /** Parse an include predicate and add in the resultant parse tree(s). */
0388 void processInclude(SimpleNode includeNode) {
0389 List<String> argsList = (List<String>) includeNode.getArgsList();
0390 if(argsList == null || argsList.size() == 0) return;
0391 if(includeDepth > 1000) return;
0392
0393 // if we're not processing includes, just set up the body and return
0394 if(! doIncludes) {
0395 log.debug("not doing includes...");
0396 StringBuilder buf = new StringBuilder("%include(");
0397 if(argsList.size() == 0) buf.append(" ");
0398 for(String arg : argsList) {
0399 buf.append(arg + ",");
0400 }
0401 buf.setCharAt(buf.length() - 1, ')');
0402 includeNode.setBody(buf.toString());
0403 log.debug("includeNode.getBody() == " + includeNode.getBody());
0404 return;
0405 }
0406
0407 // if first arg is [-][0-9] (a parseable int) then set heading increment
0408 String arg;
0409 arg = (String) argsList.get(0);
0410 int incHeadIncr = 0;
0411 try {
0412 incHeadIncr = Integer.parseInt(arg);
0413 argsList.remove(0);
0414 } catch(NumberFormatException e) {
0415 incHeadIncr = 0;
0416 }
0417
0418 // if next arg is "useTitle" set flag true
0419 boolean useTitle = false;
0420 arg = (String) argsList.get(0);
0421 if(arg.equals("useTitle")) {
0422 useTitle = true;
0423 argsList.remove(0);
0424 }
0425
0426 /* for each other arg:
0427 * use the iohandler to get a reader
0428 * construct a parser: set error behaviour; set iohandler
0429 * parse the include file and get a YPT
0430 * attach the new parse tree to includeNode, and add the headings to pT
0431 */
0432 includeNode.setStart(""); // seed the start in case we need to add errors
0433 for(int i=0; i<argsList.size(); i++) {
0434 arg = (String) argsList.get(i);
0435 parseTree.getIncludes().add(arg); // add to the list of included files
0436
0437 // a reader for the included file
0438 Reader reader = null;
0439 try {
0440 reader = ioHandler.getReaderInContext(arg);
0441 } catch(IOException e) {
0442 parseTree.getIncludes().remove(arg); // rem from list of included files
0443 String warning = "Include: couldn't read " + arg;
0444 includeNode.setStart(includeNode.getStart() + "\n " + warning + "\n");
0445 parseTree.getWarnings().add(
0446 new ParsingProblem(
0447 includeNode.first.beginLine, includeNode.first.beginColumn,
0448 includeNode.last.endLine, includeNode.last.endColumn,
0449 e, warning, false
0450 )
0451 );
0452 continue;
0453 }
0454
0455 // parse and process the included file
0456 try {
0457 YamParser incParser = new YamParser(reader);
0458 incParser.setIOHandler(ioHandler);
0459 incParser.setIncludeDepth(++includeDepth);
0460 YamParseTree incTree =
0461 incParser.parse(useTitle, false, incHeadIncr, doIncludes);
0462 parseTree.getHeadingNodes().addAll(incTree.getHeadingNodes());
0463 includeNode.addChildren(incTree.getRootNode());
0464
0465 // munge all errors/warnings to include the include name
0466 List l;
0467 l = incTree.getWarnings();
0468 for(int j=0; j<l.size(); j++) {
0469 ParsingProblem p = (ParsingProblem) l.get(j);
0470 p.error = "Warning in included file " + arg + ":\n" + p.error;
0471 p.included = true;
0472 parseTree.warnings.add(p);
0473 }
0474 l = incTree.getErrors();
0475 for(int j=0; j<l.size(); j++) {
0476 ParsingProblem p = (ParsingProblem) l.get(j);
0477 p.error = "Error in included file " + arg + ":\n" + p.error;
0478 p.included = true;
0479 parseTree.errors.add(p);
0480 }
0481 } catch(GateException e) {
0482 String warning = "Include: couldn't parse " + arg;
0483 parseTree.getIncludes().remove(arg); // rem from list of included files
0484 includeNode.setStart(includeNode.getStart() + "\n " + warning + "\n");
0485 parseTree.getWarnings().add(
0486 new ParsingProblem(
0487 includeNode.first.beginLine, includeNode.first.beginColumn,
0488 includeNode.last.endLine, includeNode.last.endColumn,
0489 e, warning, true
0490 )
0491 );
0492 continue;
0493 }
0494 } // for each include file
0495
0496 // replace the include node with its children
0497 for(int i=0; i<includeNode.jjtGetNumChildren(); i++)
0498 jjtree.pushNode((SimpleNode) includeNode.jjtGetChild(i));
0499 } // processInclude(SimpleNode, List)
0500
0501 /** Convert a title node to a section heading. */
0502 void convertToSectionHead(SimpleNode titleNode) {
0503 SimpleNode heading = (SimpleNode) new ASTSectionHead(JJTSECTIONHEAD);
0504 heading.addChildren(titleNode);
0505 heading.setBefore(new Integer(1 + headingIncrement).toString());
0506 heading.setFirstToken(titleNode.getFirstToken());
0507 heading.setLastToken(titleNode.getLastToken());
0508 jjtree.pushNode(heading);
0509 parseTree.addHeadingNode(heading);
0510 } // convertToSectionHead(SimpleNode)
0511
0512 /**
0513 * Get the leading spaces for a row node and the start of the first column
0514 * from the row's start token.
0515 */
0516 String[] getRowSpacing(Token t) {
0517 String s = t.image;
0518 String result[] = new String[2];
0519 //Out.prln("rowSpacing input: #" + s + "#");
0520
0521 int i = s.indexOf("[");
0522 if(i != -1) // chop the table start stuff
0523 s = s.substring(++i, s.length());
0524 i = s.lastIndexOf("-");
0525 if(i != -1) // chop the row separator stuff
0526 s = s.substring(++i, s.length());
0527
0528 i = s.indexOf("|");
0529 if(i == -1) { // must be a parsing error about to happen
0530 result[0] = result[1] = "";
0531 } else {
0532 result[0] = s.substring(0, i); // the row before spaces
0533 result[1] = s.substring(++i, s.length()); // the column start spaces
0534 }
0535
0536 //Out.prln("rowSpacing output 0: #" + result[0] + "#");
0537 //Out.prln("rowSpacing output 1: #" + result[1] + "#");
0538 return result;
0539 } // getRowSpacing(Token)
0540
0541 /** Set the start/end spacing on a column node. */
0542 void setColSp(Node n, String[] sa) {
0543 ASTColumn col = (ASTColumn) n;
0544 col.setStart(sa[1]);
0545 col.setEnd(sa[0]);
0546 } // setColSp(Node, String[])}
0547
0548 /**
0549 * Get leading / trailing spaces for a column from the separator token.
0550 * The first array element is the end of the previous column (from before
0551 * the | separator); the second is the start of the new one (after the |).
0552 */
0553 String[] getColSpacing(Token t) {
0554 String[] sa = new String[2];
0555 String s = t.image;
0556 int i = s.indexOf('|');
0557 //Out.prln("s=" + s + "; i=" + i);
0558 sa[0] = s.substring(0, i);
0559 sa[1] = s.substring(i+1, s.length());
0560 //Out.prln("sa[0]=" + sa[0] + "; sa[1]=" + sa[1] +".");
0561 return sa;
0562 } // getColSpacing(Token)
0563
0564 /**
0565 * Returns the length of the trailing spaces on a sep token (the spaces at
0566 * the start of the next line).
0567 */
0568 public int getSepSpacing(Token sep) {
0569 int i = 0;
0570 String s = sep.image;
0571 for(
0572 ;
0573 i < s.length() && ( s.charAt(i) == '\n' || s.charAt(i) == '\r' );
0574 i++
0575 ) ;
0576
0577 return countSpaces(i, s);
0578 } // getSepSpacing(Token)
0579
0580 /** Helper for boolean lookahead in lists. */
0581 boolean nonZero(int i) { return i != 0; }
0582
0583 /** Helper for tables to deal with inadvertant consumption of list starts. */
0584 void pushBackListStart(
0585 StringBuffer image, SimpleCharStream input_stream, Token matchedToken
0586 ) {
0587 int len = image.length();
0588 if(image.charAt(len-1) == '-' || image.charAt(len-1) == '#') {
0589 int tableSepOffset = image.lastIndexOf("|");
0590 input_stream.backup(len - tableSepOffset - 1);
0591 image.setLength(tableSepOffset + 1);
0592 matchedToken.image = image.toString();
0593 }
0594 }
0595
0596 /** Top-level parser goal. */
0597 final public void YamDocument() throws ParseException {
0598 /*@bgen(jjtree) YamDocument */
0599 ASTYamDocument jjtn000 = new ASTYamDocument(JJTYAMDOCUMENT);
0600 boolean jjtc000 = true;
0601 jjtree.openNodeScope(jjtn000);
0602 jjtreeOpenNodeScope(jjtn000);parseTree = new YamParseTree();
0603 parseTree.setRootNode(jjtn000);
0604 if(firstToken == null) firstToken = getToken(1);
0605 try {
0606 if (jj_2_1(2147483647) && (! ignoreTitle)) {
0607 Title();
0608 SimpleNode titleNode = (SimpleNode) jjtree.popNode();
0609 if(titleIsHeading)
0610 convertToSectionHead(titleNode);
0611 else
0612 parseTree.setTitleNode(titleNode);
0613 } else {
0614 ;
0615 }
0616 label_1:
0617 while (true) {
0618 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0619 case sep:
0620 ;
0621 break;
0622 default:
0623 jj_la1[0] = jj_gen;
0624 break label_1;
0625 }
0626 Sep();
0627 }
0628 label_2:
0629 while (true) {
0630 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0631 case bold:
0632 case tt:
0633 case it:
0634 case under:
0635 case quote:
0636 case amp:
0637 case lt:
0638 case escape:
0639 case tableStart:
0640 case sectionLevel:
0641 case listItemStart:
0642 case verbStart:
0643 case hr:
0644 case br:
0645 case nbsp:
0646 case contents:
0647 case plain:
0648 case urlPlainStart:
0649 case urlPercentStart:
0650 case predStart:
0651 case anchorStart:
0652 ;
0653 break;
0654 default:
0655 jj_la1[1] = jj_gen;
0656 break label_2;
0657 }
0658 Unit();
0659 }
0660 jj_consume_token(0);
0661 } catch (Throwable jjte000) {
0662 if (jjtc000) {
0663 jjtree.clearNodeScope(jjtn000);
0664 jjtc000 = false;
0665 } else {
0666 jjtree.popNode();
0667 }
0668 if (jjte000 instanceof RuntimeException) {
0669 {if (true) throw (RuntimeException)jjte000;}
0670 }
0671 if (jjte000 instanceof ParseException) {
0672 {if (true) throw (ParseException)jjte000;}
0673 }
0674 {if (true) throw (Error)jjte000;}
0675 } finally {
0676 if (jjtc000) {
0677 jjtree.closeNodeScope(jjtn000, true);
0678 jjtreeCloseNodeScope(jjtn000);
0679 }
0680 }
0681 }
0682
0683 final public int Sep() throws ParseException {
0684 /*@bgen(jjtree) Sep */
0685 ASTSep jjtn000 = new ASTSep(JJTSEP);
0686 boolean jjtc000 = true;
0687 jjtree.openNodeScope(jjtn000);
0688 jjtreeOpenNodeScope(jjtn000);Token t;
0689 try {
0690 t = jj_consume_token(sep);
0691 jjtree.closeNodeScope(jjtn000, true);
0692 jjtc000 = false;
0693 jjtreeCloseNodeScope(jjtn000);
0694 jjtn000.setBody(t.image); {if (true) return getSepSpacing(t);}
0695 } finally {
0696 if (jjtc000) {
0697 jjtree.closeNodeScope(jjtn000, true);
0698 jjtreeCloseNodeScope(jjtn000);
0699 }
0700 }
0701 throw new Error("Missing return statement in function");
0702 }
0703
0704 final public void Title() throws ParseException {
0705 /*@bgen(jjtree) Title */
0706 ASTTitle jjtn000 = new ASTTitle(JJTTITLE);
0707 boolean jjtc000 = true;
0708 jjtree.openNodeScope(jjtn000);
0709 jjtreeOpenNodeScope(jjtn000);
0710 try {
0711 label_3:
0712 while (true) {
0713 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0714 case sp:
0715 ;
0716 break;
0717 default:
0718 jj_la1[2] = jj_gen;
0719 break label_3;
0720 }
0721 jj_consume_token(sp);
0722 }
0723 Text();
0724 label_4:
0725 while (true) {
0726 if (jj_2_2(2)) {
0727 ;
0728 } else {
0729 break label_4;
0730 }
0731 Sep();
0732 Text();
0733 }
0734 } catch (Throwable jjte000) {
0735 if (jjtc000) {
0736 jjtree.clearNodeScope(jjtn000);
0737 jjtc000 = false;
0738 } else {
0739 jjtree.popNode();
0740 }
0741 if (jjte000 instanceof RuntimeException) {
0742 {if (true) throw (RuntimeException)jjte000;}
0743 }
0744 if (jjte000 instanceof ParseException) {
0745 {if (true) throw (ParseException)jjte000;}
0746 }
0747 {if (true) throw (Error)jjte000;}
0748 } finally {
0749 if (jjtc000) {
0750 jjtree.closeNodeScope(jjtn000, true);
0751 jjtreeCloseNodeScope(jjtn000);
0752 }
0753 }
0754 }
0755
0756 final public void Text() throws ParseException {
0757 /*@bgen(jjtree) Text */
0758 ASTText jjtn000 = new ASTText(JJTTEXT);
0759 boolean jjtc000 = true;
0760 jjtree.openNodeScope(jjtn000);
0761 jjtreeOpenNodeScope(jjtn000);Token t;
0762 StringBuffer spImage = new StringBuffer();
0763 try {
0764 label_5:
0765 while (true) {
0766 Word();
0767 label_6:
0768 while (true) {
0769 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0770 case sp:
0771 ;
0772 break;
0773 default:
0774 jj_la1[3] = jj_gen;
0775 break label_6;
0776 }
0777 t = jj_consume_token(sp);
0778 spImage.append(t.image);
0779 }
0780 // attach the spaces after the word to the word's node
0781 SimpleNode wordNode = (SimpleNode) jjtree.peekNode();
0782 wordNode.setEnd(spImage.toString());
0783 spImage.setLength(0);
0784 if (jj_2_3(2)) {
0785 ;
0786 } else {
0787 break label_5;
0788 }
0789 }
0790 } catch (Throwable jjte000) {
0791 if (jjtc000) {
0792 jjtree.clearNodeScope(jjtn000);
0793 jjtc000 = false;
0794 } else {
0795 jjtree.popNode();
0796 }
0797 if (jjte000 instanceof RuntimeException) {
0798 {if (true) throw (RuntimeException)jjte000;}
0799 }
0800 if (jjte000 instanceof ParseException) {
0801 {if (true) throw (ParseException)jjte000;}
0802 }
0803 {if (true) throw (Error)jjte000;}
0804 } finally {
0805 if (jjtc000) {
0806 jjtree.closeNodeScope(jjtn000, true);
0807 jjtreeCloseNodeScope(jjtn000);
0808 }
0809 }
0810 }
0811
0812 final public void Verbatim() throws ParseException {
0813 /*@bgen(jjtree) Verbatim */
0814 ASTVerbatim jjtn000 = new ASTVerbatim(JJTVERBATIM);
0815 boolean jjtc000 = true;
0816 jjtree.openNodeScope(jjtn000);
0817 jjtreeOpenNodeScope(jjtn000);Token vstart, vend;
0818 try {
0819 vstart = jj_consume_token(verbStart);
0820 label_7:
0821 while (true) {
0822 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0823 case verbEscape:
0824 case verbAny:
0825 ;
0826 break;
0827 default:
0828 jj_la1[4] = jj_gen;
0829 break label_7;
0830 }
0831 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0832 case verbEscape:
0833 jj_consume_token(verbEscape);
0834 break;
0835 case verbAny:
0836 jj_consume_token(verbAny);
0837 break;
0838 default:
0839 jj_la1[5] = jj_gen;
0840 jj_consume_token(-1);
0841 throw new ParseException();
0842 }
0843 }
0844 vend = jj_consume_token(verbEnd);
0845 label_8:
0846 while (true) {
0847 if (jj_2_4(2147483647)) {
0848 ;
0849 } else {
0850 break label_8;
0851 }
0852 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0853 case sp:
0854 jj_consume_token(sp);
0855 break;
0856 case sep:
0857 Sep();
0858 break;
0859 default:
0860 jj_la1[6] = jj_gen;
0861 jj_consume_token(-1);
0862 throw new ParseException();
0863 }
0864 }
0865 jjtree.closeNodeScope(jjtn000, true);
0866 jjtc000 = false;
0867 jjtreeCloseNodeScope(jjtn000);
0868 fillVerbatimBody(jjtn000, vstart, vend);
0869 } catch (Throwable jjte000) {
0870 if (jjtc000) {
0871 jjtree.clearNodeScope(jjtn000);
0872 jjtc000 = false;
0873 } else {
0874 jjtree.popNode();
0875 }
0876 if (jjte000 instanceof RuntimeException) {
0877 {if (true) throw (RuntimeException)jjte000;}
0878 }
0879 if (jjte000 instanceof ParseException) {
0880 {if (true) throw (ParseException)jjte000;}
0881 }
0882 {if (true) throw (Error)jjte000;}
0883 } finally {
0884 if (jjtc000) {
0885 jjtree.closeNodeScope(jjtn000, true);
0886 jjtreeCloseNodeScope(jjtn000);
0887 }
0888 }
0889 }
0890
0891 final public void Word() throws ParseException {
0892 /*@bgen(jjtree) Word */
0893 ASTWord jjtn000 = new ASTWord(JJTWORD);
0894 boolean jjtc000 = true;
0895 jjtree.openNodeScope(jjtn000);
0896 jjtreeOpenNodeScope(jjtn000);
0897 try {
0898 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
0899 case escape:
0900 Escape();
0901 break;
0902 case amp:
0903 case lt:
0904 TargetControl();
0905 break;
0906 case plain:
0907 Plain();
0908 break;
0909 case hr:
0910 Hr();
0911 break;
0912 case urlPlainStart:
0913 case urlPercentStart:
0914 Url();
0915 break;
0916 case anchorStart:
0917 Anchor();
0918 break;
0919 case br:
0920 Br();
0921 break;
0922 case nbsp:
0923 Nbsp();
0924 break;
0925 case predStart:
0926 Predicate();
0927 break;
0928 case bold:
0929 case tt:
0930 case it:
0931 case under:
0932 case quote:
0933 Control();
0934 break;
0935 default:
0936 jj_la1[7] = jj_gen;
0937 jj_consume_token(-1);
0938 throw new ParseException();
0939 }
0940 } catch (Throwable jjte000) {
0941 if (jjtc000) {
0942 jjtree.clearNodeScope(jjtn000);
0943 jjtc000 = false;
0944 } else {
0945 jjtree.popNode();
0946 }
0947 if (jjte000 instanceof RuntimeException) {
0948 {if (true) throw (RuntimeException)jjte000;}
0949 }
0950 if (jjte000 instanceof ParseException) {
0951 {if (true) throw (ParseException)jjte000;}
0952 }
0953 {if (true) throw (Error)jjte000;}
0954 } finally {
0955 if (jjtc000) {
0956 jjtree.closeNodeScope(jjtn000, true);
0957 jjtreeCloseNodeScope(jjtn000);
0958 }
0959 }
0960 }
0961
0962 final public void Escape() throws ParseException {
0963 /*@bgen(jjtree) Escape */
0964 ASTEscape jjtn000 = new ASTEscape(JJTESCAPE);
0965 boolean jjtc000 = true;
0966 jjtree.openNodeScope(jjtn000);
0967 jjtreeOpenNodeScope(jjtn000);Token t;
0968 try {
0969 t = jj_consume_token(escape);
0970 jjtree.closeNodeScope(jjtn000, true);
0971 jjtc000 = false;
0972 jjtreeCloseNodeScope(jjtn000);
0973 jjtn000.setBody(t.image.substring(1, 2));
0974 } finally {
0975 if (jjtc000) {
0976 jjtree.closeNodeScope(jjtn000, true);
0977 jjtreeCloseNodeScope(jjtn000);
0978 }
0979 }
0980 }
0981
0982 final public void Plain() throws ParseException {
0983 /*@bgen(jjtree) Plain */
0984 ASTPlain jjtn000 = new ASTPlain(JJTPLAIN);
0985 boolean jjtc000 = true;
0986 jjtree.openNodeScope(jjtn000);
0987 jjtreeOpenNodeScope(jjtn000);Token t;
0988 StringBuffer nodeImage = new StringBuffer();
0989 try {
0990 label_9:
0991 while (true) {
0992 t = jj_consume_token(plain);
0993 nodeImage.append(t.image);
0994 if (jj_2_5(2)) {
0995 ;
0996 } else {
0997 break label_9;
0998 }
0999 }
1000 jjtree.closeNodeScope(jjtn000, true);
1001 jjtc000 = false;
1002 jjtreeCloseNodeScope(jjtn000);
1003 jjtn000.setBody(nodeImage.toString());
1004 } finally {
1005 if (jjtc000) {
1006 jjtree.closeNodeScope(jjtn000, true);
1007 jjtreeCloseNodeScope(jjtn000);
1008 }
1009 }
1010 }
1011
1012 final public void Control() throws ParseException {
1013 /*@bgen(jjtree) Control */
1014 ASTControl jjtn000 = new ASTControl(JJTCONTROL);
1015 boolean jjtc000 = true;
1016 jjtree.openNodeScope(jjtn000);
1017 jjtreeOpenNodeScope(jjtn000);
1018 try {
1019 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1020 case bold:
1021 jj_consume_token(bold);
1022 break;
1023 case tt:
1024 jj_consume_token(tt);
1025 break;
1026 case it:
1027 jj_consume_token(it);
1028 break;
1029 case under:
1030 jj_consume_token(under);
1031 break;
1032 case quote:
1033 jj_consume_token(quote);
1034 break;
1035 default:
1036 jj_la1[8] = jj_gen;
1037 jj_consume_token(-1);
1038 throw new ParseException();
1039 }
1040 } finally {
1041 if (jjtc000) {
1042 jjtree.closeNodeScope(jjtn000, true);
1043 jjtreeCloseNodeScope(jjtn000);
1044 }
1045 }
1046 }
1047
1048 final public void TargetControl() throws ParseException {
1049 /*@bgen(jjtree) TargetControl */
1050 ASTTargetControl jjtn000 = new ASTTargetControl(JJTTARGETCONTROL);
1051 boolean jjtc000 = true;
1052 jjtree.openNodeScope(jjtn000);
1053 jjtreeOpenNodeScope(jjtn000);
1054 try {
1055 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1056 case amp:
1057 jj_consume_token(amp);
1058 break;
1059 case lt:
1060 jj_consume_token(lt);
1061 break;
1062 default:
1063 jj_la1[9] = jj_gen;
1064 jj_consume_token(-1);
1065 throw new ParseException();
1066 }
1067 } finally {
1068 if (jjtc000) {
1069 jjtree.closeNodeScope(jjtn000, true);
1070 jjtreeCloseNodeScope(jjtn000);
1071 }
1072 }
1073 }
1074
1075 final public void Hr() throws ParseException {
1076 /*@bgen(jjtree) Hr */
1077 ASTHr jjtn000 = new ASTHr(JJTHR);
1078 boolean jjtc000 = true;
1079 jjtree.openNodeScope(jjtn000);
1080 jjtreeOpenNodeScope(jjtn000);
1081 try {
1082 jj_consume_token(hr);
1083 } finally {
1084 if (jjtc000) {
1085 jjtree.closeNodeScope(jjtn000, true);
1086 jjtreeCloseNodeScope(jjtn000);
1087 }
1088 }
1089 }
1090
1091 final public void Url() throws ParseException {
1092 /*@bgen(jjtree) Url */
1093 ASTUrl jjtn000 = new ASTUrl(JJTURL);
1094 boolean jjtc000 = true;
1095 jjtree.openNodeScope(jjtn000);
1096 jjtreeOpenNodeScope(jjtn000);Token urlBody, text = null, start = null;
1097 try {
1098 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1099 case urlPercentStart:
1100 jj_consume_token(urlPercentStart);
1101 urlBody = jj_consume_token(urlBodyToRrbrOrComma);
1102 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1103 case urlRrbr:
1104 jj_consume_token(urlRrbr);
1105 break;
1106 case urlText:
1107 text = jj_consume_token(urlText);
1108 jj_consume_token(urlRrbr);
1109 break;
1110 default:
1111 jj_la1[10] = jj_gen;
1112 jj_consume_token(-1);
1113 throw new ParseException();
1114 }
1115 break;
1116 case urlPlainStart:
1117 start = jj_consume_token(urlPlainStart);
1118 urlBody = jj_consume_token(urlBodyToSpace);
1119 break;
1120 default:
1121 jj_la1[11] = jj_gen;
1122 jj_consume_token(-1);
1123 throw new ParseException();
1124 }
1125 jjtree.closeNodeScope(jjtn000, true);
1126 jjtc000 = false;
1127 jjtreeCloseNodeScope(jjtn000);
1128 // remove escapes and set up node start (the url) and body (the text)
1129
1130 // the actual url
1131 StringBuffer theUrl = new StringBuffer();
1132 if(start != null) theUrl.append(start.image);
1133 theUrl.append(urlBody.image.replaceAll("\\\\", ""));
1134 String theUrlText = theUrl.toString();
1135 jjtn000.setStart(theUrlText);
1136
1137 // if the URL is relative add to the tree's links list
1138 log.debug("url = " + theUrlText);
1139 URI uri = null;
1140 try {
1141 uri = new URI(theUrlText);
1142 if(! uri.isAbsolute())
1143 parseTree.getLinks().add(theUrlText); // add to the list of linked files
1144 } catch(URISyntaxException e) {
1145 }
1146
1147 // the link text
1148 if(text != null) {
1149 // remove escapes, remove leading comma, trim
1150 String s = text.image.replaceAll("\\\\", "");
1151 jjtn000.setBody( s.substring(1, s.length()).trim() );
1152 } else // just make the url body the link text
1153 jjtn000.setBody(theUrl.toString());
1154 } finally {
1155 if (jjtc000) {
1156 jjtree.closeNodeScope(jjtn000, true);
1157 jjtreeCloseNodeScope(jjtn000);
1158 }
1159 }
1160 }
1161
1162 final public void Anchor() throws ParseException {
1163 /*@bgen(jjtree) Anchor */
1164 ASTAnchor jjtn000 = new ASTAnchor(JJTANCHOR);
1165 boolean jjtc000 = true;
1166 jjtree.openNodeScope(jjtn000);
1167 jjtreeOpenNodeScope(jjtn000);Token t;
1168 try {
1169 jj_consume_token(anchorStart);
1170 t = jj_consume_token(anchorBody);
1171 jjtree.closeNodeScope(jjtn000, true);
1172 jjtc000 = false;
1173 jjtreeCloseNodeScope(jjtn000);
1174 jjtn000.setStart(t.image);
1175 } finally {
1176 if (jjtc000) {
1177 jjtree.closeNodeScope(jjtn000, true);
1178 jjtreeCloseNodeScope(jjtn000);
1179 }
1180 }
1181 }
1182
1183 final public void Br() throws ParseException {
1184 /*@bgen(jjtree) Br */
1185 ASTBr jjtn000 = new ASTBr(JJTBR);
1186 boolean jjtc000 = true;
1187 jjtree.openNodeScope(jjtn000);
1188 jjtreeOpenNodeScope(jjtn000);
1189 try {
1190 jj_consume_token(br);
1191 } finally {
1192 if (jjtc000) {
1193 jjtree.closeNodeScope(jjtn000, true);
1194 jjtreeCloseNodeScope(jjtn000);
1195 }
1196 }
1197 }
1198
1199 final public void Nbsp() throws ParseException {
1200 /*@bgen(jjtree) Nbsp */
1201 ASTNbsp jjtn000 = new ASTNbsp(JJTNBSP);
1202 boolean jjtc000 = true;
1203 jjtree.openNodeScope(jjtn000);
1204 jjtreeOpenNodeScope(jjtn000);
1205 try {
1206 jj_consume_token(nbsp);
1207 } finally {
1208 if (jjtc000) {
1209 jjtree.closeNodeScope(jjtn000, true);
1210 jjtreeCloseNodeScope(jjtn000);
1211 }
1212 }
1213 }
1214
1215 final public void Unit() throws ParseException {
1216 /*@bgen(jjtree) Unit */
1217 ASTUnit jjtn000 = new ASTUnit(JJTUNIT);
1218 boolean jjtc000 = true;
1219 jjtree.openNodeScope(jjtn000);
1220 jjtreeOpenNodeScope(jjtn000);
1221 try {
1222 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1223 case sectionLevel:
1224 SectionHead();
1225 break;
1226 case contents:
1227 Contents();
1228 break;
1229 case bold:
1230 case tt:
1231 case it:
1232 case under:
1233 case quote:
1234 case amp:
1235 case lt:
1236 case escape:
1237 case hr:
1238 case br:
1239 case nbsp:
1240 case plain:
1241 case urlPlainStart:
1242 case urlPercentStart:
1243 case predStart:
1244 case anchorStart:
1245 Paragraph();
1246 break;
1247 case listItemStart:
1248 List();
1249 break;
1250 case tableStart:
1251 Table();
1252 break;
1253 case verbStart:
1254 Verbatim();
1255 break;
1256 default:
1257 jj_la1[12] = jj_gen;
1258 jj_consume_token(-1);
1259 throw new ParseException();
1260 }
1261 label_10:
1262 while (true) {
1263 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1264 case sep:
1265 ;
1266 break;
1267 default:
1268 jj_la1[13] = jj_gen;
1269 break label_10;
1270 }
1271 Sep();
1272 }
1273 } catch (Throwable jjte000) {
1274 if (jjtc000) {
1275 jjtree.clearNodeScope(jjtn000);
1276 jjtc000 = false;
1277 } else {
1278 jjtree.popNode();
1279 }
1280 if (jjte000 instanceof RuntimeException) {
1281 {if (true) throw (RuntimeException)jjte000;}
1282 }
1283 if (jjte000 instanceof ParseException) {
1284 {if (true) throw (ParseException)jjte000;}
1285 }
1286 {if (true) throw (Error)jjte000;}
1287 } finally {
1288 if (jjtc000) {
1289 jjtree.closeNodeScope(jjtn000, true);
1290 jjtreeCloseNodeScope(jjtn000);
1291 }
1292 }
1293 }
1294
1295 final public void SectionHead() throws ParseException {
1296 /*@bgen(jjtree) SectionHead */
1297 ASTSectionHead jjtn000 = new ASTSectionHead(JJTSECTIONHEAD);
1298 boolean jjtc000 = true;
1299 jjtree.openNodeScope(jjtn000);
1300 jjtreeOpenNodeScope(jjtn000);Token t;
1301 try {
1302 t = jj_consume_token(sectionLevel);
1303 if (jj_2_6(2)) {
1304 SectionText();
1305 } else {
1306 ;
1307 }
1308 jjtree.closeNodeScope(jjtn000, true);
1309 jjtc000 = false;
1310 jjtreeCloseNodeScope(jjtn000);
1311 // revise the level if nesc
1312 if(headingIncrement != 0) {
1313 int currentLevelNum = Integer.parseInt(t.image.trim().substring(1, 2));
1314 int newLevel = currentLevelNum + headingIncrement;
1315 String newLevelString = new Integer(newLevel).toString();
1316 t.image = t.image.replaceFirst("[0-9]", newLevelString);
1317 }
1318
1319 // add to the parse tree
1320 parseTree.addHeadingNode(jjtn000);
1321 } catch (Throwable jjte000) {
1322 if (jjtc000) {
1323 jjtree.clearNodeScope(jjtn000);
1324 jjtc000 = false;
1325 } else {
1326 jjtree.popNode();
1327 }
1328 if (jjte000 instanceof RuntimeException) {
1329 {if (true) throw (RuntimeException)jjte000;}
1330 }
1331 if (jjte000 instanceof ParseException) {
1332 {if (true) throw (ParseException)jjte000;}
1333 }
1334 {if (true) throw (Error)jjte000;}
1335 } finally {
1336 if (jjtc000) {
1337 jjtree.closeNodeScope(jjtn000, true);
1338 jjtreeCloseNodeScope(jjtn000);
1339 }
1340 }
1341 }
1342
1343 final public void SectionText() throws ParseException {
1344 /*@bgen(jjtree) SectionText */
1345 ASTSectionText jjtn000 = new ASTSectionText(JJTSECTIONTEXT);
1346 boolean jjtc000 = true;
1347 jjtree.openNodeScope(jjtn000);
1348 jjtreeOpenNodeScope(jjtn000);
1349 try {
1350 label_11:
1351 while (true) {
1352 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1353 case sp:
1354 ;
1355 break;
1356 default:
1357 jj_la1[14] = jj_gen;
1358 break label_11;
1359 }
1360 jj_consume_token(sp);
1361 }
1362 Text();
1363 label_12:
1364 while (true) {
1365 if (jj_2_7(2)) {
1366 ;
1367 } else {
1368 break label_12;
1369 }
1370 Sep();
1371 Text();
1372 }
1373 } catch (Throwable jjte000) {
1374 if (jjtc000) {
1375 jjtree.clearNodeScope(jjtn000);
1376 jjtc000 = false;
1377 } else {
1378 jjtree.popNode();
1379 }
1380 if (jjte000 instanceof RuntimeException) {
1381 {if (true) throw (RuntimeException)jjte000;}
1382 }
1383 if (jjte000 instanceof ParseException) {
1384 {if (true) throw (ParseException)jjte000;}
1385 }
1386 {if (true) throw (Error)jjte000;}
1387 } finally {
1388 if (jjtc000) {
1389 jjtree.closeNodeScope(jjtn000, true);
1390 jjtreeCloseNodeScope(jjtn000);
1391 }
1392 }
1393 }
1394
1395 final public void Paragraph() throws ParseException {
1396 /*@bgen(jjtree) Paragraph */
1397 ASTParagraph jjtn000 = new ASTParagraph(JJTPARAGRAPH);
1398 boolean jjtc000 = true;
1399 jjtree.openNodeScope(jjtn000);
1400 jjtreeOpenNodeScope(jjtn000);
1401 try {
1402 Text();
1403 label_13:
1404 while (true) {
1405 if (jj_2_8(2)) {
1406 ;
1407 } else {
1408 break label_13;
1409 }
1410 Sep();
1411 Text();
1412 }
1413 } catch (Throwable jjte000) {
1414 if (jjtc000) {
1415 jjtree.clearNodeScope(jjtn000);
1416 jjtc000 = false;
1417 } else {
1418 jjtree.popNode();
1419 }
1420 if (jjte000 instanceof RuntimeException) {
1421 {if (true) throw (RuntimeException)jjte000;}
1422 }
1423 if (jjte000 instanceof ParseException) {
1424 {if (true) throw (ParseException)jjte000;}
1425 }
1426 {if (true) throw (Error)jjte000;}
1427 } finally {
1428 if (jjtc000) {
1429 jjtree.closeNodeScope(jjtn000, true);
1430 jjtreeCloseNodeScope(jjtn000);
1431 }
1432 }
1433 }
1434
1435 final public void List() throws ParseException {
1436 /*@bgen(jjtree) List */
1437 ASTList jjtn000 = new ASTList(JJTLIST);
1438 boolean jjtc000 = true;
1439 jjtree.openNodeScope(jjtn000);
1440 jjtreeOpenNodeScope(jjtn000);Token itemStartToken;
1441 Stack<ListNodeHolder> activeListStack = new Stack<ListNodeHolder>();
1442 int prevType = NONE;
1443 int prevIndent = -1;
1444 Node parentUnit = jjtn000;
1445 try {
1446 label_14:
1447 while (true) {
1448 ASTListItem jjtn001 = new ASTListItem(JJTLISTITEM);
1449 boolean jjtc001 = true;
1450 jjtree.openNodeScope(jjtn001);
1451 jjtreeOpenNodeScope(jjtn001);
1452 try {
1453 itemStartToken = jj_consume_token(listItemStart);
1454 if (jj_2_9(2)) {
1455 TextOrTable();
1456 } else {
1457 ;
1458 }
1459 label_15:
1460 while (true) {
1461 if (jj_2_10(2) && (indentedTokenComing())) {
1462 ;
1463 } else {
1464 break label_15;
1465 }
1466 Sep();
1467 TextOrTable();
1468 }
1469 jjtree.closeNodeScope(jjtn001, true);
1470 jjtc001 = false;
1471 jjtreeCloseNodeScope(jjtn001);
1472 int itemType = getListType(itemStartToken);
1473 int itemIndent = calculateListIndentLevel(itemStartToken);
1474 SimpleNode itemNode = (SimpleNode) jjtree.popNode(); // the ListItem
1475 String itemSpacing = getListItemSpacing(itemStartToken);
1476 itemNode.setBefore(itemSpacing);
1477
1478 // item same type and indent as previous
1479 if(itemType == prevType && itemIndent == prevIndent) {
1480 // attach item at top stack
1481 SimpleNode n = activeListStack.peek().listNode;
1482 n.jjtAddChild((Node) itemNode, n.jjtGetNumChildren());
1483 n.last = itemNode.last;
1484
1485 // item different type but same indent as previous
1486 } else if(itemType != prevType && itemIndent == prevIndent) {
1487 activeListStack.pop(); // the previous list is now complete
1488
1489 Node parentToAttachTo = parentUnit; // where to attach?
1490 if(activeListStack.size() > 0) // parent is top of active stack
1491 parentToAttachTo = (Node) activeListStack.peek().listNode;
1492
1493 createNewListAndAttachToParent(
1494 itemType, itemIndent, itemSpacing, itemNode,
1495 parentToAttachTo, activeListStack
1496 );
1497
1498 // item indent higher than previous
1499 } else if(itemIndent > prevIndent) {
1500 ListNodeHolder newList =
1501 createNewList(itemType, itemIndent, itemSpacing, itemNode);
1502 if(activeListStack.size() == 0) { // attach new list to parent List
1503 parentUnit.jjtAddChild(
1504 (Node) newList.listNode, parentUnit.jjtGetNumChildren()
1505 );
1506 } else { // attach new list at top of stack
1507 Node n = activeListStack.peek().listNode;
1508 n.jjtAddChild((Node) newList.listNode, n.jjtGetNumChildren());
1509 }
1510 activeListStack.push(newList);
1511
1512 // item indent lower than previous
1513 } else if(itemIndent < prevIndent) {
1514 if(activeListStack.size() > 0)
1515 activeListStack.pop(); // the previous list is now complete
1516
1517 // cycle back up the active list stack looking for a home
1518 while(activeListStack.size() > 0) {
1519 ListNodeHolder l = activeListStack.peek();
1520
1521 if(l.type == itemType && l.indent <= itemIndent) { // attach i here
1522 SimpleNode n = l.listNode;
1523 n.jjtAddChild((Node) itemNode, n.jjtGetNumChildren());
1524 n.last = itemNode.last;
1525 break;
1526
1527 } else if(l.type != itemType && l.indent == itemIndent) { // new l
1528 activeListStack.pop(); // the previous list is now complete
1529 createNewListAndAttachToParent(
1530 itemType, itemIndent, itemSpacing, itemNode,
1531 parentUnit, activeListStack
1532 );
1533 break;
1534
1535 } else { // try higher up the stack
1536 activeListStack.pop();
1537 }
1538 }
1539
1540 // there was no appropriate home
1541 if(activeListStack.size() == 0) {
1542 createNewListAndAttachToParent(
1543 itemType, itemIndent, itemSpacing, itemNode,
1544 parentUnit, activeListStack
1545 );
1546 }
1547
1548 // should never happen!
1549 } else {
1550 {if (true) throw new GateRuntimeException(
1551 "impossible condition during list processing - " +
1552 "please adjust your reality"
1553 );}
1554 }
1555
1556 prevType = itemType;
1557 prevIndent = itemIndent;
1558 } catch (Throwable jjte001) {
1559 if (jjtc001) {
1560 jjtree.clearNodeScope(jjtn001);
1561 jjtc001 = false;
1562 } else {
1563 jjtree.popNode();
1564 }
1565 if (jjte001 instanceof RuntimeException) {
1566 {if (true) throw (RuntimeException)jjte001;}
1567 }
1568 if (jjte001 instanceof ParseException) {
1569 {if (true) throw (ParseException)jjte001;}
1570 }
1571 {if (true) throw (Error)jjte001;}
1572 } finally {
1573 if (jjtc001) {
1574 jjtree.closeNodeScope(jjtn001, true);
1575 jjtreeCloseNodeScope(jjtn001);
1576 }
1577 }
1578 if (jj_2_11(2)) {
1579 ;
1580 } else {
1581 break label_14;
1582 }
1583 }
1584 jjtree.closeNodeScope(jjtn000, true);
1585 jjtc000 = false;
1586 jjtreeCloseNodeScope(jjtn000);
1587 // generate a warning for single-item lists (misplaced -?)
1588 if(doListMunging)
1589 if(singleItemListWarning && getListArity(jjtn000) == 1)
1590 parseTree.warnings.add(
1591 new ParsingProblem(
1592 jjtn000.first.beginLine, jjtn000.first.beginColumn,
1593 jjtn000.last.endLine, jjtn000.last.endColumn,
1594 null, "Single item list - misplaced '-' perhaps?", false
1595 )
1596 );
1597 } catch (Throwable jjte000) {
1598 if (jjtc000) {
1599 jjtree.clearNodeScope(jjtn000);
1600 jjtc000 = false;
1601 } else {
1602 jjtree.popNode();
1603 }
1604 if (jjte000 instanceof RuntimeException) {
1605 {if (true) throw (RuntimeException)jjte000;}
1606 }
1607 if (jjte000 instanceof ParseException) {
1608 {if (true) throw (ParseException)jjte000;}
1609 }
1610 {if (true) throw (Error)jjte000;}
1611 } finally {
1612 if (jjtc000) {
1613 jjtree.closeNodeScope(jjtn000, true);
1614 jjtreeCloseNodeScope(jjtn000);
1615 }
1616 }
1617 }
1618
1619 // we need these dummy productions in order to recognise the list nodes that
1620 // we create from code as legitimate tree nodes
1621 final public void OList() throws ParseException {
1622 /*@bgen(jjtree) OList */
1623 ASTOList jjtn000 = new ASTOList(JJTOLIST);
1624 boolean jjtc000 = true;
1625 jjtree.openNodeScope(jjtn000);
1626 jjtreeOpenNodeScope(jjtn000);
1627 try {
1628 jj_consume_token(dummy);
1629 } finally {
1630 if (jjtc000) {
1631 jjtree.closeNodeScope(jjtn000, true);
1632 jjtreeCloseNodeScope(jjtn000);
1633 }
1634 }
1635 }
1636
1637 final public void UList() throws ParseException {
1638 /*@bgen(jjtree) UList */
1639 ASTUList jjtn000 = new ASTUList(JJTULIST);
1640 boolean jjtc000 = true;
1641 jjtree.openNodeScope(jjtn000);
1642 jjtreeOpenNodeScope(jjtn000);
1643 try {
1644 jj_consume_token(dummy);
1645 } finally {
1646 if (jjtc000) {
1647 jjtree.closeNodeScope(jjtn000, true);
1648 jjtreeCloseNodeScope(jjtn000);
1649 }
1650 }
1651 }
1652
1653 final public void Table() throws ParseException {
1654 /*@bgen(jjtree) Table */
1655 ASTTable jjtn000 = new ASTTable(JJTTABLE);
1656 boolean jjtc000 = true;
1657 jjtree.openNodeScope(jjtn000);
1658 jjtreeOpenNodeScope(jjtn000);Token t;
1659 try {
1660 t = jj_consume_token(tableStart);
1661 // add the leading / trailing space to the table's before/end slots
1662 jjtn000.setBefore(t.image.substring(0, t.image.indexOf('%')));
1663 jjtn000.setEnd("\n");
1664 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1665 case bold:
1666 case tt:
1667 case it:
1668 case under:
1669 case quote:
1670 case amp:
1671 case lt:
1672 case escape:
1673 case tableStart:
1674 case sectionLevel:
1675 case listItemStart:
1676 case tableSep:
1677 case verbStart:
1678 case hr:
1679 case br:
1680 case nbsp:
1681 case contents:
1682 case plain:
1683 case urlPlainStart:
1684 case urlPercentStart:
1685 case predStart:
1686 case anchorStart:
1687 Row(getRowSpacing(t));
1688 label_16:
1689 while (true) {
1690 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1691 case tableRowStart:
1692 ;
1693 break;
1694 default:
1695 jj_la1[15] = jj_gen;
1696 break label_16;
1697 }
1698 t = jj_consume_token(tableRowStart);
1699 Row(getRowSpacing(t));
1700 }
1701 break;
1702 default:
1703 jj_la1[16] = jj_gen;
1704 ;
1705 }
1706 label_17:
1707 while (true) {
1708 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1709 case sep:
1710 ;
1711 break;
1712 default:
1713 jj_la1[17] = jj_gen;
1714 break label_17;
1715 }
1716 Sep();
1717 }
1718 jj_consume_token(tableEnd);
1719 label_18:
1720 while (true) {
1721 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1722 case sp:
1723 ;
1724 break;
1725 default:
1726 jj_la1[18] = jj_gen;
1727 break label_18;
1728 }
1729 Whsp();
1730 }
1731 } catch (Throwable jjte000) {
1732 if (jjtc000) {
1733 jjtree.clearNodeScope(jjtn000);
1734 jjtc000 = false;
1735 } else {
1736 jjtree.popNode();
1737 }
1738 if (jjte000 instanceof RuntimeException) {
1739 {if (true) throw (RuntimeException)jjte000;}
1740 }
1741 if (jjte000 instanceof ParseException) {
1742 {if (true) throw (ParseException)jjte000;}
1743 }
1744 {if (true) throw (Error)jjte000;}
1745 } finally {
1746 if (jjtc000) {
1747 jjtree.closeNodeScope(jjtn000, true);
1748 jjtreeCloseNodeScope(jjtn000);
1749 }
1750 }
1751 }
1752
1753 final public void Row(String[] rowSpacing) throws ParseException {
1754 /*@bgen(jjtree) Row */
1755 ASTRow jjtn000 = new ASTRow(JJTROW);
1756 boolean jjtc000 = true;
1757 jjtree.openNodeScope(jjtn000);
1758 jjtreeOpenNodeScope(jjtn000);jjtn000.setBefore(rowSpacing[0]);
1759 String[] sa; // used differently as tablesep return and setcolsp input
1760 String x, prev = rowSpacing[1];
1761 try {
1762 label_19:
1763 while (true) {
1764 ASTColumn jjtn001 = new ASTColumn(JJTCOLUMN);
1765 boolean jjtc001 = true;
1766 jjtree.openNodeScope(jjtn001);
1767 jjtreeOpenNodeScope(jjtn001);
1768 try {
1769 if (jj_2_12(2147483647)) {
1770 label_20:
1771 while (true) {
1772 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1773 case bold:
1774 case tt:
1775 case it:
1776 case under:
1777 case quote:
1778 case amp:
1779 case lt:
1780 case escape:
1781 case hr:
1782 case br:
1783 case nbsp:
1784 case plain:
1785 case urlPlainStart:
1786 case urlPercentStart:
1787 case predStart:
1788 case anchorStart:
1789 ;
1790 break;
1791 default:
1792 jj_la1[19] = jj_gen;
1793 break label_20;
1794 }
1795 Text();
1796 }
1797 } else if (jj_2_13(2147483647)) {
1798 Text();
1799 Unit();
1800 Text();
1801 } else {
1802 label_21:
1803 while (true) {
1804 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1805 case bold:
1806 case tt:
1807 case it:
1808 case under:
1809 case quote:
1810 case amp:
1811 case lt:
1812 case escape:
1813 case tableStart:
1814 case sectionLevel:
1815 case listItemStart:
1816 case verbStart:
1817 case hr:
1818 case br:
1819 case nbsp:
1820 case contents:
1821 case plain:
1822 case urlPlainStart:
1823 case urlPercentStart:
1824 case predStart:
1825 case anchorStart:
1826 ;
1827 break;
1828 default:
1829 jj_la1[20] = jj_gen;
1830 break label_21;
1831 }
1832 Unit();
1833 }
1834 }
1835 sa = TableSep();
1836 jjtree.closeNodeScope(jjtn001, true);
1837 jjtc001 = false;
1838 jjtreeCloseNodeScope(jjtn001);
1839 x=sa[1]; sa[1]=prev; prev=x; setColSp(jjtn001, sa);
1840 } catch (Throwable jjte001) {
1841 if (jjtc001) {
1842 jjtree.clearNodeScope(jjtn001);
1843 jjtc001 = false;
1844 } else {
1845 jjtree.popNode();
1846 }
1847 if (jjte001 instanceof RuntimeException) {
1848 {if (true) throw (RuntimeException)jjte001;}
1849 }
1850 if (jjte001 instanceof ParseException) {
1851 {if (true) throw (ParseException)jjte001;}
1852 }
1853 {if (true) throw (Error)jjte001;}
1854 } finally {
1855 if (jjtc001) {
1856 jjtree.closeNodeScope(jjtn001, true);
1857 jjtreeCloseNodeScope(jjtn001);
1858 }
1859 }
1860 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1861 case bold:
1862 case tt:
1863 case it:
1864 case under:
1865 case quote:
1866 case amp:
1867 case lt:
1868 case escape:
1869 case tableStart:
1870 case sectionLevel:
1871 case listItemStart:
1872 case tableSep:
1873 case verbStart:
1874 case hr:
1875 case br:
1876 case nbsp:
1877 case contents:
1878 case plain:
1879 case urlPlainStart:
1880 case urlPercentStart:
1881 case predStart:
1882 case anchorStart:
1883 ;
1884 break;
1885 default:
1886 jj_la1[21] = jj_gen;
1887 break label_19;
1888 }
1889 }
1890 } catch (Throwable jjte000) {
1891 if (jjtc000) {
1892 jjtree.clearNodeScope(jjtn000);
1893 jjtc000 = false;
1894 } else {
1895 jjtree.popNode();
1896 }
1897 if (jjte000 instanceof RuntimeException) {
1898 {if (true) throw (RuntimeException)jjte000;}
1899 }
1900 if (jjte000 instanceof ParseException) {
1901 {if (true) throw (ParseException)jjte000;}
1902 }
1903 {if (true) throw (Error)jjte000;}
1904 } finally {
1905 if (jjtc000) {
1906 jjtree.closeNodeScope(jjtn000, true);
1907 jjtreeCloseNodeScope(jjtn000);
1908 }
1909 }
1910 }
1911
1912 final public String[] TableSep() throws ParseException {
1913 /*@bgen(jjtree) TableSep */
1914 ASTTableSep jjtn000 = new ASTTableSep(JJTTABLESEP);
1915 boolean jjtc000 = true;
1916 jjtree.openNodeScope(jjtn000);
1917 jjtreeOpenNodeScope(jjtn000);Token t;
1918 try {
1919 t = jj_consume_token(tableSep);
1920 jjtree.closeNodeScope(jjtn000, true);
1921 jjtc000 = false;
1922 jjtreeCloseNodeScope(jjtn000);
1923 {if (true) return getColSpacing(t);}
1924 } finally {
1925 if (jjtc000) {
1926 jjtree.closeNodeScope(jjtn000, true);
1927 jjtreeCloseNodeScope(jjtn000);
1928 }
1929 }
1930 throw new Error("Missing return statement in function");
1931 }
1932
1933 final public void Whsp() throws ParseException {
1934 /*@bgen(jjtree) Whsp */
1935 ASTWhsp jjtn000 = new ASTWhsp(JJTWHSP);
1936 boolean jjtc000 = true;
1937 jjtree.openNodeScope(jjtn000);
1938 jjtreeOpenNodeScope(jjtn000);Token t;
1939 try {
1940 t = jj_consume_token(sp);
1941 jjtree.closeNodeScope(jjtn000, true);
1942 jjtc000 = false;
1943 jjtreeCloseNodeScope(jjtn000);
1944 jjtn000.setBody(t.image);
1945 } finally {
1946 if (jjtc000) {
1947 jjtree.closeNodeScope(jjtn000, true);
1948 jjtreeCloseNodeScope(jjtn000);
1949 }
1950 }
1951 }
1952
1953 final public void Contents() throws ParseException {
1954 /*@bgen(jjtree) Contents */
1955 ASTContents jjtn000 = new ASTContents(JJTCONTENTS);
1956 boolean jjtc000 = true;
1957 jjtree.openNodeScope(jjtn000);
1958 jjtreeOpenNodeScope(jjtn000);
1959 try {
1960 jj_consume_token(contents);
1961 jjtree.closeNodeScope(jjtn000, true);
1962 jjtc000 = false;
1963 jjtreeCloseNodeScope(jjtn000);
1964 parseTree.setContentsNode(jjtn000);
1965 } finally {
1966 if (jjtc000) {
1967 jjtree.closeNodeScope(jjtn000, true);
1968 jjtreeCloseNodeScope(jjtn000);
1969 }
1970 }
1971 }
1972
1973 final public void Predicate() throws ParseException {
1974 /*@bgen(jjtree) Predicate */
1975 ASTPredicate jjtn000 = new ASTPredicate(JJTPREDICATE);
1976 boolean jjtc000 = true;
1977 jjtree.openNodeScope(jjtn000);
1978 jjtreeOpenNodeScope(jjtn000);Token ps, arg;
1979 String predName, argName;
1980 List argsList = new LinkedList();
1981 try {
1982 ps = jj_consume_token(predStart);
1983 label_22:
1984 while (true) {
1985 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1986 case predArg:
1987 case predArgSep:
1988 ;
1989 break;
1990 default:
1991 jj_la1[22] = jj_gen;
1992 break label_22;
1993 }
1994 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1995 case predArg:
1996 arg = jj_consume_token(predArg);
1997 break;
1998 case predArgSep:
1999 jj_consume_token(predArgSep);
2000 arg = jj_consume_token(predArg);
2001 break;
2002 default:
2003 jj_la1[23] = jj_gen;
2004 jj_consume_token(-1);
2005 throw new ParseException();
2006 }
2007 // remove escapes and leading spaces from the argument
2008 argName = arg.image.trim().replaceAll("\\\\", "");
2009 argsList.add(argName);
2010 }
2011 jj_consume_token(predEnd);
2012 jjtree.closeNodeScope(jjtn000, true);
2013 jjtc000 = false;
2014 jjtreeCloseNodeScope(jjtn000);
2015 // remove the % and the ( from the predicate name
2016 predName = ps.image.substring(1, ps.image.length()-1);
2017 jjtn000.setStart(predName);
2018 jjtn000.setArgsList(argsList);
2019 if(predName.equals("include")) {
2020 if(doIncludes)
2021 processInclude((SimpleNode) jjtree.popNode());
2022 else
2023 processInclude((SimpleNode) jjtree.peekNode());
2024 }
2025 } finally {
2026 if (jjtc000) {
2027 jjtree.closeNodeScope(jjtn000, true);
2028 jjtreeCloseNodeScope(jjtn000);
2029 }
2030 }
2031 }
2032
2033 /*
2034 I'm not sure why, but this generates a lookahead warning which no amount of
2035 lookahead seems to fix...
2036 */
2037 final public void TextOrTable() throws ParseException {
2038 /*@bgen(jjtree) TextOrTable */
2039 ASTTextOrTable jjtn000 = new ASTTextOrTable(JJTTEXTORTABLE);
2040 boolean jjtc000 = true;
2041 jjtree.openNodeScope(jjtn000);
2042 jjtreeOpenNodeScope(jjtn000);
2043 try {
2044 label_23:
2045 while (true) {
2046 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2047 case tableStart:
2048 Table();
2049 break;
2050 case bold:
2051 case tt:
2052 case it:
2053 case under:
2054 case quote:
2055 case amp:
2056 case lt:
2057 case escape:
2058 case hr:
2059 case br:
2060 case nbsp:
2061 case plain:
2062 case urlPlainStart:
2063 case urlPercentStart:
2064 case predStart:
2065 case anchorStart:
2066 Text();
2067 break;
2068 default:
2069 jj_la1[24] = jj_gen;
2070 jj_consume_token(-1);
2071 throw new ParseException();
2072 }
2073 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2074 case bold:
2075 case tt:
2076 case it:
2077 case under:
2078 case quote:
2079 case amp:
2080 case lt:
2081 case escape:
2082 case tableStart:
2083 case hr:
2084 case br:
2085 case nbsp:
2086 case plain:
2087 case urlPlainStart:
2088 case urlPercentStart:
2089 case predStart:
2090 case anchorStart:
2091 ;
2092 break;
2093 default:
2094 jj_la1[25] = jj_gen;
2095 break label_23;
2096 }
2097 }
2098 } catch (Throwable jjte000) {
2099 if (jjtc000) {
2100 jjtree.clearNodeScope(jjtn000);
2101 jjtc000 = false;
2102 } else {
2103 jjtree.popNode();
2104 }
2105 if (jjte000 instanceof RuntimeException) {
2106 {if (true) throw (RuntimeException)jjte000;}
2107 }
2108 if (jjte000 instanceof ParseException) {
2109 {if (true) throw (ParseException)jjte000;}
2110 }
2111 {if (true) throw (Error)jjte000;}
2112 } finally {
2113 if (jjtc000) {
2114 jjtree.closeNodeScope(jjtn000, true);
2115 jjtreeCloseNodeScope(jjtn000);
2116 }
2117 }
2118 }
2119
2120 final private boolean jj_2_1(int xla) {
2121 jj_la = xla; jj_lastpos = jj_scanpos = token;
2122 try { return !jj_3_1(); }
2123 catch(LookaheadSuccess ls) { return true; }
2124 finally { jj_save(0, xla); }
2125 }
2126
2127 final private boolean jj_2_2(int xla) {
2128 jj_la = xla; jj_lastpos = jj_scanpos = token;
2129 try { return !jj_3_2(); }
2130 catch(LookaheadSuccess ls) { return true; }
2131 finally { jj_save(1, xla); }
2132 }
2133
2134 final private boolean jj_2_3(int xla) {
2135 jj_la = xla; jj_lastpos = jj_scanpos = token;
2136 try { return !jj_3_3(); }
2137 catch(LookaheadSuccess ls) { return true; }
2138 finally { jj_save(2, xla); }
2139 }
2140
2141 final private boolean jj_2_4(int xla) {
2142 jj_la = xla; jj_lastpos = jj_scanpos = token;
2143 try { return !jj_3_4(); }
2144 catch(LookaheadSuccess ls) { return true; }
2145 finally { jj_save(3, xla); }
2146 }
2147
2148 final private boolean jj_2_5(int xla) {
2149 jj_la = xla; jj_lastpos = jj_scanpos = token;
2150 try { return !jj_3_5(); }
2151 catch(LookaheadSuccess ls) { return true; }
2152 finally { jj_save(4, xla); }
2153 }
2154
2155 final private boolean jj_2_6(int xla) {
2156 jj_la = xla; jj_lastpos = jj_scanpos = token;
2157 try { return !jj_3_6(); }
2158 catch(LookaheadSuccess ls) { return true; }
2159 finally { jj_save(5, xla); }
2160 }
2161
2162 final private boolean jj_2_7(int xla) {
2163 jj_la = xla; jj_lastpos = jj_scanpos = token;
2164 try { return !jj_3_7(); }
2165 catch(LookaheadSuccess ls) { return true; }
2166 finally { jj_save(6, xla); }
2167 }
2168
2169 final private boolean jj_2_8(int xla) {
2170 jj_la = xla; jj_lastpos = jj_scanpos = token;
2171 try { return !jj_3_8(); }
2172 catch(LookaheadSuccess ls) { return true; }
2173 finally { jj_save(7, xla); }
2174 }
2175
2176 final private boolean jj_2_9(int xla) {
2177 jj_la = xla; jj_lastpos = jj_scanpos = token;
2178 try { return !jj_3_9(); }
2179 catch(LookaheadSuccess ls) { return true; }
2180 finally { jj_save(8, xla); }
2181 }
2182
2183 final private boolean jj_2_10(int xla) {
2184 jj_la = xla; jj_lastpos = jj_scanpos = token;
2185 try { return !jj_3_10(); }
2186 catch(LookaheadSuccess ls) { return true; }
2187 finally { jj_save(9, xla); }
2188 }
2189
2190 final private boolean jj_2_11(int xla) {
2191 jj_la = xla; jj_lastpos = jj_scanpos = token;
2192 try { return !jj_3_11(); }
2193 catch(LookaheadSuccess ls) { return true; }
2194 finally { jj_save(10, xla); }
2195 }
2196
2197 final private boolean jj_2_12(int xla) {
2198 jj_la = xla; jj_lastpos = jj_scanpos = token;
2199 try { return !jj_3_12(); }
2200 catch(LookaheadSuccess ls) { return true; }
2201 finally { jj_save(11, xla); }
2202 }
2203
2204 final private boolean jj_2_13(int xla) {
2205 jj_la = xla; jj_lastpos = jj_scanpos = token;
2206 try { return !jj_3_13(); }
2207 catch(LookaheadSuccess ls) { return true; }
2208 finally { jj_save(12, xla); }
2209 }
2210
2211 final private boolean jj_3_1() {
2212 if (jj_3R_24()) return true;
2213 return false;
2214 }
2215
2216 final private boolean jj_3R_45() {
2217 Token xsp;
2218 xsp = jj_scanpos;
2219 if (jj_3R_63()) {
2220 jj_scanpos = xsp;
2221 if (jj_3R_64()) return true;
2222 }
2223 return false;
2224 }
2225
2226 final private boolean jj_3R_63() {
2227 if (jj_3R_69()) return true;
2228 return false;
2229 }
2230
2231 final private boolean jj_3_10() {
2232 if (jj_3R_25()) return true;
2233 if (jj_3R_31()) return true;
2234 return false;
2235 }
2236
2237 final private boolean jj_3R_50() {
2238 if (jj_3R_69()) return true;
2239 return false;
2240 }
2241
2242 final private boolean jj_3R_31() {
2243 Token xsp;
2244 if (jj_3R_45()) return true;
2245 while (true) {
2246 xsp = jj_scanpos;
2247 if (jj_3R_45()) { jj_scanpos = xsp; break; }
2248 }
2249 return false;
2250 }
2251
2252 final private boolean jj_3R_79() {
2253 if (jj_scan_token(predArgSep)) return true;
2254 if (jj_scan_token(predArg)) return true;
2255 return false;
2256 }
2257
2258 final private boolean jj_3R_49() {
2259 if (jj_3R_68()) return true;
2260 return false;
2261 }
2262
2263 final private boolean jj_3_11() {
2264 if (jj_scan_token(listItemStart)) return true;
2265 Token xsp;
2266 xsp = jj_scanpos;
2267 if (jj_3_9()) jj_scanpos = xsp;
2268 while (true) {
2269 xsp = jj_scanpos;
2270 if (jj_3_10()) { jj_scanpos = xsp; break; }
2271 }
2272 return false;
2273 }
2274
2275 final private boolean jj_3_7() {
2276 if (jj_3R_25()) return true;
2277 if (jj_3R_26()) return true;
2278 return false;
2279 }
2280
2281 final private boolean jj_3R_68() {
2282 Token xsp;
2283 if (jj_3_11()) return true;
2284 while (true) {
2285 xsp = jj_scanpos;
2286 if (jj_3_11()) { jj_scanpos = xsp; break; }
2287 }
2288 return false;
2289 }
2290
2291 final private boolean jj_3_8() {
2292 if (jj_3R_25()) return true;
2293 if (jj_3R_26()) return true;
2294 return false;
2295 }
2296
2297 final private boolean jj_3R_89() {
2298 if (jj_3R_26()) return true;
2299 return false;
2300 }
2301
2302 final private boolean jj_3R_48() {
2303 if (jj_3R_67()) return true;
2304 return false;
2305 }
2306
2307 final private boolean jj_3R_67() {
2308 if (jj_3R_26()) return true;
2309 Token xsp;
2310 while (true) {
2311 xsp = jj_scanpos;
2312 if (jj_3_8()) { jj_scanpos = xsp; break; }
2313 }
2314 return false;
2315 }
2316
2317 final private boolean jj_3R_73() {
2318 Token xsp;
2319 xsp = jj_scanpos;
2320 if (jj_scan_token(39)) {
2321 jj_scanpos = xsp;
2322 if (jj_3R_79()) return true;
2323 }
2324 return false;
2325 }
2326
2327 final private boolean jj_3_6() {
2328 if (jj_3R_30()) return true;
2329 return false;
2330 }
2331
2332 final private boolean jj_3R_30() {
2333 Token xsp;
2334 while (true) {
2335 xsp = jj_scanpos;
2336 if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
2337 }
2338 if (jj_3R_26()) return true;
2339 while (true) {
2340 xsp = jj_scanpos;
2341 if (jj_3_7()) { jj_scanpos = xsp; break; }
2342 }
2343 return false;
2344 }
2345
2346 final private boolean jj_3R_61() {
2347 if (jj_scan_token(predStart)) return true;
2348 Token xsp;
2349 while (true) {
2350 xsp = jj_scanpos;
2351 if (jj_3R_73()) { jj_scanpos = xsp; break; }
2352 }
2353 if (jj_scan_token(predEnd)) return true;
2354 return false;
2355 }
2356
2357 final private boolean jj_3R_47() {
2358 if (jj_3R_66()) return true;
2359 return false;
2360 }
2361
2362 final private boolean jj_3R_66() {
2363 if (jj_scan_token(contents)) return true;
2364 return false;
2365 }
2366
2367 final private boolean jj_3R_82() {
2368 if (jj_scan_token(sp)) return true;
2369 return false;
2370 }
2371
2372 final private boolean jj_3_13() {
2373 if (jj_3R_26()) return true;
2374 if (jj_3R_34()) return true;
2375 if (jj_3R_26()) return true;
2376 return false;
2377 }
2378
2379 final private boolean jj_3R_65() {
2380 if (jj_scan_token(sectionLevel)) return true;
2381 Token xsp;
2382 xsp = jj_scanpos;
2383 if (jj_3_6()) jj_scanpos = xsp;
2384 return false;
2385 }
2386
2387 final private boolean jj_3R_32() {
2388 if (jj_3R_26()) return true;
2389 return false;
2390 }
2391
2392 final private boolean jj_3_12() {
2393 Token xsp;
2394 while (true) {
2395 xsp = jj_scanpos;
2396 if (jj_3R_32()) { jj_scanpos = xsp; break; }
2397 }
2398 if (jj_3R_33()) return true;
2399 return false;
2400 }
2401
2402 final private boolean jj_3R_33() {
2403 if (jj_scan_token(tableSep)) return true;
2404 return false;
2405 }
2406
2407 final private boolean jj_3R_52() {
2408 if (jj_3R_25()) return true;
2409 return false;
2410 }
2411
2412 final private boolean jj_3R_76() {
2413 if (jj_3R_82()) return true;
2414 return false;
2415 }
2416
2417 final private boolean jj_3R_81() {
2418 if (jj_scan_token(tableRowStart)) return true;
2419 if (jj_3R_80()) return true;
2420 return false;
2421 }
2422
2423 final private boolean jj_3R_46() {
2424 if (jj_3R_65()) return true;
2425 return false;
2426 }
2427
2428 final private boolean jj_3R_90() {
2429 if (jj_3R_34()) return true;
2430 return false;
2431 }
2432
2433 final private boolean jj_3R_34() {
2434 Token xsp;
2435 xsp = jj_scanpos;
2436 if (jj_3R_46()) {
2437 jj_scanpos = xsp;
2438 if (jj_3R_47()) {
2439 jj_scanpos = xsp;
2440 if (jj_3R_48()) {
2441 jj_scanpos = xsp;
2442 if (jj_3R_49()) {
2443 jj_scanpos = xsp;
2444 if (jj_3R_50()) {
2445 jj_scanpos = xsp;
2446 if (jj_3R_51()) return true;
2447 }
2448 }
2449 }
2450 }
2451 }
2452 while (true) {
2453 xsp = jj_scanpos;
2454 if (jj_3R_52()) { jj_scanpos = xsp; break; }
2455 }
2456 return false;
2457 }
2458
2459 final private boolean jj_3R_88() {
2460 Token xsp;
2461 while (true) {
2462 xsp = jj_scanpos;
2463 if (jj_3R_90()) { jj_scanpos = xsp; break; }
2464 }
2465 return false;
2466 }
2467
2468 final private boolean jj_3R_87() {
2469 if (jj_3R_26()) return true;
2470 if (jj_3R_34()) return true;
2471 if (jj_3R_26()) return true;
2472 return false;
2473 }
2474
2475 final private boolean jj_3R_86() {
2476 Token xsp;
2477 while (true) {
2478 xsp = jj_scanpos;
2479 if (jj_3R_89()) { jj_scanpos = xsp; break; }
2480 }
2481 return false;
2482 }
2483
2484 final private boolean jj_3R_60() {
2485 if (jj_scan_token(nbsp)) return true;
2486 return false;
2487 }
2488
2489 final private boolean jj_3R_59() {
2490 if (jj_scan_token(br)) return true;
2491 return false;
2492 }
2493
2494 final private boolean jj_3R_84() {
2495 Token xsp;
2496 xsp = jj_scanpos;
2497 if (jj_3R_86()) {
2498 jj_scanpos = xsp;
2499 if (jj_3R_87()) {
2500 jj_scanpos = xsp;
2501 if (jj_3R_88()) return true;
2502 }
2503 }
2504 if (jj_3R_33()) return true;
2505 return false;
2506 }
2507
2508 final private boolean jj_3R_80() {
2509 Token xsp;
2510 if (jj_3R_84()) return true;
2511 while (true) {
2512 xsp = jj_scanpos;
2513 if (jj_3R_84()) { jj_scanpos = xsp; break; }
2514 }
2515 return false;
2516 }
2517
2518 final private boolean jj_3R_58() {
2519 if (jj_scan_token(anchorStart)) return true;
2520 if (jj_scan_token(anchorBody)) return true;
2521 return false;
2522 }
2523
2524 final private boolean jj_3R_75() {
2525 if (jj_3R_25()) return true;
2526 return false;
2527 }
2528
2529 final private boolean jj_3R_74() {
2530 if (jj_3R_80()) return true;
2531 Token xsp;
2532 while (true) {
2533 xsp = jj_scanpos;
2534 if (jj_3R_81()) { jj_scanpos = xsp; break; }
2535 }
2536 return false;
2537 }
2538
2539 final private boolean jj_3R_69() {
2540 if (jj_scan_token(tableStart)) return true;
2541 Token xsp;
2542 xsp = jj_scanpos;
2543 if (jj_3R_74()) jj_scanpos = xsp;
2544 while (true) {
2545 xsp = jj_scanpos;
2546 if (jj_3R_75()) { jj_scanpos = xsp; break; }
2547 }
2548 if (jj_scan_token(tableEnd)) return true;
2549 while (true) {
2550 xsp = jj_scanpos;
2551 if (jj_3R_76()) { jj_scanpos = xsp; break; }
2552 }
2553 return false;
2554 }
2555
2556 final private boolean jj_3R_85() {
2557 if (jj_scan_token(urlText)) return true;
2558 if (jj_scan_token(urlRrbr)) return true;
2559 return false;
2560 }
2561
2562 final private boolean jj_3R_40() {
2563 if (jj_3R_58()) return true;
2564 return false;
2565 }
2566
2567 final private boolean jj_3R_39() {
2568 if (jj_3R_57()) return true;
2569 return false;
2570 }
2571
2572 final private boolean jj_3R_72() {
2573 if (jj_scan_token(urlPlainStart)) return true;
2574 if (jj_scan_token(urlBodyToSpace)) return true;
2575 return false;
2576 }
2577
2578 final private boolean jj_3R_71() {
2579 if (jj_scan_token(urlPercentStart)) return true;
2580 if (jj_scan_token(urlBodyToRrbrOrComma)) return true;
2581 Token xsp;
2582 xsp = jj_scanpos;
2583 if (jj_scan_token(37)) {
2584 jj_scanpos = xsp;
2585 if (jj_3R_85()) return true;
2586 }
2587 return false;
2588 }
2589
2590 final private boolean jj_3R_38() {
2591 if (jj_3R_56()) return true;
2592 return false;
2593 }
2594
2595 final private boolean jj_3R_57() {
2596 Token xsp;
2597 xsp = jj_scanpos;
2598 if (jj_3R_71()) {
2599 jj_scanpos = xsp;
2600 if (jj_3R_72()) return true;
2601 }
2602 return false;
2603 }
2604
2605 final private boolean jj_3R_44() {
2606 if (jj_3R_62()) return true;
2607 return false;
2608 }
2609
2610 final private boolean jj_3R_56() {
2611 if (jj_scan_token(hr)) return true;
2612 return false;
2613 }
2614
2615 final private boolean jj_3R_37() {
2616 if (jj_3R_55()) return true;
2617 return false;
2618 }
2619
2620 final private boolean jj_3R_54() {
2621 Token xsp;
2622 xsp = jj_scanpos;
2623 if (jj_scan_token(10)) {
2624 jj_scanpos = xsp;
2625 if (jj_scan_token(11)) return true;
2626 }
2627 return false;
2628 }
2629
2630 final private boolean jj_3R_83() {
2631 if (jj_3R_25()) return true;
2632 return false;
2633 }
2634
2635 final private boolean jj_3R_62() {
2636 Token xsp;
2637 xsp = jj_scanpos;
2638 if (jj_scan_token(5)) {
2639 jj_scanpos = xsp;
2640 if (jj_scan_token(6)) {
2641 jj_scanpos = xsp;
2642 if (jj_scan_token(7)) {
2643 jj_scanpos = xsp;
2644 if (jj_scan_token(8)) {
2645 jj_scanpos = xsp;
2646 if (jj_scan_token(9)) return true;
2647 }
2648 }
2649 }
2650 }
2651 return false;
2652 }
2653
2654 final private boolean jj_3R_43() {
2655 if (jj_3R_61()) return true;
2656 return false;
2657 }
2658
2659 final private boolean jj_3_5() {
2660 if (jj_scan_token(plain)) return true;
2661 return false;
2662 }
2663
2664 final private boolean jj_3R_55() {
2665 Token xsp;
2666 if (jj_3_5()) return true;
2667 while (true) {
2668 xsp = jj_scanpos;
2669 if (jj_3_5()) { jj_scanpos = xsp; break; }
2670 }
2671 return false;
2672 }
2673
2674 final private boolean jj_3R_36() {
2675 if (jj_3R_54()) return true;
2676 return false;
2677 }
2678
2679 final private boolean jj_3R_42() {
2680 if (jj_3R_60()) return true;
2681 return false;
2682 }
2683
2684 final private boolean jj_3R_29() {
2685 if (jj_3R_25()) return true;
2686 return false;
2687 }
2688
2689 final private boolean jj_3R_53() {
2690 if (jj_scan_token(escape)) return true;
2691 return false;
2692 }
2693
2694 final private boolean jj_3_4() {
2695 Token xsp;
2696 xsp = jj_scanpos;
2697 if (jj_scan_token(1)) {
2698 jj_scanpos = xsp;
2699 if (jj_3R_29()) return true;
2700 }
2701 return false;
2702 }
2703
2704 final private boolean jj_3R_41() {
2705 if (jj_3R_59()) return true;
2706 return false;
2707 }
2708
2709 final private boolean jj_3R_35() {
2710 if (jj_3R_53()) return true;
2711 return false;
2712 }
2713
2714 final private boolean jj_3R_27() {
2715 Token xsp;
2716 xsp = jj_scanpos;
2717 if (jj_3R_35()) {
2718 jj_scanpos = xsp;
2719 if (jj_3R_36()) {
2720 jj_scanpos = xsp;
2721 if (jj_3R_37()) {
2722 jj_scanpos = xsp;
2723 if (jj_3R_38()) {
2724 jj_scanpos = xsp;
2725 if (jj_3R_39()) {
2726 jj_scanpos = xsp;
2727 if (jj_3R_40()) {
2728 jj_scanpos = xsp;
2729 if (jj_3R_41()) {
2730 jj_scanpos = xsp;
2731 if (jj_3R_42()) {
2732 jj_scanpos = xsp;
2733 if (jj_3R_43()) {
2734 jj_scanpos = xsp;
2735 if (jj_3R_44()) return true;
2736 }
2737 }
2738 }
2739 }
2740 }
2741 }
2742 }
2743 }
2744 }
2745 return false;
2746 }
2747
2748 final private boolean jj_3R_78() {
2749 Token xsp;
2750 xsp = jj_scanpos;
2751 if (jj_scan_token(1)) {
2752 jj_scanpos = xsp;
2753 if (jj_3R_83()) return true;
2754 }
2755 return false;
2756 }
2757
2758 final private boolean jj_3R_77() {
2759 Token xsp;
2760 xsp = jj_scanpos;
2761 if (jj_scan_token(28)) {
2762 jj_scanpos = xsp;
2763 if (jj_scan_token(30)) return true;
2764 }
2765 return false;
2766 }
2767
2768 final private boolean jj_3R_70() {
2769 if (jj_scan_token(verbStart)) return true;
2770 Token xsp;
2771 while (true) {
2772 xsp = jj_scanpos;
2773 if (jj_3R_77()) { jj_scanpos = xsp; break; }
2774 }
2775 if (jj_scan_token(verbEnd)) return true;
2776 while (true) {
2777 xsp = jj_scanpos;
2778 if (jj_3R_78()) { jj_scanpos = xsp; break; }
2779 }
2780 return false;
2781 }
2782
2783 final private boolean jj_3_2() {
2784 if (jj_3R_25()) return true;
2785 if (jj_3R_26()) return true;
2786 return false;
2787 }
2788
2789 final private boolean jj_3_9() {
2790 if (jj_3R_31()) return true;
2791 return false;
2792 }
2793
2794 final private boolean jj_3R_28() {
2795 if (jj_scan_token(sp)) return true;
2796 return false;
2797 }
2798
2799 final private boolean jj_3_3() {
2800 if (jj_3R_27()) return true;
2801 Token xsp;
2802 while (true) {
2803 xsp = jj_scanpos;
2804 if (jj_3R_28()) { jj_scanpos = xsp; break; }
2805 }
2806 return false;
2807 }
2808
2809 final private boolean jj_3R_26() {
2810 Token xsp;
2811 if (jj_3_3()) return true;
2812 while (true) {
2813 xsp = jj_scanpos;
2814 if (jj_3_3()) { jj_scanpos = xsp; break; }
2815 }
2816 return false;
2817 }
2818
2819 final private boolean jj_3R_24() {
2820 Token xsp;
2821 while (true) {
2822 xsp = jj_scanpos;
2823 if (jj_scan_token(1)) { jj_scanpos = xsp; break; }
2824 }
2825 if (jj_3R_26()) return true;
2826 while (true) {
2827 xsp = jj_scanpos;
2828 if (jj_3_2()) { jj_scanpos = xsp; break; }
2829 }
2830 return false;
2831 }
2832
2833 final private boolean jj_3R_64() {
2834 if (jj_3R_26()) return true;
2835 return false;
2836 }
2837
2838 final private boolean jj_3R_51() {
2839 if (jj_3R_70()) return true;
2840 return false;
2841 }
2842
2843 final private boolean jj_3R_25() {
2844 if (jj_scan_token(sep)) return true;
2845 return false;
2846 }
2847
2848 public YamParserTokenManager token_source;
2849 SimpleCharStream jj_input_stream;
2850 public Token token, jj_nt;
2851 private int jj_ntk;
2852 private Token jj_scanpos, jj_lastpos;
2853 private int jj_la;
2854 public boolean lookingAhead = false;
2855 private boolean jj_semLA;
2856 private int jj_gen;
2857 final private int[] jj_la1 = new int[26];
2858 static private int[] jj_la1_0;
2859 static private int[] jj_la1_1;
2860 static {
2861 jj_la1_0();
2862 jj_la1_1();
2863 }
2864 private static void jj_la1_0() {
2865 jj_la1_0 = new int[] {0x10,0x8fcaafe0,0x2,0x2,0x50000000,0x50000000,0x12,0x8b802fe0,0x3e0,0xc00,0x0,0x80000000,0x8fcaafe0,0x10,0x2,0x200000,0x8fdaafe0,0x10,0x2,0x8b802fe0,0x8fcaafe0,0x8fdaafe0,0x0,0x0,0x8b80afe0,0x8b80afe0,};
2866 }
2867 private static void jj_la1_1() {
2868 jj_la1_1 = new int[] {0x0,0x441,0x0,0x0,0x0,0x0,0x0,0x441,0x0,0x0,0x30,0x1,0x441,0x0,0x0,0x0,0x441,0x0,0x0,0x441,0x441,0x441,0x180,0x180,0x441,0x441,};
2869 }
2870 final private JJCalls[] jj_2_rtns = new JJCalls[13];
2871 private boolean jj_rescan = false;
2872 private int jj_gc = 0;
2873
2874 public YamParser(java.io.InputStream stream) {
2875 this(stream, null);
2876 }
2877 public YamParser(java.io.InputStream stream, String encoding) {
2878 try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
2879 token_source = new YamParserTokenManager(this, jj_input_stream);
2880 token = new Token();
2881 jj_ntk = -1;
2882 jj_gen = 0;
2883 for (int i = 0; i < 26; i++) jj_la1[i] = -1;
2884 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
2885 }
2886
2887 public void ReInit(java.io.InputStream stream) {
2888 ReInit(stream, null);
2889 }
2890 public void ReInit(java.io.InputStream stream, String encoding) {
2891 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
2892 token_source.ReInit(jj_input_stream);
2893 token = new Token();
2894 jj_ntk = -1;
2895 jjtree.reset();
2896 jj_gen = 0;
2897 for (int i = 0; i < 26; i++) jj_la1[i] = -1;
2898 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
2899 }
2900
2901 public YamParser(java.io.Reader stream) {
2902 jj_input_stream = new SimpleCharStream(stream, 1, 1);
2903 token_source = new YamParserTokenManager(this, jj_input_stream);
2904 token = new Token();
2905 jj_ntk = -1;
2906 jj_gen = 0;
2907 for (int i = 0; i < 26; i++) jj_la1[i] = -1;
2908 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
2909 }
2910
2911 public void ReInit(java.io.Reader stream) {
2912 jj_input_stream.ReInit(stream, 1, 1);
2913 token_source.ReInit(jj_input_stream);
2914 token = new Token();
2915 jj_ntk = -1;
2916 jjtree.reset();
2917 jj_gen = 0;
2918 for (int i = 0; i < 26; i++) jj_la1[i] = -1;
2919 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
2920 }
2921
2922 public YamParser(YamParserTokenManager tm) {
2923 token_source = tm;
2924 token = new Token();
2925 jj_ntk = -1;
2926 jj_gen = 0;
2927 for (int i = 0; i < 26; i++) jj_la1[i] = -1;
2928 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
2929 }
2930
2931 public void ReInit(YamParserTokenManager tm) {
2932 token_source = tm;
2933 token = new Token();
2934 jj_ntk = -1;
2935 jjtree.reset();
2936 jj_gen = 0;
2937 for (int i = 0; i < 26; i++) jj_la1[i] = -1;
2938 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
2939 }
2940
2941 final private Token jj_consume_token(int kind) throws ParseException {
2942 Token oldToken;
2943 if ((oldToken = token).next != null) token = token.next;
2944 else token = token.next = token_source.getNextToken();
2945 jj_ntk = -1;
2946 if (token.kind == kind) {
2947 jj_gen++;
2948 if (++jj_gc > 100) {
2949 jj_gc = 0;
2950 for (int i = 0; i < jj_2_rtns.length; i++) {
2951 JJCalls c = jj_2_rtns[i];
2952 while (c != null) {
2953 if (c.gen < jj_gen) c.first = null;
2954 c = c.next;
2955 }
2956 }
2957 }
2958 return token;
2959 }
2960 token = oldToken;
2961 jj_kind = kind;
2962 throw generateParseException();
2963 }
2964
2965 static private final class LookaheadSuccess extends java.lang.Error { }
2966 final private LookaheadSuccess jj_ls = new LookaheadSuccess();
2967 final private boolean jj_scan_token(int kind) {
2968 if (jj_scanpos == jj_lastpos) {
2969 jj_la--;
2970 if (jj_scanpos.next == null) {
2971 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
2972 } else {
2973 jj_lastpos = jj_scanpos = jj_scanpos.next;
2974 }
2975 } else {
2976 jj_scanpos = jj_scanpos.next;
2977 }
2978 if (jj_rescan) {
2979 int i = 0; Token tok = token;
2980 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
2981 if (tok != null) jj_add_error_token(kind, i);
2982 }
2983 if (jj_scanpos.kind != kind) return true;
2984 if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
2985 return false;
2986 }
2987
2988 final public Token getNextToken() {
2989 if (token.next != null) token = token.next;
2990 else token = token.next = token_source.getNextToken();
2991 jj_ntk = -1;
2992 jj_gen++;
2993 return token;
2994 }
2995
2996 final public Token getToken(int index) {
2997 Token t = lookingAhead ? jj_scanpos : token;
2998 for (int i = 0; i < index; i++) {
2999 if (t.next != null) t = t.next;
3000 else t = t.next = token_source.getNextToken();
3001 }
3002 return t;
3003 }
3004
3005 final private int jj_ntk() {
3006 if ((jj_nt=token.next) == null)
3007 return (jj_ntk = (token.next=token_source.getNextToken()).kind);
3008 else
3009 return (jj_ntk = jj_nt.kind);
3010 }
3011
3012 private java.util.Vector jj_expentries = new java.util.Vector();
3013 private int[] jj_expentry;
3014 private int jj_kind = -1;
3015 private int[] jj_lasttokens = new int[100];
3016 private int jj_endpos;
3017
3018 private void jj_add_error_token(int kind, int pos) {
3019 if (pos >= 100) return;
3020 if (pos == jj_endpos + 1) {
3021 jj_lasttokens[jj_endpos++] = kind;
3022 } else if (jj_endpos != 0) {
3023 jj_expentry = new int[jj_endpos];
3024 for (int i = 0; i < jj_endpos; i++) {
3025 jj_expentry[i] = jj_lasttokens[i];
3026 }
3027 boolean exists = false;
3028 for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
3029 int[] oldentry = (int[])(e.nextElement());
3030 if (oldentry.length == jj_expentry.length) {
3031 exists = true;
3032 for (int i = 0; i < jj_expentry.length; i++) {
3033 if (oldentry[i] != jj_expentry[i]) {
3034 exists = false;
3035 break;
3036 }
3037 }
3038 if (exists) break;
3039 }
3040 }
3041 if (!exists) jj_expentries.addElement(jj_expentry);
3042 if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
3043 }
3044 }
3045
3046 public ParseException generateParseException() {
3047 jj_expentries.removeAllElements();
3048 boolean[] la1tokens = new boolean[48];
3049 for (int i = 0; i < 48; i++) {
3050 la1tokens[i] = false;
3051 }
3052 if (jj_kind >= 0) {
3053 la1tokens[jj_kind] = true;
3054 jj_kind = -1;
3055 }
3056 for (int i = 0; i < 26; i++) {
3057 if (jj_la1[i] == jj_gen) {
3058 for (int j = 0; j < 32; j++) {
3059 if ((jj_la1_0[i] & (1<<j)) != 0) {
3060 la1tokens[j] = true;
3061 }
3062 if ((jj_la1_1[i] & (1<<j)) != 0) {
3063 la1tokens[32+j] = true;
3064 }
3065 }
3066 }
3067 }
3068 for (int i = 0; i < 48; i++) {
3069 if (la1tokens[i]) {
3070 jj_expentry = new int[1];
3071 jj_expentry[0] = i;
3072 jj_expentries.addElement(jj_expentry);
3073 }
3074 }
3075 jj_endpos = 0;
3076 jj_rescan_token();
3077 jj_add_error_token(0, 0);
3078 int[][] exptokseq = new int[jj_expentries.size()][];
3079 for (int i = 0; i < jj_expentries.size(); i++) {
3080 exptokseq[i] = (int[])jj_expentries.elementAt(i);
3081 }
3082 return new ParseException(token, exptokseq, tokenImage);
3083 }
3084
3085 final public void enable_tracing() {
3086 }
3087
3088 final public void disable_tracing() {
3089 }
3090
3091 final private void jj_rescan_token() {
3092 jj_rescan = true;
3093 for (int i = 0; i < 13; i++) {
3094 try {
3095 JJCalls p = jj_2_rtns[i];
3096 do {
3097 if (p.gen > jj_gen) {
3098 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
3099 switch (i) {
3100 case 0: jj_3_1(); break;
3101 case 1: jj_3_2(); break;
3102 case 2: jj_3_3(); break;
3103 case 3: jj_3_4(); break;
3104 case 4: jj_3_5(); break;
3105 case 5: jj_3_6(); break;
3106 case 6: jj_3_7(); break;
3107 case 7: jj_3_8(); break;
3108 case 8: jj_3_9(); break;
3109 case 9: jj_3_10(); break;
3110 case 10: jj_3_11(); break;
3111 case 11: jj_3_12(); break;
3112 case 12: jj_3_13(); break;
3113 }
3114 }
3115 p = p.next;
3116 } while (p != null);
3117 } catch(LookaheadSuccess ls) { }
3118 }
3119 jj_rescan = false;
3120 }
3121
3122 final private void jj_save(int index, int xla) {
3123 JJCalls p = jj_2_rtns[index];
3124 while (p.gen > jj_gen) {
3125 if (p.next == null) { p = p.next = new JJCalls(); break; }
3126 p = p.next;
3127 }
3128 p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
3129 }
3130
3131 static final class JJCalls {
3132 int gen;
3133 Token first;
3134 int arg;
3135 JJCalls next;
3136 }
3137
3138 // pushBackListStart(StringBuffer, SimpleCharStream, Token)
3139
3140 }
|