org.sweble.wikitext.lazy.parser.LazyRatsParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swc-parser-lazy Show documentation
Show all versions of swc-parser-lazy Show documentation
A parser for MediaWiki's Wikitext.
// ===========================================================================
// This file has been generated by
// Rats! Parser Generator, version 1.15.0,
// (C) 2004-2009 Robert Grimm,
// on Friday, September 12, 2014 at 12:37:36 AM.
// Edit at your own risk.
// ===========================================================================
package org.sweble.wikitext.lazy.parser;
import java.io.Reader;
import java.io.IOException;
import xtc.util.Pair;
import xtc.tree.Locatable;
import xtc.parser.ParserBase;
import xtc.parser.Column;
import xtc.parser.Result;
import xtc.parser.SemanticValue;
import xtc.parser.ParseError;
import org.sweble.wikitext.lazy.postprocessor.IntermediateTags;
import org.sweble.wikitext.lazy.utils.*;
import de.fau.cs.osr.ptk.common.ast.*;
import de.fau.cs.osr.ptk.common.ast.Tuple.*;
import de.fau.cs.osr.utils.StringUtils;
import java.util.Vector;
import java.util.Stack;
import xtc.tree.Location;
import java.util.ArrayList;
import org.sweble.wikitext.lazy.parser.RtData;
import org.sweble.wikitext.lazy.utils.TextUtils;
import org.sweble.wikitext.lazy.utils.XmlCharRef;
import org.sweble.wikitext.lazy.utils.XmlEntityRef;
import org.sweble.wikitext.lazy.AstNodeTypes;
import org.sweble.wikitext.lazy.utils.ParserStats;
import de.fau.cs.osr.ptk.common.Warning;
import org.sweble.wikitext.lazy.parser.WarningSeverity;
import org.sweble.wikitext.lazy.parser.LooksLikeWarning;
import org.sweble.wikitext.lazy.parser.OddSyntaxWarning;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import org.sweble.wikitext.lazy.utils.ParserShouldNotBeHereException;
/**
* Packrat parser for grammar org.sweble.wikitext.lazy.parser.Grammar
.
*
* This class has been generated by the Rats! parser
* generator, version 1.15.0, (C) 2004-2009 Robert Grimm.
*/
public final class LazyRatsParser extends ParserBase {
// =========================================================================
/** Chunk 1 of memoized results. */
static final class Chunk1 {
Result fParagraphMemoized;
Result fTextPlus;
Result fExternalLinkMemoized;
Result fHorizontalRuleMemoized;
Result fInternalLinkMemoized;
Result fListMemoized;
Result fSectionsMemoized;
Result fHeadingMemoized;
Result fSemiPreMemoized;
Result fTableMemoized;
}
/** Chunk 2 of memoized results. */
static final class Chunk2 {
Result fTableCaptionMemoized;
Result f$$Shared12;
Result fTableCellMemoized;
Result fTableHeaderMemoized;
Result fTableHeader$Attributes;
Result fTableRowMemoized;
Result fpTpStar;
Result fpExtSpaceStar;
Result fpExtWsStarMemoized;
Result fXmlReference;
}
/** Chunk 3 of memoized results. */
static final class Chunk3 {
Result fParserEntity;
Result fUrl;
Result fUrlPathString;
Result fTableAttribute$ValidXmlAttribute;
Result fTableAttributeStar;
Result fTableAttributeInline$ValidXmlAttribute;
Result fTableAttributeInlineStar;
Result fXmlName;
Result fXmlAttribute$ValidXmlAttribute;
}
// =========================================================================
/** Memoization table column. */
static final class LazyRatsParserColumn extends Column {
Chunk1 chunk1;
Chunk2 chunk2;
Chunk3 chunk3;
}
// =========================================================================
/** The global state object. */
protected final LazyParserState yyState;
// =========================================================================
/**
* Create a new packrat parser.
*
* @param reader The reader.
* @param file The file name.
*/
public LazyRatsParser(final Reader reader, final String file) {
super(reader, file);
yyState = new LazyParserState();
}
/**
* Create a new packrat parser.
*
* @param reader The file reader.
* @param file The file name.
* @param size The file size.
*/
public LazyRatsParser(final Reader reader, final String file, final int size) {
super(reader, file, size);
yyState = new LazyParserState();
}
// =========================================================================
protected Column newColumn() {
return new LazyRatsParserColumn();
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Grammar.Article.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
public Result pArticle(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
LazyParsedPage yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
enter(ParserScopes.PAGE);
yyResult = pBolBlockContent(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList content = yyResult.semanticValue();
yyPredResult = p$$Shared7(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new LazyParsedPage(content, new ArrayList(), getState().getEntityMap());
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Grammar.grmbl.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
public Result pgrmbl(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pListMemoized(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pInternalLinkMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pListTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pInternalLinkTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableCaptionMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableRowMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableHeaderMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableCaptionTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableRowTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableHeaderTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableCellMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = ppExtWsStarMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pListMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pTableCellTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
ppExtWsStarTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pListTransient(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pSemiPreMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pSectionsMemoized(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pHeadingMemoized(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pSemiPreTransient(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pSectionsTransient(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pHeadingTransient(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pHorizontalRuleMemoized(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pExternalLinkMemoized(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pParagraphMemoized(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pHorizontalRuleTransient(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pExternalLinkTransient(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult =
pParagraphTransient(yyResult.index);
yyError =
yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.BolBlockContent.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBolBlockContent(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pBlock(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for content.
Pair content = yyRepValue1.reverse();
yyValue = new NodeList(content);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for content.
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.BlockContent.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBlockContent(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pParagraph(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode head = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pBlock(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.Block.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBlock(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredMatched = false;
yyPredResult = pBlockStopper(yyStart);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pLineStartProd(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pParagraph(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("block expected", yyStart);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.BlockStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBlockStopper(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (inScope(ParserScopes.SECTION_BODY)) {
yyResult = pHeading(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
if (inScope(ParserScopes.TABLE_ELEMENTS) ||
inScope(ParserScopes.TABLE_CELL)) {
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyC = character(yyResult.index);
if (-1 != yyC) {
yyIndex = yyResult.index + 1;
switch (yyC) {
case '!':
case '|':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
}
// Done.
yyError = yyError.select("block stopper expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.LineStartProd.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLineStartProd(final int yyStart) throws IOException {
int yyC;
Result yyResult;
int yyPredIndex;
Result yyPredResult;
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = ppExtSpaceStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyBase = yyPredResult.index;
yyC = character(yyBase);
if ('{' == yyC) {
yyPredIndex = yyPredResult.index + 1;
yyC = character(yyPredIndex);
if ('|' == yyC) {
yyResult = pTable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'{|' expected", yyBase);
}
} else {
yyError = yyError.select("'{|' expected", yyBase);
}
}
// Alternative 2.
yyPredResult = ppTpStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyBase = yyPredResult.index;
yyC = character(yyBase);
if ('-' == yyC) {
yyPredIndex = yyPredResult.index + 1;
yyC = character(yyPredIndex);
if ('-' == yyC) {
yyPredIndex = yyPredIndex + 1;
yyC = character(yyPredIndex);
if ('-' == yyC) {
yyResult = pHorizontalRule(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'---' expected", yyBase);
}
} else {
yyError = yyError.select("'---' expected", yyBase);
}
} else {
yyError = yyError.select("'---' expected", yyBase);
}
}
// Alternative 3.
yyPredResult = ppTpStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyC = character(yyPredResult.index);
if (-1 != yyC) {
if (('#' == yyC) ||
('*' == yyC) ||
(':' == yyC)) {
yyResult = pList(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Alternative 4.
yyPredResult = ppTpStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyC = character(yyPredResult.index);
if (' ' == yyC) {
yyResult = pSemiPre(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 5.
yyPredResult = ppTpStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyC = character(yyPredResult.index);
if ('=' == yyC) {
yyResult = pSections(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Done.
yyError = yyError.select("line start prod expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.Paragraph.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParagraph(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pParagraphMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pParagraphTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.ParagraphMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParagraphMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fParagraphMemoized)
yyColumn.chunk1.fParagraphMemoized = pParagraphMemoized$1(yyStart);
return yyColumn.chunk1.fParagraphMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Content.ParagraphMemoized. */
private Result pParagraphMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("Paragraph", getContext(), pParagraphTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.ParagraphTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParagraphTransient(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyOption1;
Whitespace yyOpValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pPreParaWs(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Whitespace pre = yyResult.semanticValue();
yyPredMatched = false;
yyPredResult = pParagraphStopper(yyResult.index);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = pParagraphText(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode p = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pPostParaWs(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
Whitespace v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for post.
Whitespace post = yyOpValue1;
NodeList l = new NodeList();
l.add(pre);
l.add(IntermediateTags.PARAGRAPH.createOpen(false));
l.add(p);
l.add(post);
l.add(IntermediateTags.PARAGRAPH.createClose(false));
yyValue = l;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for post.
}
} else {
yyError = yyError.select("paragraph transient expected", yyStart);
}
}
// Alternative 2.
yyResult = pPreParaWs(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pParagraphText(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode p = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pPostParaWs(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
Whitespace v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for post.
Whitespace post = yyOpValue1;
NodeList l = new NodeList();
l.add(IntermediateTags.PARAGRAPH.createOpen(false));
l.add(p);
l.add(post);
l.add(IntermediateTags.PARAGRAPH.createClose(false));
yyValue = l;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for post.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.ParagraphStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParagraphStopper(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (inScope(ParserScopes.SECTION_BODY)) {
yyResult = pHeading(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
if (inScope(ParserScopes.TABLE_ELEMENTS) ||
inScope(ParserScopes.TABLE_CELL)) {
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyC = character(yyResult.index);
if (-1 != yyC) {
yyIndex = yyResult.index + 1;
switch (yyC) {
case '!':
case '|':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
}
// Alternative 3.
yyResult = pLineStartProd(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("paragraph stopper expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.PreParaWs.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPreParaWs(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
Whitespace yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode s = yyResult.semanticValue();
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String lt = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = p$$Shared1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
NodeList v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new Whitespace(
new NodeList(s, new Text(lt), new NodeList(tail)),
true);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared1.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Content.PreParaWsMore
* and org.sweble.wikitext.lazy.parser.Content.PostParaWsMore.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared1(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredMatched = false;
yyPredResult = pParagraphStopper(yyStart);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode s = yyResult.semanticValue();
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String lt = yyResult.semanticValue();
yyValue = new NodeList(s, new Text(lt));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
} else {
yyError = yyError.select(" expected", yyStart);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.ParagraphText.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParagraphText(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pInlineContentPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList head = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pParagraphTextMore(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.ParagraphTextMore.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParagraphTextMore(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String lt = yyResult.semanticValue();
yyPredMatched = false;
yyPredResult = pParagraphStopper(yyResult.index);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode s = yyResult.semanticValue();
yyResult = pInlineContentPlus(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList c = yyResult.semanticValue();
yyValue = new NodeList(
new Whitespace(
new NodeList(new Text(lt)),
true),
s,
c);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
} else {
yyError = yyError.select("paragraph text more expected", yyStart);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.PostParaWs.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPostParaWs(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
Whitespace yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String lt = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = p$$Shared1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
NodeList v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new Whitespace(
new NodeList(new Text(lt), new NodeList(tail)),
true);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineBlockContent.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineBlockContent(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
Pair yyRepValue1;
int yyOption1;
AstNode yyOpValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyPredMatched = false;
yyPredResult = pBlockStopper(yyOption1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = pInlineTextBlock(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
} else {
yyError = yyError.select("inline block content expected", yyStart);
}
{ // Start scope for head.
AstNode head = yyOpValue1;
yyRepetition1 = yyOption1;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pInlineBlock(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$2 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$2, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, new NodeList(tail));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
} // End scope for head.
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.InlineBlock.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineBlock(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredMatched = false;
yyPredResult = pBlockStopper(yyStart);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pLineStartProd(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pInlineTextBlock(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("inline block expected", yyStart);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineTextBlock.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineTextBlock(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair yyRepValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pInlineContentPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList head = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pInlineTextBlockMore(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Alternative 2.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pInlineTextBlockMore(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode v$el$2 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair(v$el$2, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineTextBlockMore.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineTextBlockMore(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyOption1;
NodeList yyOpValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String lt = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyPredMatched = false;
yyPredResult = pParagraphStopper(yyOption1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = pInlineContentPlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
NodeList v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
} else {
yyError = yyError.select("inline text block more expected", yyStart);
}
{ // Start scope for more.
NodeList more = yyOpValue1;
yyValue = new NodeList(new Text(lt), more);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for more.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pContent$InlineContentStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pInlineContentChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for content.
Pair content = yyRepValue1.reverse();
yyValue = new NodeList(content);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for content.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineContentPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineContentPlus(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pInlineContentChoice(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
Pair content = yyRepValue1.reverse();
yyValue = new NodeList(content);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineContentChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineContentChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyPredIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTextPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Text text = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (':' == yyC) {
yyIndex = yyChoice1 + 1;
if (accept(ParserAtoms.PLAIN_EXTERNAL_LINK)) {
yyResult = pUrlPathString(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String path = yyResult.semanticValue();
if (isProtocol(text, path)) {
yyValue = makeExternalLink(text, path);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Nested alternative 2.
yyBase = yyChoice1;
yyC = character(yyBase);
if ('[' == yyC) {
yyPredIndex = yyChoice1 + 1;
yyC = character(yyPredIndex);
if ('[' == yyC) {
yyPredMatched = false;
yyPredResult = pInlineContentStopper(yyChoice1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = pInternalLink(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode link = yyResult.semanticValue();
yyValue = link.isNodeType(AstNodeTypes.NT_INTERNAL_LINK) ?
addLinkPrefix(text, (InternalLink) link) :
new NodeList(text, link);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("inline content choice expected", yyStart);
}
} else {
yyError = yyError.select("'[[' expected", yyBase);
}
} else {
yyError = yyError.select("'[[' expected", yyBase);
}
}
// Alternative 2.
yyResult = pTextPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyPredMatched = false;
yyPredResult = pInlineContentStopper(yyStart);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pInlineContentAtom(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pTextStopperPrefix(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String text = yyResult.semanticValue();
yyValue = new Text(text);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("inline content choice expected", yyStart);
}
// Done.
yyError = yyError.select("inline content choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineContentAtom.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineContentAtom(final int yyStart) throws IOException {
int yyC;
Result yyResult;
int yyPredIndex;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('~' == yyC) {
yyPredIndex = yyStart + 1;
yyC = character(yyPredIndex);
if ('~' == yyC) {
yyResult = pSignature(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 2.
yyC = character(yyStart);
if ('[' == yyC) {
yyPredIndex = yyStart + 1;
yyC = character(yyPredIndex);
if ('[' == yyC) {
yyResult = pInternalLink(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 3.
yyC = character(yyStart);
if ('[' == yyC) {
yyResult = pExternalLink(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 4.
yyC = character(yyStart);
if ('\'' == yyC) {
yyPredIndex = yyStart + 1;
yyC = character(yyPredIndex);
if ('\'' == yyC) {
yyResult = pTicks(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 5.
yyC = character(yyStart);
if ('_' == yyC) {
yyPredIndex = yyStart + 1;
yyC = character(yyPredIndex);
if ('_' == yyC) {
yyResult = pMagicWord(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 6.
yyC = character(yyStart);
if ('<' == yyC) {
yyResult = pXmlElement(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 7.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 8.
yyC = character(yyStart);
if ('\ue000' == yyC) {
yyResult = pParserEntity(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("inline content atom expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.InlineContentStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInlineContentStopper(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\r':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('\n' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\n':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2028':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2029':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u000b':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u0085':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 2.
if (inScope(ParserScopes.EXTERNAL_LINK_TITLE)) {
yyC = character(yyStart);
if (']' == yyC) {
yyIndex = yyStart + 1;
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 3.
if (inScope(ParserScopes.INTERNAL_LINK_ALT)) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case ']':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if (']' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '[':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('[' == yyC) {
yyResult = pInternalLinkChoice(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
}
}
break;
case '|':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
// Alternative 4.
if (inScope(ParserScopes.INTERNAL_LINK_TITLE)) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case ']':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if (']' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '[':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('[' == yyC) {
yyResult = pInternalLinkChoice(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
}
}
break;
default:
/* No match. */
}
}
}
// Alternative 5.
if (inScope(ParserScopes.IMAGE_LINK_ALT)) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case ']':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if (']' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '|':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
// Alternative 6.
if (inScope(ParserScopes.IMAGE_LINK_TITLE)) {
yyC = character(yyStart);
if (']' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if (']' == yyC) {
yyIndex = yyIndex + 1;
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Alternative 7.
if (inScope(ParserScopes.SECTION_HEADING)) {
yyResult = pEqualsStr(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pslEolOrEof(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Alternative 8.
if (inScope(ParserScopes.TABLE_INLINE_HEADER)) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '!':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('!' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '|':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('|' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
default:
/* No match. */
}
}
}
// Alternative 9.
if (inScope(ParserScopes.TABLE_INLINE_CELL)) {
yyC = character(yyStart);
if ('|' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('|' == yyC) {
yyIndex = yyIndex + 1;
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Done.
yyError = yyError.select("inline content stopper expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.TextPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTextPlus(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fTextPlus)
yyColumn.chunk1.fTextPlus = pTextPlus$1(yyStart);
return yyColumn.chunk1.fTextPlus;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Content.TextPlus. */
private Result pTextPlus$1(final int yyStart) throws IOException {
Result yyResult;
Text yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTextPlusStr(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String text = yyResult.semanticValue();
yyValue = new Text(text);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Content.TextPlusStr.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTextPlusStr(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTextStopperPrefix(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
} else {
yyError = yyError.select("text plus str expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("text plus str expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Content.TextStopperPrefix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTextStopperPrefix(final int yyStart) throws IOException {
int yyC;
int yyIndex;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\r':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('\n' == yyC) {
yyValue = "\r\n";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "\r";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\n':
{
yyValue = "\n";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2028':
{
yyValue = "\u2028";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2029':
{
yyValue = "\u2029";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u000b':
{
yyValue = "\u000b";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = "\f";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u0085':
{
yyValue = "\u0085";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '=':
{
yyValue = "=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '|':
{
yyValue = "|";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '!':
{
yyValue = "!";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case ']':
{
yyValue = "]";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case ':':
{
yyValue = ":";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '~':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('~' == yyC) {
yyValue = "~~";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '[':
{
yyValue = "[";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\'':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('\'' == yyC) {
yyValue = "\'\'";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '_':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('_' == yyC) {
yyValue = "__";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '<':
{
yyValue = "<";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '&':
{
yyValue = "&";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\ue000':
{
yyValue = "\ue000";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("text stopper prefix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLink.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExternalLink(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pExternalLinkMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pExternalLinkTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLinkMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExternalLinkMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fExternalLinkMemoized)
yyColumn.chunk1.fExternalLinkMemoized = pExternalLinkMemoized$1(yyStart);
return yyColumn.chunk1.fExternalLinkMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLinkMemoized. */
private Result pExternalLinkMemoized$1(final int yyStart)
throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("ExternalLink", getContext(), pExternalLinkTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLinkTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExternalLinkTransient(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('[' == yyC) {
yyIndex = yyStart + 1;
final int yyChoice1 = yyIndex;
// Nested alternative 1.
if (accept(ParserAtoms.EXTERNAL_LINK)) {
yyResult = pExternalLinkChoice(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Nested alternative 2.
yyValue = new Text("[");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
// Done.
yyError = yyError.select("external link transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLinkChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExternalLinkChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyResult = ppTpStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = pUrl(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Url target = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pptExtSpacePlus(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList rt1 = yyResult.semanticValue();
yyResult = pExternalLinkTitleContentPlus(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList title = yyResult.semanticValue();
yyC = character(yyResult.index);
if (']' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = new ExternalLink(target, title);
if (isGatherRtData())
addRtData(yyValue,
joinRt('[', rt0),
joinRt(rt1),
joinRt(']'));
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Nested alternative 2.
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pSpaceStar(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String rt1 = yyResult.semanticValue();
yyC = character(yyResult.index);
if (']' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = new ExternalLink(target);
if (isGatherRtData())
addRtData(yyValue,
joinRt('[', rt0),
null,
joinRt(rt1, ']'));
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
// Alternative 2.
if (isWarningsEnabled()) {
yyResult = pExternalLinkAutoCorrect(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
}
// Abort the state modification.
yyState.abort();
// Done.
yyError = yyError.select("external link choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLinkAutoCorrect.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExternalLinkAutoCorrect(final int yyStart)
throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isAutoCorrect(WS_INFO)) {
yyResult = ppTpStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = pUrl(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Url target = yyResult.semanticValue();
yyValue = new ExternalLink(target);
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 1, yyResult),
WS_INFO,
"External Link",
"the finishing `]' is missing");
if (isGatherRtData())
addRtData(yyValue,
joinRt('[', rt0),
null,
joinRt(']'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 2.
if (isWarningLevelEnabled(WS_INFO)) {
yyPredResult = ppTpStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyPredResult = pUrl(yyPredResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new Text("[");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 1, yyPredResult),
WS_INFO,
"External Link",
"the finishing `]' is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
}
}
// Alternative 3.
if (isWarningLevelEnabled(WS_NONE)) {
yyValue = new Text("[");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 1, yyStart),
WS_NONE,
"External Link",
"the actual URL is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("external link auto correct expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ExternalLink.ExternalLinkTitleContentPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExternalLinkTitleContentPlus(final int yyStart)
throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
enter(ParserScopes.EXTERNAL_LINK_TITLE);
yyResult = pInlineContentPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.HorizontalRule.HorizontalRule.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHorizontalRule(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pHorizontalRuleMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pHorizontalRuleTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.HorizontalRule.HorizontalRuleMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHorizontalRuleMemoized(final int yyStart)
throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fHorizontalRuleMemoized)
yyColumn.chunk1.fHorizontalRuleMemoized = pHorizontalRuleMemoized$1(yyStart);
return yyColumn.chunk1.fHorizontalRuleMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.HorizontalRule.HorizontalRuleMemoized. */
private Result pHorizontalRuleMemoized$1(final int yyStart)
throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("HorizontalRule", getContext(), pHorizontalRuleTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.HorizontalRule.HorizontalRuleTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHorizontalRuleTransient(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('-' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('-' == yyC) {
yyIndex = yyIndex + 1;
yyC = character(yyIndex);
if ('-' == yyC) {
yyIndex = yyIndex + 1;
final int yyChoice1 = yyIndex;
// Nested alternative 1.
if (accept(ParserAtoms.HORIZONTAL_RULE)) {
yyResult = pHorizontalRuleChoice(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Nested alternative 2.
yyValue = new Text("---");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
}
// Done.
yyError = yyError.select("horizontal rule transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.HorizontalRule.HorizontalRuleChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHorizontalRuleChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair yyRepValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyC = character(yyRepetition1);
if ('-' == yyC) {
yyIndex = yyRepetition1 + 1;
char v$el$2 = (char)yyC;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
yyRepValue1 = new Pair(v$el$2, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
Pair more = yyRepValue1.reverse();
int dashes = 3 + more.size();
yyValue = new HorizontalRule();
if (isGatherRtData())
addRtData(yyValue, joinRt(StringUtils.strrep('-', dashes)));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Alternative 2.
if (isWarningsEnabled()) {
yyResult = pHorizontalRuleAutoCorrect(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("horizontal rule choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.HorizontalRule.HorizontalRuleAutoCorrect.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHorizontalRuleAutoCorrect(final int yyStart)
throws IOException {
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isWarningLevelEnabled(WS_NONE)) {
yyValue = new Text("---");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 3, yyStart),
WS_NONE,
"Horizontal Rule",
"a horizontal rule consists of at least 4 dashes");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("horizontal rule auto correct expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.InternalLink.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInternalLink(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pInternalLinkMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pInternalLinkTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.InternalLinkMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInternalLinkMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fInternalLinkMemoized)
yyColumn.chunk1.fInternalLinkMemoized = pInternalLinkMemoized$1(yyStart);
return yyColumn.chunk1.fInternalLinkMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.InternalLink.InternalLinkMemoized. */
private Result pInternalLinkMemoized$1(final int yyStart)
throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("InternalLink", getContext(), pInternalLinkTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.InternalLinkTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInternalLinkTransient(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if ('[' == yyC) {
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('[' == yyC) {
if (accept(ParserAtoms.INTERNAL_LINK)) {
yyResult = pInternalLinkChoice(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Nested alternative 2.
yyValue = new Text("[");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
// Done.
yyError = yyError.select("internal link transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.InternalLinkChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInternalLinkChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyBase;
int yyOption1;
String yyOpValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyResult = ppTpStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = pLinkTargetString(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String target = yyResult.semanticValue();
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
getState().initLinkBuilder(target);
if (isValidTarget()) {
yyResult = pOptionsAndTitle(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList options = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if (']' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if (']' == yyC) {
yyIndex = yyIndex + 1;
yyOption1 = yyIndex;
yyOpValue1 = null;
yyResult = pLinkPostfix(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for postfix.
String postfix = yyOpValue1;
if (postfix == null)
postfix = "";
yyValue = getState().getLinkBuilder().build(options, postfix);
if (isGatherRtData())
{
if (isImageTarget())
{
addRtData(yyValue,
joinRt("[[", rt0, target, rt1),
null,
joinRt("]]", postfix));
}
else
{
addRtData(yyValue,
joinRt("[[", rt0, target, rt1),
joinRt("]]", postfix));
}
}
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for postfix.
} else {
yyError = yyError.select("']]' expected", yyBase);
}
} else {
yyError = yyError.select("']]' expected", yyBase);
}
}
}
}
}
}
// Alternative 2.
if (isWarningsEnabled()) {
yyResult = pInternalLinkAutoCorrect(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
}
// Abort the state modification.
yyState.abort();
// Done.
yyError = yyError.select("internal link choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.InternalLinkAutoCorrect.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInternalLinkAutoCorrect(final int yyStart)
throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isAutoCorrect(WS_INFO)) {
yyResult = ppTpStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = pLinkTargetString(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String target = yyResult.semanticValue();
getState().initLinkBuilder(target);
if (isValidTarget()) {
yyValue = getState().getLinkBuilder().build(new NodeList(), null);
if (isGatherRtData())
{
if (isImageTarget())
{
addRtData(yyValue, joinRt("[[", rt0, target), null, null);
}
else
{
addRtData(yyValue, joinRt("[[", rt0, target), null);
}
}
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyResult),
WS_INFO,
"Internal Link",
"the finishing `]]' is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Alternative 2.
if (isWarningLevelEnabled(WS_INFO)) {
yyPredResult = ppTpStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyPredResult = pLinkTargetString(yyPredResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
String target = yyPredResult.semanticValue();
getState().initLinkBuilder(target);
if (isValidTarget()) {
yyValue = new Text("[[");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyPredResult),
WS_INFO,
"Internal Link",
"the finishing `]]' is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
}
}
}
// Alternative 3.
if (isWarningLevelEnabled(WS_NONE)) {
yyValue = new Text("[[");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyStart),
WS_NONE,
"Internal Link",
"a target link is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("internal link auto correct expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.OptionsAndTitle.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pOptionsAndTitle(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (!isImageTarget()) {
yyOption1 = yyStart;
yyResult = pLinkTitle(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyValue = null;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
}
// Alternative 2.
yyResult = pLinkOptionStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyResult = pLinkTitle(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
return new SemanticValue(yyValue, yyOption1, yyError);
}
// Done.
yyError = yyError.select("options and title expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionStar(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyC = character(yyRepetition1);
if ('|' == yyC) {
yyIndex = yyRepetition1 + 1;
yyResult = pLinkOptionChoice(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
}
break;
}
{ // Start scope for options.
Pair options = yyRepValue1.reverse();
yyValue = new NodeList(options);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for options.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionChoice(final int yyStart) throws IOException {
int yyC;
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pLinkOptionResize(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyPredResult = p$$Shared14(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pLinkOptionKeyword(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyPredResult = p$$Shared14(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 3.
yyResult = pLinkOptionNameValue(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pLinkOptionGarbage(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('|' == yyC) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("link option choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared14.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Grammar.LinkOptionChoice$$Choice1
* and org.sweble.wikitext.lazy.parser.Grammar.LinkOptionChoice$$Choice2.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared14(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '|':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case ']':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if (']' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionResize.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionResize(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyBase;
int yyOption1;
String yyOpValue1;
LinkOptionResize yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtWsStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pDigitPlus(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String width = yyResult.semanticValue();
final int yyChoice2 = yyResult.index;
// Nested alternative 1.
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pSpaceStar(yyChoice2);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String rt1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('p' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('x' == yyC) {
yyIndex = yyIndex + 1;
yyResult = ppExtWsStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt2 = yyResult.semanticValue();
int w = toInt(width);
if (w == -2)
getLinkBuilder().addWarning(
makeOddSyntaxWarning(
makeSpan(yyStart, yyResult),
WS_INFO,
"Invalid size format"));
getLinkBuilder().setWidth(w);
yyValue = null;
if (isGatherRtData())
{
yyValue = new LinkOptionResize(w, -1);
addRtData(yyValue, joinRt('|', rt0, width, rt1, "px", rt2));
}
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'px' expected", yyBase);
}
} else {
yyError = yyError.select("'px' expected", yyBase);
}
}
// Nested alternative 2.
yyC = character(yyChoice2);
if ('x' == yyC) {
yyIndex = yyChoice2 + 1;
yyOption1 = yyIndex;
yyOpValue1 = null;
yyResult = pDigitPlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for height.
String height = yyOpValue1;
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pSpaceStar(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String rt1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('p' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('x' == yyC) {
yyIndex = yyIndex + 1;
yyResult = ppExtWsStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt2 = yyResult.semanticValue();
int w = toInt(width);
int h = toInt(height);
if (w == -2 || h == -2)
getLinkBuilder().addWarning(
makeOddSyntaxWarning(
makeSpan(yyStart, yyResult),
WS_INFO,
"Invalid size format"));
getLinkBuilder().setWidth(w);
getLinkBuilder().setHeight(h);
yyValue = null;
if (isGatherRtData())
{
yyValue = new LinkOptionResize(w, h);
addRtData(yyValue, joinRt('|', rt0, width, 'x', height, rt1, "px", rt2));
}
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'px' expected", yyBase);
}
} else {
yyError = yyError.select("'px' expected", yyBase);
}
}
} // End scope for height.
}
}
// Nested alternative 2.
yyC = character(yyChoice1);
if ('x' == yyC) {
yyIndex = yyChoice1 + 1;
yyResult = pDigitPlus(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String height = yyResult.semanticValue();
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String rt1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('p' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('x' == yyC) {
yyIndex = yyIndex + 1;
yyResult = ppExtWsStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt2 = yyResult.semanticValue();
int h = toInt(height);
if (h == -2)
getLinkBuilder().addWarning(
makeOddSyntaxWarning(
makeSpan(yyStart, yyResult),
WS_INFO,
"Invalid size format"));
getLinkBuilder().setHeight(h);
yyValue = null;
if (isGatherRtData())
{
yyValue = new LinkOptionResize(-1, h);
addRtData(yyValue,joinRt('|', rt0, 'x', height, rt1, "px", rt2));
}
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'px' expected", yyBase);
}
} else {
yyError = yyError.select("'px' expected", yyBase);
}
}
}
}
}
// Done.
yyError = yyError.select("link option resize expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionKeyword.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionKeyword(final int yyStart) throws IOException {
Result yyResult;
LinkOptionKeyword yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtWsStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = pLinkOptionKeywordString(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String keyword = yyResult.semanticValue();
if (getLinkBuilder().addKeyword(keyword)) {
yyResult = ppExtWsStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
yyValue = null;
if (isGatherRtData())
{
yyValue = new LinkOptionKeyword(keyword);
addRtData(yyValue, joinRt('|', rt0, keyword, rt1));
}
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Done.
yyError = yyError.select("link option keyword expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionKeywordString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionKeywordString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
if ((('A' <= yyC) && (yyC <= 'Z')) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("link option keyword string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionNameValue.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionNameValue(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyResult = ppExtWsStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case 'l':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('i' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('n' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('k' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('=' == yyC) {
yyResult = pLinkTargetOverride(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode target = yyResult.semanticValue();
yyResult = ppExtWsStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
getLinkBuilder().setLink(target);
yyValue = null;
if (isGatherRtData())
{
yyValue = new LinkOptionLinkTarget(target);
addRtData(yyValue,
joinRt('|', rt0, "link="),
joinRt(rt1));
}
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
}
}
}
}
}
}
break;
case 'a':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('l' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('t' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('=' == yyC) {
enter(ParserScopes.INTERNAL_LINK_ALT);
yyResult = pInlineBlockContent(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList alt = yyResult.semanticValue();
yyValue = new LinkOptionAltText(alt);
getLinkBuilder().setAlt((LinkOptionAltText) yyValue);
if (isGatherRtData())
{
addRtData(yyValue,
joinRt('|', rt0, "alt="),
null);
}
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
}
}
}
break;
default:
/* No match. */
}
}
}
// Abort the state modification.
yyState.abort();
// Done.
yyError = yyError.select("link option name value expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkTargetOverride.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkTargetOverride(final int yyStart) throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pUrl(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pLinkTarget(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkOptionGarbage.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkOptionGarbage(final int yyStart) throws IOException {
Result yyResult;
LinkOptionGarbage yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(isImageTarget() ?
ParserScopes.IMAGE_LINK_ALT :
ParserScopes.INTERNAL_LINK_ALT);
yyResult = pInlineBlockContent(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
if (isGatherRtData())
{
yyValue = new LinkOptionGarbage(difference(yyStart, yyResult));
addRtData(yyValue, joinRt('|', yyValue.getContent()));
}
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.InternalLink.LinkTitle.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkTitle(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
LinkTitle yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(isImageTarget() ?
ParserScopes.IMAGE_LINK_TITLE :
ParserScopes.INTERNAL_LINK_TITLE);
yyC = character(yyStart);
if ('|' == yyC) {
yyIndex = yyStart + 1;
yyResult = pInlineBlockContent(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList title = yyResult.semanticValue();
yyValue = new LinkTitle(title);
getLinkBuilder().setTitle(yyValue);
if (isGatherRtData())
addRtData(yyValue, joinRt('|'));
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Abort the state modification.
yyState.abort();
// Done.
yyError = yyError.select("link title expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.InternalLink.LinkPostfix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkPostfix(final int yyStart) throws IOException {
int yyBase;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (!isImageTarget()) {
yyBase = yyStart;
Result yyResult = parseLinkPostfix(yyStart, yyBase);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("link postfix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.List.List.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pList(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pListMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pListTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.List.ListMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pListMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fListMemoized)
yyColumn.chunk1.fListMemoized = pListMemoized$1(yyStart);
return yyColumn.chunk1.fListMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.List.ListMemoized. */
private Result pListMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("List", getContext(), pListTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.List.ListTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pListTransient(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
int yyRepetition1;
Pair yyRepValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (accept(ParserAtoms.LIST)) {
yyResult = pListItem(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
RawListItem first = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyPredResult = pslEol(yyRepetition1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pListItem(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
RawListItem v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = makeList(first, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
}
// Done.
yyError = yyError.select("list transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.List.ListItem.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pListItem(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
String yyOpValue1;
RawListItem yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for rt0.
String rt0 = yyOpValue1;
yyResult = ppTpStar(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
yyResult = pListPrefix(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String prefix = yyResult.semanticValue();
yyResult = pListItemContentStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList content = yyResult.semanticValue();
// TODO: Support "; term : def" on a single line
yyValue = new RawListItem(content, rt0, rt1, prefix);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
} // End scope for rt0.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.List.ListPrefix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pListPrefix(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyOption1;
Character yyOpValue1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pListPrefixStr(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String prefix = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyC = character(yyOption1);
if (';' == yyC) {
yyIndex = yyOption1 + 1;
char v$el$1 = (char)yyC;
yyOption1 = yyIndex;
yyOpValue1 = v$el$1;
}
{ // Start scope for semicolon.
Character semicolon = yyOpValue1;
yyValue = (semicolon != null) ? prefix + ';' : prefix;
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for semicolon.
}
// Alternative 2.
yyC = character(yyStart);
if (';' == yyC) {
yyIndex = yyStart + 1;
yyValue = ";";
return new SemanticValue(yyValue, yyIndex, yyError);
}
// Done.
yyError = yyError.select("list prefix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.List.ListPrefixStr.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pListPrefixStr(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '#':
case '*':
case ':':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("list prefix str expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.List.ListItemContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pListItemContentStar(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.LIST_ITEM);
yyResult = pContent$InlineContentStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Section.Sections.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSections(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pSectionsMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pSectionsTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Section.SectionsMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSectionsMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fSectionsMemoized)
yyColumn.chunk1.fSectionsMemoized = pSectionsMemoized$1(yyStart);
return yyColumn.chunk1.fSectionsMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Section.SectionsMemoized. */
private Result pSectionsMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("Sections", getContext(), pSectionsTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Section.SectionsTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSectionsTransient(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (accept(ParserAtoms.SECTIONS)) {
yyResult = pSection(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Section first = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pSection(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
Section v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = makeSections(first, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
}
// Done.
yyError = yyError.select("sections transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Section.Section.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSection(final int yyStart) throws IOException {
Result yyResult;
Section yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pHeading(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Heading h = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = p$$Shared7(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = new Section(h.getLevel(), h.getContent(), new NodeList());
fixSectionMetadata(h, yyValue);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pSectionContentStar(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyValue = new Section(h.getLevel(), h.getContent(), body);
fixSectionMetadata(h, yyValue);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Section.Heading.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHeading(final int yyStart) throws IOException {
int yyBase;
Heading yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pHeadingMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pHeadingTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Section.HeadingMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHeadingMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fHeadingMemoized)
yyColumn.chunk1.fHeadingMemoized = pHeadingMemoized$1(yyStart);
return yyColumn.chunk1.fHeadingMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Section.HeadingMemoized. */
private Result pHeadingMemoized$1(final int yyStart) throws IOException {
int yyBase;
Heading yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("Heading", getContext(), pHeadingTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Section.HeadingTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHeadingTransient(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
Heading yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppTpStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = pEqualsStr(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String open = yyResult.semanticValue();
yyResult = pHeadingContentStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList heading = yyResult.semanticValue();
yyResult = pEqualsStr(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String close = yyResult.semanticValue();
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
yyPredResult = pslEolOrEof(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
// TODO: add warning productions
yyValue = createHeading(yyStart, yyResult, rt0, open.length(), heading, close.length(), rt1);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Section.EqualsStr.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEqualsStr(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyBase;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyBase = yyRepetition1;
yyC = character(yyBase);
if ('=' == yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
} else {
yyError = yyError.select("'=' expected", yyBase);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Section.HeadingContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHeadingContentStar(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.SECTION_HEADING);
yyResult = pInlineContentPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Section.SectionContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSectionContentStar(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.SECTION_BODY);
yyResult = pBlockContent(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.SemiPre.SemiPre.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSemiPre(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pSemiPreMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pSemiPreTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.SemiPre.SemiPreMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSemiPreMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fSemiPreMemoized)
yyColumn.chunk1.fSemiPreMemoized = pSemiPreMemoized$1(yyStart);
return yyColumn.chunk1.fSemiPreMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.SemiPre.SemiPreMemoized. */
private Result pSemiPreMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("SemiPre", getContext(), pSemiPreTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.SemiPre.SemiPreTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSemiPreTransient(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
int yyRepetition1;
Pair yyRepValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (accept(ParserAtoms.SEMI_PRE)) {
yyResult = pSemiPreLine(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
SemiPreLine first = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyPredResult = pslEol(yyRepetition1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pSemiPreLine(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
SemiPreLine v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new SemiPre(new NodeList(first, tail));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
}
// Done.
yyError = yyError.select("semi pre transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.SemiPre.SemiPreLine.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSemiPreLine(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyOption1;
String yyOpValue1;
SemiPreLine yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for rt0.
String rt0 = yyOpValue1;
yyResult = ppTpStar(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
yyC = character(yyResult.index);
if (' ' == yyC) {
yyIndex = yyResult.index + 1;
yyPredMatched = false;
yyPredResult = pOpenOrCloseMatch(yyIndex);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyResult = pSemiPreContentStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList content = yyResult.semanticValue();
yyValue = new SemiPreLine(content);
if (isGatherRtData())
addRtData(yyValue, joinRt(rt0, rt1, ' '), null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("semi pre line expected", yyStart);
}
}
}
} // End scope for rt0.
// Done.
yyError = yyError.select("semi pre line expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.SemiPre.OpenOrCloseMatch.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pOpenOrCloseMatch(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyOption1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyC = character(yyResult.index);
if ('<' == yyC) {
yyIndex = yyResult.index + 1;
yyOption1 = yyIndex;
yyC = character(yyOption1);
if ('/' == yyC) {
yyIndex = yyOption1 + 1;
yyOption1 = yyIndex;
}
final int yyChoice1 = yyOption1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case 'd':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('i' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('v' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
}
break;
case 'h':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
switch (yyC) {
case 'r':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '1':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '2':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '3':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '4':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '5':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '6':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
break;
case 'c':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('e' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('n' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('t' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('e' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('r' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
}
}
}
}
}
}
}
break;
case 'p':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
if ('r' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('e' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice2, yyError);
}
case 'b':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('l' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('o' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('c' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('k' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('q' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('u' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('o' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('t' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('e' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
break;
case 't':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
switch (yyC) {
case 'a':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('b' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('l' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('e' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
}
}
}
break;
case 'r':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case 'd':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case 'h':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
break;
case 'u':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('l' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case 'o':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('l' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case 'l':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('i' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
default:
/* No match. */
}
}
}
}
// Done.
yyError = yyError.select("open or close match expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.SemiPre.SemiPreContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSemiPreContentStar(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.SEMI_PRE);
yyResult = pContent$InlineContentStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Signature.Signature.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSignature(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('~' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('~' == yyC) {
yyIndex = yyIndex + 1;
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyResult = pSignatureChoice(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyValue = new Text("~~");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
// Done.
yyError = yyError.select("signature expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Signature.SignatureChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSignatureChoice(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
Tuple1 yyOpValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSignatureChoice$$Choice1(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String count = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pTooManyTildesWarning(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
Tuple1 v$el$5 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$5;
}
{ // Start scope for w.
Tuple1 w = yyOpValue1;
int tildes = 2 + count.length();
yyValue = new Signature(tildes);
if (w != null)
{
fileOddSyntaxWarning(
yyValue,
makeSpan(yyStart - 2, w._1),
WS_INFO,
"Signatures consist only of 3 to 5 tildes.");
}
if (isGatherRtData())
addRtData(yyValue, joinRt(StringUtils.strrep('~', tildes)));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for w.
}
// Alternative 2.
if (isWarningsEnabled()) {
yyResult = pSignatureAutoCorrect(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("signature choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.SignatureChoice$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSignatureChoice$$Choice1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('~' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('~' == yyC) {
yyIndex = yyIndex + 1;
yyC = character(yyIndex);
if ('~' == yyC) {
yyIndex = yyIndex + 1;
yyValue = "~~~";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Alternative 2.
yyC = character(yyStart);
if ('~' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('~' == yyC) {
yyIndex = yyIndex + 1;
yyValue = "~~";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 3.
yyC = character(yyStart);
if ('~' == yyC) {
yyIndex = yyStart + 1;
yyValue = "~";
return new SemanticValue(yyValue, yyIndex, yyError);
}
// Done.
yyError = yyError.select("signature choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Signature.SignatureAutoCorrect.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSignatureAutoCorrect(final int yyStart) throws IOException {
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isWarningLevelEnabled(WS_NONE)) {
yyValue = new Text("~~");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyStart),
WS_NONE,
"Signature",
"a signature consists of at least 3 tildes");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("signature auto correct expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Signature.TooManyTildesWarning.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTooManyTildesWarning(final int yyStart) throws IOException {
int yyC;
int yyPredIndex;
int yyRepetition1;
boolean yyRepeated1;
Tuple1 yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isWarningLevelEnabled(WS_NONE)) {
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyC = character(yyRepetition1);
if ('~' == yyC) {
yyPredIndex = yyRepetition1 + 1;
yyRepetition1 = yyPredIndex;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = Tuple.from(new Integer(yyRepetition1));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
}
// Done.
yyError = yyError.select("too many tildes warning expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.Table.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTable(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pTableMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pTableTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.TableMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fTableMemoized)
yyColumn.chunk1.fTableMemoized = pTableMemoized$1(yyStart);
return yyColumn.chunk1.fTableMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Table.TableMemoized. */
private Result pTableMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("Table", getContext(), pTableTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.TableTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableTransient(final int yyStart) throws IOException {
Result yyResult;
Table yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (accept(ParserAtoms.TABLE)) {
yyResult = pTableBody(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("table transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.TableBody.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableBody(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyBase;
int yyOption1;
String yyOpValue1;
Table yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableHead(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple3 head = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String rt2 = yyResult.semanticValue();
yyResult = pTableContentStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyBase = yyOption1;
yyC = character(yyBase);
if ('|' == yyC) {
yyIndex = yyOption1 + 1;
yyC = character(yyIndex);
if ('}' == yyC) {
yyIndex = yyIndex + 1;
String v$el$1 = "|}";
yyOption1 = yyIndex;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("'|}' expected", yyBase);
}
} else {
yyError = yyError.select("'|}' expected", yyBase);
}
{ // Start scope for close.
String close = yyOpValue1;
//yyValue = makeTable(head._2, body);
yyValue = new Table(head._2, body);
if (isGatherRtData())
addRtData(yyValue,
joinRt(head._1, "{|"),
joinRt(head._3, rt2),
joinRt(rt3, close));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for close.
}
}
}
// Nested alternative 2.
yyResult = p$$Shared7(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
//yyValue = makeTable(head._2, new NodeList());
yyValue = new Table(head._2, new NodeList());
if (isGatherRtData())
addRtData(yyValue,
joinRt(head._1, "{|"),
joinRt(head._3),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyPredResult = pShouldNotBeHere(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pSantiyCheckEnd(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.TableHead.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHead(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyBase;
Tuple3 yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('{' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('|' == yyC) {
yyIndex = yyIndex + 1;
yyResult = pTableAttributeStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList attrs = yyResult.semanticValue();
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt1 = yyResult.semanticValue();
yyValue = Tuple.from(rt0, attrs, rt1);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
} else {
yyError = yyError.select("'{|' expected", yyBase);
}
} else {
yyError = yyError.select("'{|' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.TableContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableContentStar(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.TABLE_ELEMENTS);
yyResult = pInlineBlockContent(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList garbage = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableElement(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for content.
Pair content = yyRepValue1.reverse();
yyValue = new NodeList(garbage, content);
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for content.
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Table.TableElement.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableElement(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = pTableElementPrefix(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pTableCaption(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pTableRow(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 3.
yyResult = pTableCell(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 4.
yyResult = pTableHeader(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyPredResult = pTableElement$$Choice1(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pSantiyCheckEnd(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.TableElement$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableElement$$Choice1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('|' == yyC) {
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
if ('}' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice2, yyError);
}
}
// Nested alternative 2.
yyPredMatched = false;
yyC = character(yyChoice1);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
} else {
yyError = yyError.select("table element expected", yyStart);
}
}
// Alternative 2.
yyResult = pShouldNotBeHere(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("table element expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Table.TableElementPrefix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableElementPrefix(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '|':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case '+':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '-':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyPredMatched = false;
yyC = character(yyChoice2);
if ('}' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyChoice2, yyError);
} else {
yyError = yyError.select("table element prefix expected", yyStart);
}
}
break;
case '!':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
// Done.
yyError = yyError.select("table element prefix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCaption.TableCaption.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableCaption(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pTableCaptionMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pTableCaptionTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCaption.TableCaptionMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableCaptionMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fTableCaptionMemoized)
yyColumn.chunk2.fTableCaptionMemoized = pTableCaptionMemoized$1(yyStart);
return yyColumn.chunk2.fTableCaptionMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableCaption.TableCaptionMemoized. */
private Result pTableCaptionMemoized$1(final int yyStart)
throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("TableCaption", getContext(), pTableCaptionTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCaption.TableCaptionTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableCaptionTransient(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('|' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('+' == yyC) {
yyIndex = yyIndex + 1;
yyResult = p$$Shared12(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple2 attributes = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = p$$Shared4(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyResult = pGarbage(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyPredResult = p$$Shared11(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new TableCaption(attributes._1, body);
// TODO: Issue warning if garbage is more than just whitespace
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, "|+"),
(Object[]) attributes._2,
joinRt(garbage));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
// Nested alternative 2.
yyResult = p$$Shared5(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyPredResult = p$$Shared11(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new TableCaption(attributes._1, body);
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, "|+"),
(Object[]) attributes._2,
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
} else {
yyError = yyError.select("'|+' expected", yyBase);
}
} else {
yyError = yyError.select("'|+' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.TableCaption.Garbage.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pGarbage(final int yyStart) throws IOException {
int yyC;
Result yyResult;
int yyPredIndex;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('|' == yyC) {
yyPredIndex = yyStart + 1;
yyC = character(yyPredIndex);
if ('|' == yyC) {
yyResult = pGarbageStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyResult = pGarbage$$Choice1(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String end = yyResult.semanticValue();
yyValue = garbage + end;
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Done.
yyError = yyError.select("garbage expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.Garbage$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pGarbage$$Choice1(final int yyStart) throws IOException {
int yyC;
Result yyResult;
boolean yyPredMatched;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative .
if (acceptEol()) {
yyResult = p$$Shared8(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = difference(yyStart, yyResult.index);
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyPredMatched = false;
yyC = character(yyStart);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = "";
return new SemanticValue(yyValue, yyStart, yyError);
} else {
yyError = yyError.select("garbage expected", yyStart);
}
// Done.
yyError = yyError.select("garbage expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCaption.GarbageStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pGarbageStar(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyPredMatched = false;
yyPredResult = pslEol(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredResult = ppExtSpaceStar(yyPredResult.index);
if (yyPredResult.hasValue()) {
yyC = character(yyPredResult.index);
if (-1 != yyC) {
if (('!' == yyC) ||
('|' == yyC)) {
yyPredMatched = true;
}
}
}
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
continue;
}
} else {
yyError = yyError.select("garbage star expected", yyStart);
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared11.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.TableCaption.FollowUpSanityCheck,
* org.sweble.wikitext.lazy.parser.TableCell.FollowUpSanityCheck,
* and org.sweble.wikitext.lazy.parser.TableHeader.FollowUpSanityCheck.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared11(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '!':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '|':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case '+':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '-':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '}':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice2, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyPredMatched = false;
yyC = character(yyChoice1);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
} else {
yyError = yyError.select(" expected", yyStart);
}
}
// Alternative 2.
yyResult = pShouldNotBeHere(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared12.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.TableCaption.Attributes
* and org.sweble.wikitext.lazy.parser.TableCell.Attributes.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared12(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.f$$Shared12)
yyColumn.chunk2.f$$Shared12 = p$$Shared12$1(yyStart);
return yyColumn.chunk2.f$$Shared12;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Grammar.$$Shared12. */
private Result p$$Shared12$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
Tuple2 yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = p$$Shared3(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pTableAttributeInlineStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList attrs = yyResult.semanticValue();
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode ws = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('|' == yyC) {
yyIndex = yyResult.index + 1;
yyPredMatched = false;
yyC = character(yyIndex);
if ('|' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = Tuple.from(attrs, (Object) joinRt(ws, '|'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select(" expected", yyStart);
}
}
}
}
}
// Alternative 2.
yyValue = Tuple.from(new NodeList(), null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared3.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.TableCaption.AttrPossible
* and org.sweble.wikitext.lazy.parser.TableCell.AttrPossible.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared3(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyPredIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if (-1 != yyC) {
if (('<' == yyC) ||
('|' == yyC)) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if ('[' == yyC) {
yyPredIndex = yyRepetition1 + 1;
yyC = character(yyPredIndex);
if ('[' == yyC) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyPredMatched = false;
yyPredResult = pslEol(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
continue;
}
} else {
yyError = yyError.select(" expected", yyStart);
}
} else {
yyError = yyError.select(" expected", yyStart);
}
} else {
yyError = yyError.select(" expected", yyStart);
}
break;
}
yyC = character(yyRepetition1);
if ('|' == yyC) {
yyIndex = yyRepetition1 + 1;
yyPredMatched = false;
yyC = character(yyIndex);
if ('|' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select(" expected", yyStart);
}
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared4.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.TableCaption.InlineContentStar
* and org.sweble.wikitext.lazy.parser.TableCell.InlineContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared4(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.TABLE_INLINE_CELL);
yyResult = pInlineContentPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared5.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.TableCaption.BlockContentStar,
* org.sweble.wikitext.lazy.parser.TableCell.BlockContentStar,
* and org.sweble.wikitext.lazy.parser.TableHeader.BlockContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared5(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.TABLE_CELL);
yyResult = pBlockContent(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.TableCell.TableCell.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableCell(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pTableCellMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pTableCellTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCell.TableCellMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableCellMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fTableCellMemoized)
yyColumn.chunk2.fTableCellMemoized = pTableCellMemoized$1(yyStart);
return yyColumn.chunk2.fTableCellMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableCell.TableCellMemoized. */
private Result pTableCellMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("TableCell", getContext(), pTableCellTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCell.TableCellTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableCellTransient(final int yyStart) throws IOException {
int yyC;
Result yyResult;
Result yyPredResult;
int yyOption1;
TableCell yyOpValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = ppExtSpaceStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyC = character(yyPredResult.index);
if ('|' == yyC) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pTableInlineCellPlus(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList inline = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pTableBlockCell(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
TableCell v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for last.
TableCell last = yyOpValue1;
yyValue = new NodeList(inline, last);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for last.
}
// Nested alternative 2.
yyResult = pTableBlockCell(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
TableCell header = yyResult.semanticValue();
yyValue = header;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
// Done.
yyError = yyError.select("table cell transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCell.TableInlineCellPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableInlineCellPlus(final int yyStart) throws IOException {
int yyC;
Result yyResult;
int yyPredIndex;
int yyBase;
int yyRepetition1;
boolean yyRepeated1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableInlineCell(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
TableCell v$el$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('|' == yyC) {
yyPredIndex = yyResult.index + 1;
yyC = character(yyPredIndex);
if ('|' == yyC) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
} else {
yyError = yyError.select("'||' expected", yyBase);
}
} else {
yyError = yyError.select("'||' expected", yyBase);
}
}
break;
}
if (yyRepeated1) {
Pair cells = yyRepValue1.reverse();
yyValue = new NodeList(cells);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCell.TableInlineCell.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableInlineCell(final int yyStart) throws IOException {
Result yyResult;
TableCell yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = p$$Shared15(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String prefix = yyResult.semanticValue();
yyResult = p$$Shared12(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple2 attributes = yyResult.semanticValue();
yyResult = p$$Shared4(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyValue = new TableCell(attributes._1, body);
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, prefix),
(Object[]) attributes._2,
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared15.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Grammar.TableInlineCell$$Choice1
* and org.sweble.wikitext.lazy.parser.Grammar.TableBlockCell$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared15(final int yyStart) throws IOException {
int yyC;
int yyIndex;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('|' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('|' == yyC) {
yyIndex = yyIndex + 1;
yyValue = "||";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 2.
yyC = character(yyStart);
if ('|' == yyC) {
yyIndex = yyStart + 1;
yyValue = "|";
return new SemanticValue(yyValue, yyIndex, yyError);
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableCell.TableBlockCell.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableBlockCell(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
TableCell yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = p$$Shared15(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String prefix = yyResult.semanticValue();
yyResult = p$$Shared12(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple2 attributes = yyResult.semanticValue();
yyResult = p$$Shared5(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyPredResult = p$$Shared11(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new TableCell(attributes._1, body);
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, prefix),
(Object[]) attributes._2,
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.TableHeader.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHeader(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) pTableHeaderMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pTableHeaderTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.TableHeaderMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHeaderMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fTableHeaderMemoized)
yyColumn.chunk2.fTableHeaderMemoized = pTableHeaderMemoized$1(yyStart);
return yyColumn.chunk2.fTableHeaderMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableHeader.TableHeaderMemoized. */
private Result pTableHeaderMemoized$1(final int yyStart)
throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("TableHeader", getContext(), pTableHeaderTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.TableHeaderTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHeaderTransient(final int yyStart) throws IOException {
int yyC;
Result yyResult;
Result yyPredResult;
int yyOption1;
TableHeader yyOpValue1;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = ppExtSpaceStar(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyC = character(yyPredResult.index);
if ('!' == yyC) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pTableInlineHeaderPlus(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList inline = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pTableBlockHeader(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
TableHeader v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for last.
TableHeader last = yyOpValue1;
yyValue = new NodeList(inline, last);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for last.
}
// Nested alternative 2.
yyResult = pTableBlockHeader(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
TableHeader header = yyResult.semanticValue();
yyValue = header;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
// Done.
yyError = yyError.select("table header transient expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.TableInlineHeaderPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableInlineHeaderPlus(final int yyStart)
throws IOException {
Result yyResult;
Result yyPredResult;
int yyRepetition1;
boolean yyRepeated1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableInlineHeader(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
TableHeader v$el$1 = yyResult.semanticValue();
yyPredResult = pTableInlineHeaderPlus$$Choice1(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
}
break;
}
if (yyRepeated1) {
Pair headers = yyRepValue1.reverse();
yyValue = new NodeList(headers);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.TableInlineHeaderPlus$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableInlineHeaderPlus$$Choice1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '|':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('|' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '!':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('!' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("table inline header plus expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.TableInlineHeader.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableInlineHeader(final int yyStart) throws IOException {
Result yyResult;
TableHeader yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = p$$Shared16(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String prefix = yyResult.semanticValue();
yyResult = pTableHeader$Attributes(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple2 attributes = yyResult.semanticValue();
yyResult = pTableHeader$InlineContentStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyValue = new TableHeader(attributes._1, body);
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, prefix),
(Object[]) attributes._2,
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared16.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Grammar.TableInlineHeader$$Choice1
* and org.sweble.wikitext.lazy.parser.Grammar.TableBlockHeader$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared16(final int yyStart) throws IOException {
int yyC;
int yyIndex;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('!' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('!' == yyC) {
yyIndex = yyIndex + 1;
yyValue = "!!";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 2.
yyC = character(yyStart);
if ('|' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('|' == yyC) {
yyIndex = yyIndex + 1;
yyValue = "||";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 3.
yyC = character(yyStart);
if ('!' == yyC) {
yyIndex = yyStart + 1;
yyValue = "!";
return new SemanticValue(yyValue, yyIndex, yyError);
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.TableBlockHeader.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableBlockHeader(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
TableHeader yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyResult = p$$Shared16(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String prefix = yyResult.semanticValue();
yyResult = pTableHeader$Attributes(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple2 attributes = yyResult.semanticValue();
yyResult = p$$Shared5(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyPredResult = p$$Shared11(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new TableHeader(attributes._1, body);
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, prefix),
(Object[]) attributes._2,
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.TableHeader.Attributes.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHeader$Attributes(final int yyStart)
throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fTableHeader$Attributes)
yyColumn.chunk2.fTableHeader$Attributes = pTableHeader$Attributes$1(yyStart);
return yyColumn.chunk2.fTableHeader$Attributes;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableHeader.Attributes. */
private Result pTableHeader$Attributes$1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
Tuple2 yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = pTableHeader$AttrPossible(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pTableAttributeInlineStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList attrs = yyResult.semanticValue();
yyResult = ppExtSpaceStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode ws = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('|' == yyC) {
yyIndex = yyResult.index + 1;
yyPredMatched = false;
yyC = character(yyIndex);
if ('|' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = Tuple.from(attrs, (Object) joinRt(ws, '|'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select("attributes expected", yyStart);
}
}
}
}
}
// Alternative 2.
yyValue = Tuple.from(new NodeList(), null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.AttrPossible.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHeader$AttrPossible(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
int yyPredIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if (-1 != yyC) {
if (('<' == yyC) ||
('|' == yyC)) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if ('[' == yyC) {
yyPredIndex = yyRepetition1 + 1;
yyC = character(yyPredIndex);
if ('[' == yyC) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if ('!' == yyC) {
yyPredIndex = yyRepetition1 + 1;
yyC = character(yyPredIndex);
if ('!' == yyC) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyPredMatched = false;
yyPredResult = pslEol(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
continue;
}
} else {
yyError = yyError.select("attr possible expected", yyStart);
}
} else {
yyError = yyError.select("attr possible expected", yyStart);
}
} else {
yyError = yyError.select("attr possible expected", yyStart);
}
} else {
yyError = yyError.select("attr possible expected", yyStart);
}
break;
}
{ // Start scope for nested choice.
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '|':
{
yyPredMatched = false;
yyC = character(yyIndex);
if ('|' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select("attr possible expected", yyStart);
}
}
break;
case '!':
{
yyPredMatched = false;
yyC = character(yyIndex);
if ('!' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select("attr possible expected", yyStart);
}
}
break;
default:
/* No match. */
}
}
} // End scope for nested choice.
// Done.
yyError = yyError.select("attr possible expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableHeader.InlineContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableHeader$InlineContentStar(final int yyStart)
throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.TABLE_INLINE_HEADER);
yyResult = pInlineContentPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.TableRow.TableRow.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRow(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
final StateAwareResult r = (StateAwareResult) pTableRowMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, pTableRowTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableRow.TableRowMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fTableRowMemoized)
yyColumn.chunk2.fTableRowMemoized = pTableRowMemoized$1(yyStart);
return yyColumn.chunk2.fTableRowMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableRow.TableRowMemoized. */
private Result pTableRowMemoized$1(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
final Result yyResult = new StateAwareResult("TableRow", getContext(), pTableRowTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableRow.TableRowTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowTransient(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('|' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('-' == yyC) {
yyIndex = yyIndex + 1;
yyResult = pTableAttributeStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList attributes = yyResult.semanticValue();
yyResult = pTableRowBody(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
Tuple3 body = yyResult.semanticValue();
yyValue = new TableRow(attributes, body._3);
if (isGatherRtData())
addRtData(yyValue,
joinRt(rt0, "|-"),
joinRt(body._1, body._2),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
} else {
yyError = yyError.select("'|-' expected", yyBase);
}
} else {
yyError = yyError.select("'|-' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.TableRow.TableRowBody.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowBody(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
Tuple3 yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode rt0 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pEol(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String rt1 = yyResult.semanticValue();
yyResult = pTableRowContentStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList body = yyResult.semanticValue();
yyValue = Tuple.from(rt0, rt1, body);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Nested alternative 2.
yyResult = p$$Shared7(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
// Warning will be issued by the surrounding table.
yyValue = Tuple.from(rt0, "", new NodeList());
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyPredResult = pShouldNotBeHere(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pSantiyCheckEnd(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableRow.TableRowContentStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowContentStar(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
enter(ParserScopes.TABLE_ELEMENTS);
yyResult = pBolBlockContent(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList garbage = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableRowElement(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for content.
Pair content = yyRepValue1.reverse();
yyValue = new NodeList(garbage, new NodeList(content));
// Commit the state modification.
yyState.commit();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for content.
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableRow.TableRowElement.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowElement(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = pTableRowElementPrefix(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pTableCell(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pTableHeader(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyPredResult = pTableRowElement$$Choice1(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pSantiyCheckEnd(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.TableRowElement$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowElement$$Choice1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('|' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
switch (yyC) {
case '+':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '-':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '}':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
}
// Nested alternative 2.
yyPredMatched = false;
yyC = character(yyChoice1);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
} else {
yyError = yyError.select("table row element expected", yyStart);
}
}
// Alternative 2.
yyResult = pShouldNotBeHere(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("table row element expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableRow.TableRowElementPrefix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableRowElementPrefix(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '|':
{
yyPredMatched = false;
yyC = character(yyIndex);
if (-1 != yyC) {
if (('+' == yyC) ||
('-' == yyC) ||
('}' == yyC)) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select("table row element prefix expected", yyStart);
}
}
break;
case '!':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
// Done.
yyError = yyError.select("table row element prefix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pSpaceStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result porg$sweble$wikitext$lazy$parser$Whitespace$pSpaceStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyResult = p$$Shared6(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared13.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Whitespace.pSpacePlus
* and Whitespace.pSpacePlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared13(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyResult = p$$Shared6(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared6.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Whitespace.pSpace and Whitespace.pSpace.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared6(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case ' ':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\t':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pWsPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result porg$sweble$wikitext$lazy$parser$Whitespace$pWsPlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyResult =
porg$sweble$wikitext$lazy$parser$Whitespace$pWhitespace(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pWhitespace.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result porg$sweble$wikitext$lazy$parser$Whitespace$pWhitespace(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case ' ':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\t':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative .
if (acceptEol()) {
yyResult = p$$Shared8(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("p whitespace expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pEol.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result porg$sweble$wikitext$lazy$parser$Whitespace$pEol(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative .
if (acceptEol()) {
yyResult = p$$Shared8(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = difference(yyStart, yyResult.index);
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("p eol expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared7.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Whitespace.Eof and Whitespace.Eof.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared7(final int yyStart) throws IOException {
int yyC;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredMatched = false;
yyC = character(yyStart);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
} else {
yyError = yyError.select(" expected", yyStart);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared8.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.parser.Whitespace.pSlEol and Whitespace.pEol.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared8(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\r':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('\n' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\n':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2028':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2029':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u000b':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u0085':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.slEol.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pslEol(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\r':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('\n' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\n':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2028':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2029':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u000b':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u0085':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("sl eol expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.slEolOrEof.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pslEolOrEof(final int yyStart) throws IOException {
int yyC;
int yyIndex;
boolean yyPredMatched;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\r':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('\n' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\n':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2028':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2029':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u000b':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u0085':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 2.
yyPredMatched = false;
yyC = character(yyStart);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
} else {
yyError = yyError.select("sl eol or eof expected", yyStart);
}
// Done.
yyError = yyError.select("sl eol or eof expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pTpStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppTpStar(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fpTpStar)
yyColumn.chunk2.fpTpStar = ppTpStar$1(yyStart);
return yyColumn.chunk2.fpTpStar;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Whitespace.pTpStar. */
private Result ppTpStar$1(final int yyStart) throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pptTpStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.ptTpStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pptTpStar(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pParserEntityXmlCommentOrIgnore(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tp.
Pair tp = yyRepValue1.reverse();
yyValue = new NodeList(tp);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tp.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Whitespace.pExtSpaceStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppExtSpaceStar(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fpExtSpaceStar)
yyColumn.chunk2.fpExtSpaceStar = ppExtSpaceStar$1(yyStart);
return yyColumn.chunk2.fpExtSpaceStar;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Whitespace.pExtSpaceStar. */
private Result ppExtSpaceStar$1(final int yyStart) throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pptExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Whitespace.ptExtSpaceStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pptExtSpaceStar(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = ppExtSpaceAtom(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for s.
Pair s = yyRepValue1.reverse();
yyValue = new NodeList(s);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for s.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Whitespace.ptExtSpacePlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pptExtSpacePlus(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = ppExtSpaceAtom(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
Pair s = yyRepValue1.reverse();
yyValue = new NodeList(s);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Whitespace.pExtSpaceAtom.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppExtSpaceAtom(final int yyStart) throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = p$$Shared13(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String spaces = yyResult.semanticValue();
yyValue = new Text(spaces);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pParserEntity(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (isXmlCommentOrIgnored(yyValue)) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("p ext space atom expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pExtWsStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppExtWsStar(final int yyStart) throws IOException {
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
StateAwareResult r = (StateAwareResult) ppExtWsStarMemoized(yyBase);
final LazyParserContext context = getContext();
Result yyResult = r.getResult(context);
if (yyResult == null)
yyResult = r.setResult(context, ppExtWsStarTransient(yyBase));
if (returnTrue(r))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Whitespace.pExtWsStarMemoized.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppExtWsStarMemoized(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fpExtWsStarMemoized)
yyColumn.chunk2.fpExtWsStarMemoized = ppExtWsStarMemoized$1(yyStart);
return yyColumn.chunk2.fpExtWsStarMemoized;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Whitespace.pExtWsStarMemoized. */
private Result ppExtWsStarMemoized$1(final int yyStart) throws IOException {
int yyBase;
Whitespace yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyBase = yyStart;
Result yyResult = new StateAwareResult("pExtWsPlus", getContext(), ppExtWsStarTransient(yyBase));
if (returnTrue(yyResult))
return yyResult;
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.Whitespace.pExtWsStarTransient.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppExtWsStarTransient(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
Whitespace yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ppExtSpaceStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode s = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = ppExtWsAtom(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for ws.
Pair ws = yyRepValue1.reverse();
yyValue = new Whitespace(new NodeList(s, ws), !ws.isEmpty());
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for ws.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Whitespace.pExtWsAtom.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ppExtWsAtom(final int yyStart) throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = porg$sweble$wikitext$lazy$parser$Whitespace$pWsPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String ws = yyResult.semanticValue();
yyValue = new Text(ws);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pParserEntity(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (isXmlCommentOrIgnored(yyValue)) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("p ext ws atom expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlReference.XmlReference.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlReference(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fXmlReference)
yyColumn.chunk2.fXmlReference = pXmlReference$1(yyStart);
return yyColumn.chunk2.fXmlReference;
}
/** Actually parse org.sweble.wikitext.lazy.utils.XmlReference.XmlReference. */
private Result pXmlReference$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('&' == yyC) {
yyIndex = yyStart + 1;
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyResult = pXmlReferenceChoice(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyValue = new Text("&");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
// Done.
yyError = yyError.select("xml reference expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlReference.XmlReferenceChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlReferenceChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('#' == yyC) {
yyIndex = yyStart + 1;
yyResult = pXmlCharRefChoice(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pXmlName(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String name = yyResult.semanticValue();
yyC = character(yyResult.index);
if (';' == yyC) {
yyIndex = yyResult.index + 1;
// TODO: check if valid entity name
// TODO: add warnings for incomplete syntax
// TODO: make sure only valid characters are "generated" (encval)
yyValue = new XmlEntityRef(name);
if (isGatherRtData())
addRtData(yyValue, joinRt('&', name, ';'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 3.
if (isWarningsEnabled()) {
yyResult = pXmlReferenceAutoCorrect(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("xml reference choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlReference.XmlReferenceAutoCorrect.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlReferenceAutoCorrect(final int yyStart)
throws IOException {
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isWarningLevelEnabled(WS_INFO)) {
yyValue = new Text("&");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 1, yyStart),
WS_INFO,
"XML Reference",
"the entity name or character code is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("xml reference auto correct expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlReference.XmlCharRefChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlCharRefChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('x' == yyC) {
yyIndex = yyStart + 1;
yyResult = pHexDigitPlus(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String ch = yyResult.semanticValue();
yyC = character(yyResult.index);
if (';' == yyC) {
yyIndex = yyResult.index + 1;
// TODO: check if valid char ref
// TODO: add warnings for incomplete syntax
// TODO: make sure only valid characters are "generated" (encval)
yyValue = new XmlCharRef(Integer.parseInt(ch, 16));
if (isGatherRtData())
addRtData(yyValue, joinRt("", ch, ';'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Alternative 2.
yyResult = pDigitPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String ch = yyResult.semanticValue();
yyC = character(yyResult.index);
if (';' == yyC) {
yyIndex = yyResult.index + 1;
// TODO: check if valid char ref
// TODO: add warnings for incomplete syntax
// TODO: make sure only valid characters are "generated" (encval)
yyValue = new XmlCharRef(Integer.parseInt(ch));
if (isGatherRtData())
addRtData(yyValue, joinRt("", ch, ';'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Done.
yyError = yyError.select("xml char ref choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.MagicWord.MagicWord.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMagicWord(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('_' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('_' == yyC) {
yyIndex = yyIndex + 1;
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyResult = pMagicWordChoice(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyValue = new Text("__");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
// Done.
yyError = yyError.select("magic word expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.MagicWord.MagicWordChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMagicWordChoice(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pWord(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String word = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('_' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('_' == yyC) {
yyIndex = yyIndex + 1;
yyValue = new MagicWord(word);
if (isGatherRtData())
addRtData(yyValue, joinRt("__", word, "__"));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select("'__' expected", yyBase);
}
} else {
yyError = yyError.select("'__' expected", yyBase);
}
}
// Alternative 2.
if (isWarningsEnabled()) {
yyResult = pMagicWordAutoCorrect(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("magic word choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.MagicWord.MagicWordAutoCorrect.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMagicWordAutoCorrect(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyBase;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
if (isAutoCorrect(WS_NORMAL)) {
yyResult = pWord(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String word = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('_' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = new MagicWord(word);
if (isGatherRtData())
addRtData(yyValue, joinRt("__", word, "__"));
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyIndex),
WS_NORMAL,
"Magic Word",
"the finishing `_' is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Alternative 2.
if (isWarningLevelEnabled(WS_NORMAL)) {
yyResult = pWordString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String word = yyResult.semanticValue();
yyBase = yyResult.index;
yyC = character(yyBase);
if ('_' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('_' == yyC) {
yyIndex = yyIndex + 1;
yyValue = new Text("__" + word + "__");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyIndex),
WS_NORMAL,
"Magic Word",
"the word itself is not a magic word (unknown)");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
} else {
yyError = yyError.select("'__' expected", yyBase);
}
} else {
yyError = yyError.select("'__' expected", yyBase);
}
}
}
// Alternative 3.
if (isAutoCorrect(WS_INFO)) {
yyResult = pWord(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String word = yyResult.semanticValue();
yyValue = new MagicWord(word);
if (isGatherRtData())
addRtData(yyValue, joinRt("__", word));
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyResult),
WS_INFO,
"Magic Word",
"the finishing `__' is missing");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 4.
if (isWarningLevelEnabled(WS_NONE)) {
yyPredResult = pWordString(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new Text("__");
fileLooksLikeWarning(
yyValue,
makeSpan(yyStart - 2, yyPredResult),
WS_NONE,
"Magic Word",
"the word itself is missing or not recognized as a magic word");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
}
// Done.
yyError = yyError.select("magic word auto correct expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.MagicWord.Word.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWord(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pWordString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (isMagicWord(yyValue)) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("word expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.MagicWord.WordString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWordString(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if ('-' == yyC) {
yyIndex = yyChoice1 + 1;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
// Nested alternative 2.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('A' <= yyC) && (yyC <= 'Z')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 3.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('a' <= yyC) && (yyC <= 'z')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 4.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
case '\u00b7':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
// Nested alternative 5.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u00c0' <= yyC) && (yyC <= '\u00d6')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 6.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u00d8' <= yyC) && (yyC <= '\u00f6')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 7.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u00f8' <= yyC) && (yyC <= '\u02ff')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 8.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\u0370':
case '\u0371':
case '\u0372':
case '\u0373':
case '\u0374':
case '\u0375':
case '\u0376':
case '\u0377':
case '\u0378':
case '\u0379':
case '\u037a':
case '\u037b':
case '\u037c':
case '\u037d':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
// Nested alternative 9.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u037f' <= yyC) && (yyC <= '\u1fff')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 10.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\u200c':
case '\u200d':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
// Nested alternative 11.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u2070' <= yyC) && (yyC <= '\u218f')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 12.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u2c00' <= yyC) && (yyC <= '\u2fef')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 13.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u3001' <= yyC) && (yyC <= '\ud7ff')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 14.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\uf900' <= yyC) && (yyC <= '\ufdcf')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 15.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\ufdf0' <= yyC) && (yyC <= '\ufffd')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 16.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if (('\u0300' <= yyC) && (yyC <= '\u036f')) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
// Nested alternative 17.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\u203f':
case '\u2040':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("word string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ParserEntity.ParserEntity.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParserEntity(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fParserEntity)
yyColumn.chunk3.fParserEntity = pParserEntity$1(yyStart);
return yyColumn.chunk3.fParserEntity;
}
/** Actually parse org.sweble.wikitext.lazy.parser.ParserEntity.ParserEntity. */
private Result pParserEntity$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('\ue000' == yyC) {
yyIndex = yyStart + 1;
yyResult = pDecimalNumeral(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String id = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\ue001' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = getEntity(Integer.parseInt(id));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Done.
yyError = yyError.select("parser entity expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.ParserEntity.ParserEntityXmlCommentOrIgnore.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParserEntityXmlCommentOrIgnore(final int yyStart)
throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pParserEntity(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (isXmlCommentOrIgnored(yyValue)) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("parser entity xml comment or ignore expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Ticks.Ticks.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTicks(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
Pair yyRepValue1;
Ticks yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('\'' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('\'' == yyC) {
yyIndex = yyIndex + 1;
yyRepetition1 = yyIndex;
yyRepValue1 = Pair.empty();
while (true) {
yyC = character(yyRepetition1);
if ('\'' == yyC) {
yyIndex = yyRepetition1 + 1;
char v$el$1 = (char)yyC;
yyRepetition1 = yyIndex;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for ticks.
Pair ticks = yyRepValue1.reverse();
int count = 2 + ticks.size();
yyValue = new Ticks(count);
if (isGatherRtData())
addRtData(yyValue, joinRt(StringUtils.strrep('\'', count)));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for ticks.
}
}
// Done.
yyError = yyError.select("ticks expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Url.Url.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pUrl(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fUrl) yyColumn.chunk3.fUrl = pUrl$1(yyStart);
return yyColumn.chunk3.fUrl;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Url.Url. */
private Result pUrl$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Url yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = ptUrlProtocolString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String protocol = yyResult.semanticValue();
yyC = character(yyResult.index);
if (':' == yyC) {
yyIndex = yyResult.index + 1;
yyResult = pUrlPathString(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String path = yyResult.semanticValue();
if (isProtocol(protocol, path)) {
yyValue = new Url(protocol, path);
if (isGatherRtData())
addRtData(yyValue, joinRt(protocol, ':', path));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
}
// Done.
yyError = yyError.select("url expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Url.UrlPathString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pUrlPathString(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fUrlPathString)
yyColumn.chunk3.fUrlPathString = pUrlPathString$1(yyStart);
return yyColumn.chunk3.fUrlPathString;
}
/** Actually parse org.sweble.wikitext.lazy.parser.Url.UrlPathString. */
private Result pUrlPathString$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if (-1 != yyC) {
if (('\u0000' <= yyC) && (yyC <= ' ')) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '\"':
case '<':
case '>':
case '[':
case ']':
case '|':
case '\u007f':
case '\u0085':
case '\u2028':
case '\u2029':
case '\ue000':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("url path string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("url path string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.Url.tUrlProtocolString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result ptUrlProtocolString(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if ((('A' <= yyC) && (yyC <= 'Z')) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyRepetition1 = yyIndex;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
if (('+' == yyC) ||
(('-' <= yyC) && (yyC <= '.')) ||
(('0' <= yyC) && (yyC <= '9')) ||
(('A' <= yyC) && (yyC <= 'Z')) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyRepetition1 = yyIndex;
continue;
}
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
}
// Done.
yyError = yyError.select("t url protocol string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.XmlElement.XmlElement.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlElement(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if ('<' == yyC) {
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('/' == yyC) {
yyResult = pXmlElementClose(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
}
// Nested alternative 2.
{ // Start scope for nested choice.
final int yyChoice2 = yyChoice1;
// Nested alternative 1.
yyResult = pXmlElementOpen(yyChoice2);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyValue = new Text("<");
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice2, yyError);
} // End scope for nested choice.
}
}
// Done.
yyError = yyError.select("xml element expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.XmlElement.XmlElementClose.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlElementClose(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlName(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String name = yyResult.semanticValue();
yyResult = pWhitespace$pWsStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String ws = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('>' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = new XmlElementClose(name);
if (isGatherRtData())
addRtData(yyValue, joinRt("", name, ws, '>'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Done.
yyError = yyError.select("xml element close expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.XmlElement.XmlElementOpen.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlElementOpen(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlName(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String name = yyResult.semanticValue();
yyResult = pAttributeStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList attributes = yyResult.semanticValue();
yyResult = pWhitespace$pWsStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String ws = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '/':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('>' == yyC) {
yyValue = new XmlElementEmpty(name, attributes);
if (isGatherRtData())
addRtData(yyValue,
joinRt("<", name),
joinRt(ws, "/>"));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '>':
{
yyValue = new XmlElementOpen(name, attributes);
if (isGatherRtData())
addRtData(yyValue,
joinRt('<', name),
joinRt(ws, '>'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
}
}
// Done.
yyError = yyError.select("xml element open expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.XmlElement.AttributeStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeStar(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
int yyOption1;
NodeList yyOpValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyPredResult = pWhitespace$pWsPlus(yyOption1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pXmlAttribute$tXmlAttributePlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
NodeList v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
}
{ // Start scope for yyValue.
yyValue = yyOpValue1;
if (yyValue == null)
yyValue = new NodeList();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for yyValue.
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.Numbers.DecimalNumeral.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDecimalNumeral(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '0':
{
yyValue = "0";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyResult = pDigitStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = difference(yyStart, yyResult.index);
return yyResult.createValue(yyValue, yyError);
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("decimal numeral expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.Numbers.DigitStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDigitStar(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyRepetition1 = yyIndex;
continue;
}
default:
/* No match. */
}
}
break;
}
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.Numbers.DigitPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDigitPlus(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("digit plus expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.Numbers.HexDigitPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHexDigitPlus(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
default:
/* No match. */
}
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("hex digit plus expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.LinkTarget.LinkTarget.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkTarget(final int yyStart) throws IOException {
Result yyResult;
LinkTarget yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pLinkTargetString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String target = yyResult.semanticValue();
yyValue = new LinkTarget(target);
if (isGatherRtData())
addRtData(yyValue, joinRt(target));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.LinkTarget.LinkTargetString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLinkTargetString(final int yyStart) throws IOException {
int yyC;
int yyIndex;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyC = character(yyRepetition1);
if (-1 != yyC) {
if (('\u0000' <= yyC) && (yyC <= '\u001f')) {
yyPredMatched = true;
}
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '<':
case '>':
case '[':
case ']':
case '{':
case '|':
case '}':
case '\u007f':
case '\ufffd':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("link target string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("link target string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.Assert.SantiyCheckEnd.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSantiyCheckEnd(final int yyStart) throws IOException {
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyValue = null;
if (returnFalse()) {
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("santiy check end expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.Assert.ShouldNotBeHere.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pShouldNotBeHere(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pThrowShouldNotBeHereException(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.Assert.ThrowShouldNotBeHereException.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pThrowShouldNotBeHereException(final int yyStart)
throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pErrorContextString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String context = yyResult.semanticValue();
throwShouldNotBeHereException(yyStart, context);
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.Assert.ErrorContextString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pErrorContextString(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyOption1;
int yyOption2;
int yyOption3;
int yyOption4;
int yyOption5;
int yyOption6;
int yyOption7;
int yyOption8;
int yyOption9;
int yyOption10;
int yyOption11;
int yyOption12;
int yyOption13;
int yyOption14;
int yyOption15;
int yyOption16;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
yyOption2 = yyIndex;
yyC = character(yyOption2);
if (-1 != yyC) {
yyIndex = yyOption2 + 1;
yyOption3 = yyIndex;
yyC = character(yyOption3);
if (-1 != yyC) {
yyIndex = yyOption3 + 1;
yyOption4 = yyIndex;
yyC = character(yyOption4);
if (-1 != yyC) {
yyIndex = yyOption4 + 1;
yyOption5 = yyIndex;
yyC = character(yyOption5);
if (-1 != yyC) {
yyIndex = yyOption5 + 1;
yyOption6 = yyIndex;
yyC = character(yyOption6);
if (-1 != yyC) {
yyIndex = yyOption6 + 1;
yyOption7 = yyIndex;
yyC = character(yyOption7);
if (-1 != yyC) {
yyIndex = yyOption7 + 1;
yyOption8 = yyIndex;
yyC = character(yyOption8);
if (-1 != yyC) {
yyIndex = yyOption8 + 1;
yyOption9 = yyIndex;
yyC = character(yyOption9);
if (-1 != yyC) {
yyIndex = yyOption9 + 1;
yyOption10 = yyIndex;
yyC = character(yyOption10);
if (-1 != yyC) {
yyIndex = yyOption10 + 1;
yyOption11 = yyIndex;
yyC = character(yyOption11);
if (-1 != yyC) {
yyIndex = yyOption11 + 1;
yyOption12 = yyIndex;
yyC = character(yyOption12);
if (-1 != yyC) {
yyIndex = yyOption12 + 1;
yyOption13 = yyIndex;
yyC = character(yyOption13);
if (-1 != yyC) {
yyIndex = yyOption13 + 1;
yyOption14 = yyIndex;
yyC = character(yyOption14);
if (-1 != yyC) {
yyIndex = yyOption14 + 1;
yyOption15 = yyIndex;
yyC = character(yyOption15);
if (-1 != yyC) {
yyIndex = yyOption15 + 1;
yyOption16 = yyIndex;
yyC = character(yyOption16);
if (-1 != yyC) {
yyIndex = yyOption16 + 1;
yyOption16 = yyIndex;
}
yyOption15 = yyOption16;
}
yyOption14 = yyOption15;
}
yyOption13 = yyOption14;
}
yyOption12 = yyOption13;
}
yyOption11 = yyOption12;
}
yyOption10 = yyOption11;
}
yyOption9 = yyOption10;
}
yyOption8 = yyOption9;
}
yyOption7 = yyOption8;
}
yyOption6 = yyOption7;
}
yyOption5 = yyOption6;
}
yyOption4 = yyOption5;
}
yyOption3 = yyOption4;
}
yyOption2 = yyOption3;
}
yyOption1 = yyOption2;
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.XmlAttributeStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$XmlAttributeStar(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
NodeList yyOpValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pTableAttribute$tXmlAttributePlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
NodeList v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for yyValue.
yyValue = yyOpValue1;
if (yyValue == null)
yyValue = new NodeList();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for yyValue.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.XmlAttrGarbageStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$XmlAttrGarbageStopper(final int yyStart)
throws IOException {
Result yyPredResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = p$$Shared8(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.XmlAttrValueStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$XmlAttrValueStopper(final int yyStart)
throws IOException {
int yyC;
Result yyPredResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('<' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Alternative 2.
yyPredResult = p$$Shared8(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("xml attr value stopper expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.tXmlAttributePlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$tXmlAttributePlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttribute$XmlHeadAttributeChoice(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode head = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttribute$XmlTailAttributeChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.XmlHeadAttributeChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$XmlHeadAttributeChoice(final int yyStart)
throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttribute$ValidXmlAttribute(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pTableAttribute$GarbageString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyValue = new XmlAttributeGarbage(garbage);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.XmlTailAttributeChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$XmlTailAttributeChoice(final int yyStart)
throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = p$$Shared13(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pTableAttribute$ValidXmlAttribute(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pTableAttribute$GarbageString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyValue = new XmlAttributeGarbage(garbage);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.GarbageString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$GarbageString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttribute$GarbageStringStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
} else {
yyError = yyError.select("garbage string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("garbage string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.GarbageStringStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$GarbageStringStopper(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyResult = pTableAttribute$XmlAttrGarbageStopper(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = p$$Shared13(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableAttribute$ValidXmlAttribute(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValidXmlAttribute.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValidXmlAttribute(final int yyStart)
throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fTableAttribute$ValidXmlAttribute)
yyColumn.chunk3.fTableAttribute$ValidXmlAttribute = pTableAttribute$ValidXmlAttribute$1(yyStart);
return yyColumn.chunk3.fTableAttribute$ValidXmlAttribute;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableAttribute.ValidXmlAttribute. */
private Result pTableAttribute$ValidXmlAttribute$1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyOption1;
String yyOpValue1;
XmlAttribute yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for ws0.
String ws0 = yyOpValue1;
yyResult = pXmlName(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String name = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for ws1.
String ws1 = yyOpValue1;
yyC = character(yyOption1);
if ('=' == yyC) {
yyIndex = yyOption1 + 1;
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyOption1 = yyChoice2;
yyOpValue1 = null;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for ws2.
String ws2 = yyOpValue1;
final int yyChoice3 = yyOption1;
// Nested alternative 1.
yyC = character(yyChoice3);
if (-1 != yyC) {
yyIndex = yyChoice3 + 1;
switch (yyC) {
case '\'':
{
yyResult = pTableAttribute$ValueSqStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\'' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pTableAttribute$AttrEnd(yyIndex);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '=', ws2, '\''),
joinRt('\''));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
break;
case '\"':
{
yyResult = pTableAttribute$ValueDqStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\"' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pTableAttribute$AttrEnd(yyIndex);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '=', ws2, '"'),
joinRt('"'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
break;
default:
/* No match. */
}
}
} // End scope for ws2.
// Nested alternative 2.
yyResult = pTableAttribute$ValueNqStar(yyChoice2);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyPredResult = pTableAttribute$AttrEnd(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '='),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
} // End scope for ws1.
// Nested alternative 2.
yyPredResult = pTableAttribute$AttrEnd(yyChoice1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, false);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
} // End scope for ws0.
// Done.
yyError = yyError.select("valid xml attribute expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.parser.TableAttribute.AttrEnd.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$AttrEnd(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyResult = p$$Shared6(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('<' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Alternative 3.
yyPredResult = p$$Shared8(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Alternative 4.
yyPredMatched = false;
yyC = character(yyStart);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
} else {
yyError = yyError.select("attr end expected", yyStart);
}
// Done.
yyError = yyError.select("attr end expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueSqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueSqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttribute$ValueSqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueSqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueSqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttribute$ValueSqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value sq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueSqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueSqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttribute$XmlAttrValueStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '&':
case '\'':
case '<':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("value sq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value sq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueDqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueDqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttribute$ValueDqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueDqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueDqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttribute$ValueDqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value dq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueDqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueDqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttribute$XmlAttrValueStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '\"':
case '&':
case '<':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("value dq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value dq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueNqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueNqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttribute$ValueNqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueNqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueNqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttribute$ValueNqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value nq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.ValueNqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttribute$ValueNqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttribute$XmlAttrValueStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
if (('!' == yyC) ||
(('#' <= yyC) && (yyC <= '%')) ||
(('(' <= yyC) && (yyC <= '*')) ||
((',' <= yyC) && (yyC <= '<')) ||
(('?' <= yyC) && (yyC <= '[')) ||
((']' <= yyC) && (yyC <= '~'))) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
} else {
yyError = yyError.select("value nq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value nq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttribute.TableAttributeStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeStar(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fTableAttributeStar)
yyColumn.chunk3.fTableAttributeStar = pTableAttributeStar$1(yyStart);
return yyColumn.chunk3.fTableAttributeStar;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableAttribute.TableAttributeStar. */
private Result pTableAttributeStar$1(final int yyStart) throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttribute$XmlAttributeStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.XmlAttributeStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$XmlAttributeStar(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
NodeList yyOpValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pTableAttributeInline$tXmlAttributePlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
NodeList v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for yyValue.
yyValue = yyOpValue1;
if (yyValue == null)
yyValue = new NodeList();
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for yyValue.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.XmlAttrGarbageStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$XmlAttrGarbageStopper(final int yyStart)
throws IOException {
int yyC;
Result yyPredResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('|' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Alternative 2.
yyPredResult = p$$Shared8(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("xml attr garbage stopper expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.XmlAttrValueStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$XmlAttrValueStopper(final int yyStart)
throws IOException {
int yyC;
Result yyPredResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
if (('<' == yyC) ||
('|' == yyC)) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
}
// Alternative 2.
yyPredResult = p$$Shared8(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("xml attr value stopper expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.tXmlAttributePlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$tXmlAttributePlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttributeInline$XmlHeadAttributeChoice(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode head = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult =
pTableAttributeInline$XmlTailAttributeChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.XmlHeadAttributeChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$XmlHeadAttributeChoice(final int yyStart)
throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttributeInline$ValidXmlAttribute(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pTableAttributeInline$GarbageString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyValue = new XmlAttributeGarbage(garbage);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.XmlTailAttributeChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$XmlTailAttributeChoice(final int yyStart)
throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = p$$Shared13(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pTableAttributeInline$ValidXmlAttribute(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pTableAttributeInline$GarbageString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyValue = new XmlAttributeGarbage(garbage);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.GarbageString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$GarbageString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult =
pTableAttributeInline$GarbageStringStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
} else {
yyError = yyError.select("garbage string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("garbage string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.GarbageStringStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$GarbageStringStopper(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyResult = pTableAttributeInline$XmlAttrGarbageStopper(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = p$$Shared13(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pTableAttributeInline$ValidXmlAttribute(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValidXmlAttribute.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValidXmlAttribute(final int yyStart)
throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fTableAttributeInline$ValidXmlAttribute)
yyColumn.chunk3.fTableAttributeInline$ValidXmlAttribute = pTableAttributeInline$ValidXmlAttribute$1(yyStart);
return yyColumn.chunk3.fTableAttributeInline$ValidXmlAttribute;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableAttributeInline.ValidXmlAttribute. */
private Result pTableAttributeInline$ValidXmlAttribute$1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyOption1;
String yyOpValue1;
XmlAttribute yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for ws0.
String ws0 = yyOpValue1;
yyResult = pXmlName(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String name = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for ws1.
String ws1 = yyOpValue1;
yyC = character(yyOption1);
if ('=' == yyC) {
yyIndex = yyOption1 + 1;
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyOption1 = yyChoice2;
yyOpValue1 = null;
yyResult = p$$Shared13(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for ws2.
String ws2 = yyOpValue1;
final int yyChoice3 = yyOption1;
// Nested alternative 1.
yyC = character(yyChoice3);
if (-1 != yyC) {
yyIndex = yyChoice3 + 1;
switch (yyC) {
case '\'':
{
yyResult = pTableAttributeInline$ValueSqStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\'' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pTableAttributeInline$AttrEnd(yyIndex);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '=', ws2, '\''),
joinRt('\''));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
break;
case '\"':
{
yyResult = pTableAttributeInline$ValueDqStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\"' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pTableAttributeInline$AttrEnd(yyIndex);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '=', ws2, '"'),
joinRt('"'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
break;
default:
/* No match. */
}
}
} // End scope for ws2.
// Nested alternative 2.
yyResult = pTableAttributeInline$ValueNqStar(yyChoice2);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyPredResult = pTableAttributeInline$AttrEnd(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '='),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
} // End scope for ws1.
// Nested alternative 2.
yyPredResult = pTableAttributeInline$AttrEnd(yyChoice1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, false);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
} // End scope for ws0.
// Done.
yyError = yyError.select("valid xml attribute expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.AttrEnd.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$AttrEnd(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyResult = p$$Shared6(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if (-1 != yyC) {
if (('<' == yyC) ||
('|' == yyC)) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
}
// Alternative 3.
yyPredResult = p$$Shared8(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// Alternative 4.
yyPredMatched = false;
yyC = character(yyStart);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
} else {
yyError = yyError.select("attr end expected", yyStart);
}
// Done.
yyError = yyError.select("attr end expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueSqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueSqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttributeInline$ValueSqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueSqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueSqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttributeInline$ValueSqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value sq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueSqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueSqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttributeInline$XmlAttrValueStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '&':
case '\'':
case '<':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("value sq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value sq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueDqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueDqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttributeInline$ValueDqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueDqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueDqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttributeInline$ValueDqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value dq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueDqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueDqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttributeInline$XmlAttrValueStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '\"':
case '&':
case '<':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("value dq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value dq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueNqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueNqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTableAttributeInline$ValueNqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueNqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueNqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttributeInline$ValueNqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value nq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.ValueNqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInline$ValueNqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pTableAttributeInline$XmlAttrValueStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
if (('!' == yyC) ||
(('#' <= yyC) && (yyC <= '%')) ||
(('(' <= yyC) && (yyC <= '*')) ||
((',' <= yyC) && (yyC <= '<')) ||
(('?' <= yyC) && (yyC <= '[')) ||
((']' <= yyC) && (yyC <= '~'))) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
} else {
yyError = yyError.select("value nq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value nq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.parser.TableAttributeInline.TableAttributeInlineStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTableAttributeInlineStar(final int yyStart)
throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fTableAttributeInlineStar)
yyColumn.chunk3.fTableAttributeInlineStar = pTableAttributeInlineStar$1(yyStart);
return yyColumn.chunk3.fTableAttributeInlineStar;
}
/** Actually parse org.sweble.wikitext.lazy.parser.TableAttributeInline.TableAttributeInlineStar. */
private Result pTableAttributeInlineStar$1(final int yyStart)
throws IOException {
Result yyResult;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTableAttributeInline$XmlAttributeStar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.XmlName.XmlName.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlName(final int yyStart) throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fXmlName)
yyColumn.chunk3.fXmlName = pXmlName$1(yyStart);
return yyColumn.chunk3.fXmlName;
}
/** Actually parse org.sweble.wikitext.lazy.utils.XmlName.XmlName. */
private Result pXmlName$1(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlNameStartChar(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
while (true) {
yyResult = pXmlNameChar(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlName.XmlNameStartChar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlNameStartChar(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if ((':' == yyC) ||
(('A' <= yyC) && (yyC <= 'Z')) ||
('_' == yyC) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 2.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u00c0' <= yyC) && (yyC <= '\u00d6')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 3.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u00d8' <= yyC) && (yyC <= '\u00f6')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 4.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u00f8' <= yyC) && (yyC <= '\u02ff')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 5.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\u0370':
case '\u0371':
case '\u0372':
case '\u0373':
case '\u0374':
case '\u0375':
case '\u0376':
case '\u0377':
case '\u0378':
case '\u0379':
case '\u037a':
case '\u037b':
case '\u037c':
case '\u037d':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 6.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u037f' <= yyC) && (yyC <= '\u1fff')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 7.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\u200c':
case '\u200d':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 8.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u2070' <= yyC) && (yyC <= '\u218f')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 9.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u2c00' <= yyC) && (yyC <= '\u2fef')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 10.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u3001' <= yyC) && (yyC <= '\ud7ff')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 11.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\uf900' <= yyC) && (yyC <= '\ufdcf')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 12.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\ufdf0' <= yyC) && (yyC <= '\ufffd')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Done.
yyError = yyError.select("xml name start char expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.XmlName.XmlNameChar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlNameChar(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if ((':' == yyC) ||
(('A' <= yyC) && (yyC <= 'Z')) ||
('_' == yyC) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 2.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u00c0' <= yyC) && (yyC <= '\u00d6')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 3.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u00d8' <= yyC) && (yyC <= '\u00f6')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 4.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u00f8' <= yyC) && (yyC <= '\u02ff')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 5.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\u0370':
case '\u0371':
case '\u0372':
case '\u0373':
case '\u0374':
case '\u0375':
case '\u0376':
case '\u0377':
case '\u0378':
case '\u0379':
case '\u037a':
case '\u037b':
case '\u037c':
case '\u037d':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 6.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u037f' <= yyC) && (yyC <= '\u1fff')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 7.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\u200c':
case '\u200d':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 8.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u2070' <= yyC) && (yyC <= '\u218f')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 9.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u2c00' <= yyC) && (yyC <= '\u2fef')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 10.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u3001' <= yyC) && (yyC <= '\ud7ff')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 11.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\uf900' <= yyC) && (yyC <= '\ufdcf')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 12.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\ufdf0' <= yyC) && (yyC <= '\ufffd')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 13.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '-':
case '.':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u00b7':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 14.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
if (('\u0300' <= yyC) && (yyC <= '\u036f')) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Alternative 15.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\u203f':
case '\u2040':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("xml name char expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal Whitespace.pWsStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWhitespace$pWsStar(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyResult = pWhitespace$pWhitespace(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal Whitespace.pWsPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWhitespace$pWsPlus(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyResult = pWhitespace$pWhitespace(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal Whitespace.pWhitespace.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWhitespace$pWhitespace(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case ' ':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\t':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\f':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\r':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('\n' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '\n':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2028':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u2029':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u000b':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '\u0085':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("p whitespace expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* org.sweble.wikitext.lazy.parser.Grammar.$$Shared10.
* This nonterminal represents the duplicate productions
* org.sweble.wikitext.lazy.utils.XmlAttribute.XmlAttrGarbageStopper
* and org.sweble.wikitext.lazy.utils.XmlAttribute.XmlAttrValueStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared10(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '/':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('>' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '>':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '<':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.tXmlAttributePlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$tXmlAttributePlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlAttribute$XmlHeadAttributeChoice(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
AstNode head = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pXmlAttribute$XmlTailAttributeChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for tail.
Pair tail = yyRepValue1.reverse();
yyValue = new NodeList(head, tail);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for tail.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.XmlHeadAttributeChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$XmlHeadAttributeChoice(final int yyStart)
throws IOException {
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlAttribute$ValidXmlAttribute(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pXmlAttribute$GarbageString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyValue = new XmlAttributeGarbage(garbage);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.XmlTailAttributeChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$XmlTailAttributeChoice(final int yyStart)
throws IOException {
Result yyResult;
Result yyPredResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyPredResult = pWhitespace$pWsPlus(yyStart);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyResult = pXmlAttribute$ValidXmlAttribute(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pXmlAttribute$GarbageString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String garbage = yyResult.semanticValue();
yyValue = new XmlAttributeGarbage(garbage);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.GarbageString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$GarbageString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = pXmlAttribute$GarbageStringStopper(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
} else {
yyError = yyError.select("garbage string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("garbage string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.GarbageStringStopper.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$GarbageStringStopper(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyResult = pWhitespace$pWsPlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyResult = p$$Shared10(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pWhitespace$pWsPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pXmlAttribute$ValidXmlAttribute(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValidXmlAttribute.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValidXmlAttribute(final int yyStart)
throws IOException {
LazyRatsParserColumn yyColumn = (LazyRatsParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fXmlAttribute$ValidXmlAttribute)
yyColumn.chunk3.fXmlAttribute$ValidXmlAttribute = pXmlAttribute$ValidXmlAttribute$1(yyStart);
return yyColumn.chunk3.fXmlAttribute$ValidXmlAttribute;
}
/** Actually parse org.sweble.wikitext.lazy.utils.XmlAttribute.ValidXmlAttribute. */
private Result pXmlAttribute$ValidXmlAttribute$1(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyOption1;
String yyOpValue1;
XmlAttribute yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pWhitespace$pWsPlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for ws0.
String ws0 = yyOpValue1;
yyResult = pXmlName(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String name = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = pWhitespace$pWsPlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for ws1.
String ws1 = yyOpValue1;
yyC = character(yyOption1);
if ('=' == yyC) {
yyIndex = yyOption1 + 1;
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyOption1 = yyChoice2;
yyOpValue1 = null;
yyResult = pWhitespace$pWsPlus(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
String v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for ws2.
String ws2 = yyOpValue1;
final int yyChoice3 = yyOption1;
// Nested alternative 1.
yyC = character(yyChoice3);
if (-1 != yyC) {
yyIndex = yyChoice3 + 1;
switch (yyC) {
case '\'':
{
yyResult = pXmlAttribute$ValueSqStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\'' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pXmlAttribute$AttrEnd(yyIndex);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '=', ws2, '\''),
joinRt('\''));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
break;
case '\"':
{
yyResult = pXmlAttribute$ValueDqStar(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\"' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pXmlAttribute$AttrEnd(yyIndex);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '=', ws2, '"'),
joinRt('"'));
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
break;
default:
/* No match. */
}
}
} // End scope for ws2.
// Nested alternative 2.
yyResult = pXmlAttribute$ValueNqStar(yyChoice2);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
NodeList value = yyResult.semanticValue();
yyPredResult = pXmlAttribute$AttrEnd(yyResult.index);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, value, true);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name, ws1, '='),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
}
}
} // End scope for ws1.
// Nested alternative 2.
yyPredResult = pXmlAttribute$AttrEnd(yyChoice1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyValue = new XmlAttribute(name, false);
if (isGatherRtData())
addRtData(yyValue,
joinRt(ws0, name),
null);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyChoice1, yyError);
}
}
} // End scope for ws0.
// Done.
yyError = yyError.select("valid xml attribute expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal org.sweble.wikitext.lazy.utils.XmlAttribute.AttrEnd.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$AttrEnd(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyResult = pWhitespace$pWhitespace(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '/':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('>' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case '>':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '<':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Alternative 3.
yyPredMatched = false;
yyC = character(yyStart);
if (-1 != yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
} else {
yyError = yyError.select("attr end expected", yyStart);
}
// Done.
yyError = yyError.select("attr end expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueSqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueSqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pXmlAttribute$ValueSqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueSqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueSqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlAttribute$ValueSqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value sq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueSqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueSqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = p$$Shared10(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '&':
case '\'':
case '<':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("value sq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value sq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueDqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueDqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pXmlAttribute$ValueDqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueDqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueDqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlAttribute$ValueDqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value dq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueDqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueDqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = p$$Shared10(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '\"':
case '&':
case '<':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
} else {
yyError = yyError.select("value dq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value dq string expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueNqStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueNqStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair yyRepValue1;
NodeList yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pXmlAttribute$ValueNqChoice(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
AstNode v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for value.
Pair value = yyRepValue1.reverse();
yyValue = new NodeList(value);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for value.
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueNqChoice.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueNqChoice(final int yyStart)
throws IOException {
int yyC;
Result yyResult;
AstNode yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pXmlAttribute$ValueNqString(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
String string = yyResult.semanticValue();
yyValue = new Text(string);
if (yyValue instanceof Locatable) {
setLocation((Locatable)yyValue, yyStart);
}
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if ('&' == yyC) {
yyResult = pXmlReference(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("value nq choice expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal
* org.sweble.wikitext.lazy.utils.XmlAttribute.ValueNqString.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pXmlAttribute$ValueNqString(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyPredResult;
boolean yyPredMatched;
int yyRepetition1;
boolean yyRepeated1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
yyPredMatched = false;
yyPredResult = p$$Shared10(yyRepetition1);
if (yyPredResult.hasValue()) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
if (('!' == yyC) ||
(('#' <= yyC) && (yyC <= '%')) ||
(('(' <= yyC) && (yyC <= '*')) ||
((',' <= yyC) && (yyC <= '<')) ||
(('?' <= yyC) && (yyC <= '[')) ||
((']' <= yyC) && (yyC <= '~'))) {
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
} else {
yyError = yyError.select("value nq string expected", yyStart);
}
break;
}
if (yyRepeated1) {
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("value nq string expected", yyStart);
return yyError;
}
// =========================================================================
static final int noEolScopes;
static
{
int sc = 0;
for (ParserScopes s : ParserScopes.values())
{
if (s.isNoEolScope())
sc |= 1 << s.ordinal();
}
noEolScopes = sc;
}
// ===========================================================================
public LazyParserState getState()
{
return yyState;
}
private LazyParserContext getContext()
{
return getState().getTop();
}
public AstNode getEntity(int id)
{
return getState().getEntity(id);
}
// ===========================================================================
private boolean acceptEol()
{
return 0 == (noEolScopes & getContext().getStickingScopes());
}
private boolean accept(ParserAtoms atom)
{
return getState().accepts(atom);
}
private void enter(ParserScopes scope)
{
getState().setScope(scope);
}
private boolean inScope(ParserScopes scope)
{
return getState().inScope(scope);
}
// ===========================================================================
private boolean isWarningsEnabled()
{
return getState().isWarnignsEnabled();
}
private boolean isAutoCorrect(WarningSeverity severity)
{
return getState().isAutoCorrect() && isWarningLevelEnabled(severity);
}
private boolean isWarningLevelEnabled(WarningSeverity severity)
{
return getState().getConfig().isWarningLevelEnabled(severity);
}
@SuppressWarnings("unused")
private boolean isValidXmlEntityRef(String name)
{
return getState().getConfig().isValidXmlEntityRef(name);
}
private boolean isMagicWord(String word)
{
return getState().getConfig().isMagicWord(word);
}
Result parseLinkPostfix(int start, int base)
{
Pattern p = yyState.getInternalLinkPostfixPattern();
if (p == null)
return new SemanticValue("", base);
Matcher m = p.matcher(new ParserCharSequence(base));
if (!m.lookingAt())
{
return new SemanticValue("", base);
}
else
{
return new SemanticValue(m.group(), base + m.end());
}
}
private AstNode addLinkPrefix(Text text, InternalLink link)
{
String t = text.getContent();
if (!t.isEmpty())
{
// shortcut (prefix cannot contain whitespace)
if (!Character.isWhitespace(t.charAt(t.length() - 1)))
{
Matcher matcher =
getState().getInternalLinkPrefixPattern().matcher(t);
if (matcher.find())
{
String p = matcher.group(1);
if (!p.isEmpty())
{
String b = t.substring(0, t.length() - p.length());
InternalLink l = (InternalLink) link.clone();
l.setPrefix(p);
if (isGatherRtData())
prependRtData(l, p);
return new NodeList(new Text(b), l);
}
}
}
}
return new NodeList(text, link);
}
private int toInt(String num)
{
if (num == null)
return -1;
try
{
return Integer.parseInt(num);
}
catch (NumberFormatException e)
{
return -2;
}
}
private LinkBuilder getLinkBuilder()
{
return getState().getLinkBuilder();
}
private boolean isImageTarget()
{
return getLinkBuilder().isImageTarget();
}
private boolean isValidTarget()
{
return getLinkBuilder().isValidTarget();
}
public enum ListType
{
DEFINITION,
ITEMIZATION,
ENUMERATION,
}
public class ListNode
{
public ListType type;
public ContentNode node;
public ListNode(ListType type, ContentNode node)
{
this.type = type;
this.node = node;
}
public boolean comparePrefix(char ch)
{
switch (type)
{
case DEFINITION:
return (ch == ';' || ch == ':');
case ENUMERATION:
return (ch == '#');
case ITEMIZATION:
return (ch == '*');
default:
return false;
}
}
}
private void pushNewList(Vector listStack, char ch, boolean createItem)
{
ListNode node = null;
switch (ch)
{
case '*':
node = new ListNode(ListType.ITEMIZATION, new Itemization());
break;
case '#':
node = new ListNode(ListType.ENUMERATION, new Enumeration());
break;
case ':':
case ';':
node = new ListNode(ListType.DEFINITION, new DefinitionList());
break;
}
if (!listStack.isEmpty())
getLastItemContent(listStack).add(node.node);
listStack.add(node);
if (createItem)
{
// FIXME: Issue warning!
pushNewListItem(listStack, ch, new NodeList());
}
}
private AstNode pushNewListItem(Vector listStack, char ch, NodeList content)
{
AstNode n = null;
switch (ch)
{
case '*':
n = new ItemizationItem(content);
break;
case '#':
n = new EnumerationItem(content);
break;
case ':':
n = new DefinitionDefinition(content);
break;
case ';':
n = new DefinitionTerm(content);
break;
}
getCurrentListContent(listStack).add(n);
return n;
}
private NodeList getCurrentListContent(Vector listStack)
{
return listStack.lastElement().node.getContent();
}
private NodeList getLastItemContent(Vector listStack)
{
NodeList items = getCurrentListContent(listStack);
ContentNode lastItem = (ContentNode) items.get(items.size() - 1);
NodeList lastItemContent = lastItem.getContent();
return lastItemContent;
}
private NodeList makeList(RawListItem first, Pair tail)
{
Vector listStack = new Vector();
NodeList items = new NodeList();
RtData lastItem = processListItem(listStack, items, first);
Pair i = tail;
while (!i.isEmpty())
{
RawListItem item = i.head();
if (isGatherRtData())
lastItem.getRts()[1] = joinRt(item.getRt0());
lastItem = processListItem(listStack, items, item);
i = i.tail();
}
return items;
}
private RtData processListItem(Vector listStack, NodeList items, RawListItem p)
{
String prefix = p.getPrefix();
int j;
for (j = 0; j < prefix.length() && j < listStack.size(); ++j)
{
if (!listStack.get(j).comparePrefix(prefix.charAt(j)))
break;
}
// pop closed list levels
listStack.setSize(j);
boolean addRoot = (j == 0);
int last = prefix.length() - 1;
// open new list levels
for (; j < prefix.length(); ++j)
pushNewList(listStack, prefix.charAt(j), j < last);
// push the actual list item
AstNode item = pushNewListItem(
listStack,
prefix.charAt(last),
new NodeList(p.getContent()));
RtData rtData = null;
if (isGatherRtData())
rtData = addRtData(item, joinRt(p.getRt1(), p.getPrefix()), null);
if (addRoot)
items.add(listStack.firstElement().node);
return rtData;
}
private Heading createHeading(
int spanFrom,
Result spanTo,
AstNode rt0,
int oCount,
NodeList title,
int cCount,
AstNode rt1)
{
int oOdd = 0;
int cOdd = 0;
if (oCount > 6)
{
oOdd = oCount - 6;
oCount = 6;
}
if (cCount > 6)
{
cOdd = cCount - 6;
cCount = 6;
}
int level;
if (cCount > oCount)
{
level = oCount;
cOdd += cCount - oCount;
cCount -= cCount - oCount;
}
else
{
level = cCount;
oOdd += oCount - cCount;
oCount -= oCount - cCount;
}
Heading heading = new Heading(title, level);
Text oOddText = null;
if (oOdd > 0)
{
if (isWarningLevelEnabled(WS_NORMAL))
fileOddSyntaxWarning(
heading,
makeSpan(spanFrom, spanTo),
WS_NORMAL,
"Odd number of opening equals");
oOddText = new Text(StringUtils.strrep('=', oOdd));
}
Text cOddText = null;
if (cOdd > 0)
{
if (isWarningLevelEnabled(WS_NORMAL))
fileOddSyntaxWarning(
heading,
makeSpan(spanFrom, spanTo),
WS_NORMAL,
"Odd number of closing equals");
cOddText = new Text(StringUtils.strrep('=', cOdd));
}
heading.setContent(new NodeList(oOddText, title, cOddText));
if (isGatherRtData())
{
String equals = StringUtils.strrep('=', level);
addRtData(heading,
joinRt(rt0, equals),
joinRt(equals, rt1));
}
return heading;
}
private void fixSectionMetadata(Heading heading, Section section)
{
RtData rtd = (RtData) heading.getAttribute("RTD");
if (rtd != null)
{
Object[][] newRts = new Object[3][];
newRts[0] = rtd.getRts()[0];
newRts[1] = rtd.getRts()[1];
newRts[2] = null;
section.setAttribute("RTD", new RtData(newRts));
}
Object warnings = heading.getAttribute("warnings");
if (warnings != null)
section.setAttribute("warnings", warnings);
}
private AstNode makeSections(Section first, Pair tail)
{
Stack stack = new Stack();
stack.push(first);
NodeList result = new NodeList(first);
Pair i = tail;
while (!i.isEmpty())
{
Section s = i.head();
while (!stack.isEmpty() && s.getLevel() <= stack.peek().getLevel())
stack.pop();
if (stack.isEmpty())
{
result.add(s);
}
else
{
// TODO: Dangerous! We must clone the section instead!
stack.peek().setBody(new NodeList(stack.peek().getBody(), s));
}
stack.push(s);
i = i.tail();
}
return result;
}
/*
private Table makeTable(NodeList attributes, NodeList body)
{
int numCols = 0;
TableCaption caption = null;
ArrayList cols = null;
TableRow header = null;
TableRow curRow = null;
ArrayList rows = new ArrayList();
boolean first = true;
for (AstNode node : body)
{
switch (node.getNodeType())
{
case AstNodeTypes.NT_TABLE_CAPTION:
if (caption == null)
caption = (TableCaption) node;
if (!first)
; // TODO: issue warning
break;
case AstNodeTypes.NT_TABLE_ROW:
int size = processRow(curRow, rows, cols);
if (size > numCols)
numCols = size;
cols = null;
curRow = (TableRow) node;
break;
case AstNodeTypes.NT_TABLE_CELL:
case AstNodeTypes.NT_TABLE_HEADER:
if (curRow == null)
{
if (cols == null)
cols = new ArrayList();
cols.add(node);
}
break;
}
first = false;
}
int size = processRow(curRow, rows, cols);
if (size > numCols)
numCols = size;
if (caption == null)
caption = new TableCaption();
if (header == null)
header = new TableRow();
Table table = new Table(
attributes,
body,
caption,
numCols,
header,
new NodeList(rows));
return table;
}
private int processRow(TableRow curRow, ArrayList rows, ArrayList cols)
{
int size = 0;
if (curRow != null)
{
size = curRow.getBody().size();
rows.add(curRow);
}
else if (cols != null)
{
size = cols.size();
rows.add(new TableRow(new NodeList(), new NodeList(cols)));
}
return size;
}
*/
protected String difference(int start, Result result)
{
return difference(start, result.index);
}
protected Span makeSpan(int from, int to)
{
Location lFrom = columnToLocation(from);
if (lFrom == null)
return new Span();
Location lTo = columnToLocation(to);
if (lTo == null)
return new Span(lFrom, difference(from, from));
return new Span(lFrom, lTo, difference(from, to));
}
protected Span makeSpan(int from, Result to)
{
return makeSpan(from, to.index);
}
protected Location columnToLocation(int index)
{
Column col = column(index);
return new Location(col.file, col.line, col.column);
}
protected boolean isGatherRtData()
{
return getState().isGatherRtData();
}
protected static RtData addRtData(AstNode yyValue, Object[]... rts)
{
return TextUtils.addRtData(yyValue, rts);
}
protected static Object[] joinRt(Object... objects)
{
return TextUtils.joinRt(objects);
}
private static void rtAddString(ArrayList