// ===========================================================================
// This file has been generated by
// Rats! Parser Generator, version 2.1.0,
// (C) 2004-2011 Robert Grimm,
// on Monday, July 25, 2011 at 2:20:17 PM.
// Edit at your own risk.
// ===========================================================================
package xtc.lang;
import java.io.Reader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import xtc.util.Action;
import xtc.util.Pair;
import xtc.tree.Node;
import xtc.tree.GNode;
import xtc.parser.ParserBase;
import xtc.parser.Column;
import xtc.parser.Result;
import xtc.parser.SemanticValue;
import xtc.parser.ParseError;
/**
* Packrat parser for grammar <code>xtc.lang.CFactory</code>.
*
* <p />This class has been generated by the <i>Rats!</i> parser
* generator, version 2.1.0, (C) 2004-2011 Robert Grimm.
*/
public final class CFactoryParser extends ParserBase {
/** The GCC flag. */
public static final boolean GCC = true;
/** The C_KEYWORDS set. */
public static final Set<String> C_KEYWORDS = new HashSet<String>();
/** The RELOCATE flag. */
public static final boolean RELOCATE = true;
/** The JAVA_KEYWORDS set. */
public static final Set<String> JAVA_KEYWORDS = new HashSet<String>();
/** The C99 flag. */
public static final boolean C99 = true;
// =========================================================================
/** Chunk 1 of memoized results. */
static final class Chunk1 {
Result fAliasTerm;
Result fDeclarationSpecifiers;
Result fSpecifierQualifierList;
Result fAttributedDeclarator;
Result fDeclarator;
Result fPointer;
Result fVariableLength;
Result fParameterTypeList;
Result fAbstractDeclarator;
Result fTypeName;
}
/** Chunk 2 of memoized results. */
static final class Chunk2 {
Result fAttributeSpecifierList;
Result fAttributeSpecifier;
Result fStatement;
Result fCompoundStatement;
Result fCommaExpression;
Result fAssignmentExpression;
Result fConditionalExpression;
Result fLogicalOrExpression;
Result fCastExpression;
Result fUnaryExpression;
}
/** Chunk 3 of memoized results. */
static final class Chunk3 {
Result fExpressionList;
Result fExpressionList$$Star1;
Result fAssemblyOperands;
Result fAssemblyOperands$$Star1;
Result fAssemblyOperand;
Result fAsmKeyword;
Result fNodeVariable;
Result fStringVariable;
Result fNodeListVariable;
Result fExponent;
}
/** Chunk 4 of memoized results. */
static final class Chunk4 {
Result f$$Shared2;
Result fBinaryExponent;
Result fCharacterLiteral;
Result fStringConstant;
Result fStringConstant$$Plus1;
Result fStringLiteral;
Result fCIdentifier$Identifier;
Result fKeyword;
Result fCIdentifier$Word;
Result fSymbol;
}
/** Chunk 5 of memoized results. */
static final class Chunk5 {
Result fJavaIdentifier$Identifier;
Result fJavaIdentifier$Word;
}
// =========================================================================
/** Memoization table column. */
static final class CFactoryParserColumn extends Column {
Chunk1 chunk1;
Chunk2 chunk2;
Chunk3 chunk3;
Chunk4 chunk4;
Chunk5 chunk5;
}
// =========================================================================
/** The global state object. */
protected final xtc.lang.CParserState yyState;
// =========================================================================
/**
* Create a new packrat parser.
*
* @param reader The reader.
* @param file The file name.
*/
public CFactoryParser(final Reader reader, final String file) {
super(reader, file);
yyState = new xtc.lang.CParserState();
}
/**
* Create a new packrat parser.
*
* @param reader The file reader.
* @param file The file name.
* @param size The file size.
*/
public CFactoryParser(final Reader reader, final String file, final int size) {
super(reader, file, size);
yyState = new xtc.lang.CParserState();
}
// =========================================================================
protected Column newColumn() {
return new CFactoryParserColumn();
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CFactory.Factory.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
public Result pFactory(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCFactory$Prelude(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyResult = pAlias(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyBase = yyOption1;
yyResult = pJavaIdentifier$Word(yyBase);
if (yyResult.hasValue("factory")) {
yyResult = pQualifiedIdentifier(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("{")) {
yyResult = pMethods(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyResult = pEndOfFile(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("Factory", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
} else {
yyError = yyError.select("'{' expected", yyBase);
}
}
} else {
yyError = yyError.select("'factory' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CFactory.Prelude.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCFactory$Prelude(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyBase;
int yyRepetition1;
int yyRepetition2;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Reset the global state object.
yyState.reset(column(yyStart).file);
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case ' ':
{
yyRepetition1 = yyIndex;
continue;
}
case '\t':
{
yyRepetition1 = yyIndex;
continue;
}
case '\f':
{
yyRepetition1 = yyIndex;
continue;
}
case '/':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
switch (yyC) {
case '*':
{
yyRepetition2 = yyIndex;
while (true) {
final int yyChoice2 = yyRepetition2;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case '*':
{
yyPredMatched = false;
yyC = character(yyIndex);
if ('/' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyRepetition2 = yyIndex;
continue;
} else {
yyError = yyError.select("prelude expected", yyStart);
}
}
break;
default:
{
yyRepetition2 = yyIndex;
continue;
}
}
}
break;
}
yyBase = yyRepetition2;
yyC = character(yyBase);
if ('*' == yyC) {
yyIndex = yyRepetition2 + 1;
yyC = character(yyIndex);
if ('/' == yyC) {
yyIndex = yyIndex + 1;
yyRepetition1 = yyIndex;
continue;
} else {
yyError = yyError.select("'*/' expected", yyBase);
}
} else {
yyError = yyError.select("'*/' expected", yyBase);
}
}
break;
case '/':
{
yyRepetition2 = yyIndex;
while (true) {
yyC = character(yyRepetition2);
if (-1 != yyC) {
yyIndex = yyRepetition2 + 1;
switch (yyC) {
case '\n':
case '\r':
/* No match. */
break;
default:
{
yyRepetition2 = yyIndex;
continue;
}
}
}
break;
}
yyPredResult = pLineTerminator(yyRepetition2);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyRepetition1 = yyRepetition2;
continue;
}
}
break;
default:
/* No match. */
}
}
}
break;
case '\r':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if ('\n' == yyC) {
yyIndex = yyChoice2 + 1;
yyResult = pDirective(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
// Nested alternative 2.
yyResult = pDirective(yyChoice2);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
break;
case '\n':
{
yyResult = pDirective(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
break;
default:
/* No match. */
}
}
break;
}
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CFactory.Alias.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAlias(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$Word(yyStart);
if (yyResult.hasValue("alias")) {
yyResult = pAliasTerm(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pAliasTerm(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
}
// Done.
yyError = yyError.select("alias expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CFactory.AliasTerm.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAliasTerm(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fAliasTerm)
yyColumn.chunk1.fAliasTerm = pAliasTerm$1(yyStart);
return yyColumn.chunk1.fAliasTerm;
}
/** Actually parse xtc.lang.CFactory.AliasTerm. */
private Result pAliasTerm$1(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$Word(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String w = yyResult.semanticValue();
yyState.bind(toText(w), true);
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CFactory.Methods.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMethods(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pMethod(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
final Pair<Node> v$g$1 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("Methods", v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CFactory.Method.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMethod(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$Word(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("{")) {
yyResult = pPattern(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyValue = GNode.create("Method", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
} else {
yyError = yyError.select("'{' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.FunctionDefinition.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pFunctionDefinition(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Object yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Definition>.
yyOption1 = yyStart;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pKeyword(yyBase);
if (yyResult.hasValue("__extension__")) {
final String v$el$1 = "__extension__";
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("'__extension__' expected", yyBase);
}
{ // Start scope for v$g$1.
final String v$g$1 = cast(yyOpValue1);
yyOpValue1 = null;
yyResult = pDeclarationSpecifiers(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$2.
final Node v$g$2 = cast(yyOpValue1);
yyResult = pDeclarator(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyResult = pFunctionDeclaratorContext(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pDeclarationList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$4.
final Node v$g$4 = cast(yyOpValue1);
yyResult = pCompoundStatement(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$5 = yyResult.semanticValue();
yyValue = GNode.create("FunctionDefinition", v$g$1, v$g$2, v$g$3, v$g$4, v$g$5);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} // End scope for v$g$4.
}
}
} // End scope for v$g$2.
} // End scope for v$g$1.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationList(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <List>.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDeclarationListEntry(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
final Pair<Node> v$g$1 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("DeclarationList", v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationListEntry.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationListEntry(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative <Entry>.
yyResult = pDeclaration(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 xtc.lang.CPattern.Annotations.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAnnotations(final int yyStart) throws IOException {
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyState.mark();
yyValue = yyState.annotate(null);
// Commit the state modification.
yyState.commit();
setLocation(yyValue, yyStart);
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Declaration.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclaration(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Object yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pKeyword(yyBase);
if (yyResult.hasValue("__extension__")) {
final String v$el$1 = "__extension__";
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("'__extension__' expected", yyBase);
}
{ // Start scope for v$g$1.
final String v$g$1 = cast(yyOpValue1);
yyResult = pDeclarationSpecifiers(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pInitializedDeclaratorList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for l.
final Node l = cast(yyOpValue1);
if (yyState.isValid(l)) {
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("Declaration", v$g$1, v$g$2, l);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
} // End scope for l.
}
} // End scope for v$g$1.
// Done.
yyError = yyError.select("declaration expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationSpecifiers.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationSpecifiers(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fDeclarationSpecifiers)
yyColumn.chunk1.fDeclarationSpecifiers = pDeclarationSpecifiers$1(yyStart);
return yyColumn.chunk1.fDeclarationSpecifiers;
}
/** Actually parse xtc.lang.CPattern.DeclarationSpecifiers. */
private Result pDeclarationSpecifiers$1(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pDeclarationSpecifierPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$1 = yyResult.semanticValue();
yyValue = GNode.createFromPair("DeclarationSpecifiers", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationSpecifierPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationSpecifierPlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDeclarationSpecifier(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
yyValue = yyRepValue1.reverse();
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationSpecifier(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <StorageClass>.
yyResult = pStorageClassSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <TypeSpecifier>.
yyResult = pTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pTypeSpecContext(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative <TypeQualifier>.
yyResult = pTypeQualifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("inline")) {
final String v$g$1 = "inline";
yyValue = GNode.create("FunctionSpecifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__inline")) {
final String v$g$2 = "__inline";
yyValue = GNode.create("FunctionSpecifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 6.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__inline__")) {
final String v$g$3 = "__inline__";
yyValue = GNode.create("FunctionSpecifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Attribute>.
yyResult = pAttributeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("declaration specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.InitializedDeclaratorList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInitializedDeclaratorList(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <List>.
yyResult = pInitializedDeclarator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pInitializedDeclarator(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("InitializedDeclaratorList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.InitializedDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInitializedDeclarator(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyResult = pDeclarator(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pSimpleAssemblyExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$4.
final Node v$g$4 = yyOpValue1;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("=")) {
yyResult = pInitializer(yyResult.index);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$4 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$4;
}
} else {
yyError = yyError.select("'=' expected", yyBase);
}
{ // Start scope for v$g$5.
final Node v$g$5 = yyOpValue1;
yyValue = GNode.create("InitializedDeclarator", v$g$1, v$g$2, v$g$3, v$g$4, v$g$5);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$5.
} // End scope for v$g$4.
} // End scope for v$g$3.
}
} // End scope for v$g$1.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StorageClassSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStorageClassSpecifier(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("auto")) {
yyValue = GNode.create("AutoSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("extern")) {
yyValue = GNode.create("ExternSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("register")) {
yyValue = GNode.create("RegisterSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("static")) {
yyValue = GNode.create("StaticSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__thread")) {
yyValue = GNode.create("ThreadSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 6.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("typedef")) {
yyResult = pTypedefContext(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("TypedefSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("storage class specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.TypeQualifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeQualifier(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("volatile")) {
final String v$g$1 = "volatile";
yyValue = GNode.create("VolatileQualifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__volatile")) {
final String v$g$2 = "__volatile";
yyValue = GNode.create("VolatileQualifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__volatile__")) {
final String v$g$3 = "__volatile__";
yyValue = GNode.create("VolatileQualifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("const")) {
final String v$g$1 = "const";
yyValue = GNode.create("ConstantQualifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__const")) {
final String v$g$2 = "__const";
yyValue = GNode.create("ConstantQualifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 6.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__const__")) {
final String v$g$3 = "__const__";
yyValue = GNode.create("ConstantQualifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 7.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("restrict")) {
final String v$g$1 = "restrict";
yyValue = GNode.create("RestrictQualifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 8.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__restrict")) {
final String v$g$2 = "__restrict";
yyValue = GNode.create("RestrictQualifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 9.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__restrict__")) {
final String v$g$3 = "__restrict__";
yyValue = GNode.create("RestrictQualifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("type qualifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.TypeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeSpecifier(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Enumeration>.
yyResult = pEnumerationTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Structure>.
yyResult = pStructureTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Union>.
yyResult = pUnionTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Floating>.
yyResult = pFloatingPointTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Integer>.
yyResult = pIntegerTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 6.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String id = yyResult.semanticValue();
if (yyState.isType(toText(id))) {
yyValue = GNode.create("TypedefName", id);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 7.
yyResult = pTypeofKeyword(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pTypeName(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("TypeofSpecifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
// Nested alternative 2.
yyResult = pCommaExpression(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("TypeofSpecifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative 8.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("void")) {
yyValue = GNode.create("VoidTypeSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 9.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__builtin_va_list")) {
yyValue = GNode.create("VarArgListSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("type specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.EnumerationTypeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEnumerationTypeSpecifier(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Object yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("enum")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = cast(yyOpValue1);
final int yyChoice1 = yyOption1;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = pCIdentifier$Identifier(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final String v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$2.
final String v$g$2 = cast(yyOpValue1);
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("{")) {
yyResult = pEnumeratorList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyOption1 = yyResult.index;
} else {
yyError = yyError.select("',' expected", yyBase);
}
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$4.
final Node v$g$4 = cast(yyOpValue1);
yyValue = GNode.create("EnumerationTypeDefinition", v$g$1, v$g$2, v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$4.
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
} else {
yyError = yyError.select("'{' expected", yyBase);
}
} // End scope for v$g$2.
// Nested alternative 2.
yyResult = pCIdentifier$Identifier(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("EnumerationTypeReference", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} // End scope for v$g$1.
}
// Done.
yyError = yyError.select("enumeration type specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.EnumeratorList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEnumeratorList(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <List>.
yyResult = pEnumerator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pEnumerator(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("EnumeratorList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Enumerator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEnumerator(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Enumerator>.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String id = yyResult.semanticValue();
yyState.bind(toText(id), false);
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("=")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
} else {
yyError = yyError.select("'=' expected", yyBase);
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyValue = GNode.create("Enumerator", id, v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$1.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StructureTypeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStructureTypeSpecifier(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Object yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("struct")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = cast(yyOpValue1);
final int yyChoice1 = yyOption1;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = p$$Shared1(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Object v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$2.
final Object v$g$2 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("{")) {
yyResult = pPushScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pEnterStructure(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pStructureDeclarationList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyResult = pExitStructure(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pPopScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$4.
final Node v$g$4 = cast(yyOpValue1);
yyValue = GNode.create("StructureTypeDefinition", v$g$1, v$g$2, v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$4.
}
}
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
}
}
} else {
yyError = yyError.select("'{' expected", yyBase);
}
} // End scope for v$g$2.
// Nested alternative 2.
yyResult = p$$Shared1(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Object v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("StructureTypeReference", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} // End scope for v$g$1.
}
// Done.
yyError = yyError.select("structure type specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.$$Shared1.
* This nonterminal represents the duplicate productions
* xtc.lang.CPattern.StructureTag and xtc.lang.CPattern.UnionTag.
*
* @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;
Object yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Pattern>.
yyResult = pStringVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Identifier>.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.UnionTypeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pUnionTypeSpecifier(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Object yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("union")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = cast(yyOpValue1);
final int yyChoice1 = yyOption1;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = p$$Shared1(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Object v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$2.
final Object v$g$2 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("{")) {
yyResult = pPushScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pEnterStructure(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pStructureDeclarationList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyResult = pExitStructure(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pPopScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$4.
final Node v$g$4 = cast(yyOpValue1);
yyValue = GNode.create("UnionTypeDefinition", v$g$1, v$g$2, v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$4.
}
}
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
}
}
} else {
yyError = yyError.select("'{' expected", yyBase);
}
} // End scope for v$g$2.
// Nested alternative 2.
yyResult = p$$Shared1(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Object v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("UnionTypeReference", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} // End scope for v$g$1.
}
// Done.
yyError = yyError.select("union type specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StructureDeclarationList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStructureDeclarationList(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Regular>.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pAnnotatedStructureDeclaration(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
final Pair<Node> v$g$1 = yyRepValue1.reverse();
yyResult = pAnnotations(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("StructureDeclarationList", v$g$1.size() + 1).
addAll(v$g$1).add(v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative <Empty>.
if (GCC) {
yyResult = pAnnotations(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = GNode.create("StructureDeclarationList", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("structure declaration list expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AnnotatedStructureDeclaration.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAnnotatedStructureDeclaration(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyState.mark();
yyResult = pStructureDeclaration(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node d = yyResult.semanticValue();
yyValue = yyState.annotate(d);
// Commit the state modification.
yyState.commit();
setLocation(yyValue, yyStart);
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StructureDeclaration.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStructureDeclaration(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
boolean yyRepeated1;
int yyOption1;
String yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Declaration>.
yyOption1 = yyStart;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pKeyword(yyBase);
if (yyResult.hasValue("__extension__")) {
final String v$el$1 = "__extension__";
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("'__extension__' expected", yyBase);
}
{ // Start scope for v$g$1.
final String v$g$1 = yyOpValue1;
yyResult = pSpecifierQualifierList(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyResult = pOptionalStructureDeclaratorList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyOption1 = yyResult.index;
if (GCC) {
yyRepetition1 = yyOption1;
yyRepeated1 = false;
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
} else {
yyError = yyError.select("';' expected", yyBase);
}
break;
}
if (yyRepeated1) {
yyOption1 = yyRepetition1;
}
}
yyValue = GNode.create("StructureDeclaration", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
}
} // End scope for v$g$1.
// Alternative <ListPattern>.
yyResult = pNodeListVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Pattern>.
yyResult = pNodeVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("structure declaration expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.SpecifierQualifierList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSpecifierQualifierList(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fSpecifierQualifierList)
yyColumn.chunk1.fSpecifierQualifierList = pSpecifierQualifierList$1(yyStart);
return yyColumn.chunk1.fSpecifierQualifierList;
}
/** Actually parse xtc.lang.CPattern.SpecifierQualifierList. */
private Result pSpecifierQualifierList$1(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSpecifierQualifierPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$1 = yyResult.semanticValue();
yyValue = GNode.createFromPair("SpecifierQualifierList", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.SpecifierQualifierPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSpecifierQualifierPlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pSpecifierQualifier(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
yyValue = yyRepValue1.reverse();
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.SpecifierQualifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSpecifierQualifier(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <TypeSpecifier>.
yyResult = pTypeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pTypeSpecContext(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative <TypeQualifier>.
yyResult = pTypeQualifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Attribute>.
yyResult = pAttributeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.OptionalStructureDeclaratorList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pOptionalStructureDeclaratorList(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <List>.
yyResult = pStructureDeclaratorList(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Null>.
if (GCC) {
{ // Start scope for yyValue.
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
} // End scope for yyValue.
}
// Done.
yyError = yyError.select("optional structure declarator list expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StructureDeclaratorList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStructureDeclaratorList(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <List>.
yyResult = pStructureDeclarator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pStructureDeclarator(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("StructureDeclaratorList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StructureDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStructureDeclarator(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyOpValue1 = null;
yyResult = pDeclarator(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$4.
final Node v$g$4 = yyOpValue1;
yyValue = GNode.create("BitField", v$g$1, v$g$2, v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$4.
}
} else {
yyError = yyError.select("':' expected", yyBase);
}
} // End scope for v$g$2.
} // End scope for v$g$1.
// Alternative <Simple>.
yyResult = pAttributedDeclarator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributedDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributedDeclarator(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fAttributedDeclarator)
yyColumn.chunk1.fAttributedDeclarator = pAttributedDeclarator$1(yyStart);
return yyColumn.chunk1.fAttributedDeclarator;
}
/** Actually parse xtc.lang.CPattern.AttributedDeclarator. */
private Result pAttributedDeclarator$1(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyResult = pDeclarator(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
yyValue = GNode.create("AttributedDeclarator", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$3.
}
} // End scope for v$g$1.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Declarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarator(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fDeclarator)
yyColumn.chunk1.fDeclarator = pDeclarator$1(yyStart);
return yyColumn.chunk1.fDeclarator;
}
/** Actually parse xtc.lang.CPattern.Declarator. */
private Result pDeclarator$1(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Pointer>.
yyResult = pPointerDeclarator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Direct>.
yyResult = pDirectDeclarator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.PointerDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPointerDeclarator(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pPointer(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyResult = pDirectDeclarator(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("PointerDeclarator", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Pointer.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPointer(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fPointer)
yyColumn.chunk1.fPointer = pPointer$1(yyStart);
return yyColumn.chunk1.fPointer;
}
/** Actually parse xtc.lang.CPattern.Pointer. */
private Result pPointer$1(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("*")) {
yyResult = pTypeQualifierList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pPointer(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
yyValue = GNode.create("Pointer", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$2.
}
}
// Done.
yyError = yyError.select("pointer expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.TypeQualifierList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeQualifierList(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pTypeQualifierList$$Choice1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$g$1.
final Pair<Node> v$g$1 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("TypeQualifierList", v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$1.
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.TypeQualifierList$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeQualifierList$$Choice1(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pTypeQualifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pAttributeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DirectDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDirectDeclarator(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <FullBase>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pAttributedDeclarator(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$7 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$8 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$8, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$9.
final Pair<Action<Node>> v$9 = yyRepValue1.reverse();
yyValue = apply(v$9, v$g$7, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$9.
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
// Alternative <SimpleBase>.
yyResult = pSimpleDeclarator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$10 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$11 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$11, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$12.
final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
yyValue = apply(v$12, v$g$10, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$12.
}
// Done.
yyError = yyError.select("direct declarator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.DirectDeclarator$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDirectDeclarator$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pPushScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pParameterTypeList(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pParameterContext(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("FunctionDeclarator", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
// Nested alternative 2.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = pIdentifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pParameterContext(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("FunctionDeclarator", v$1, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
} // End scope for v$g$3.
}
}
// Alternative 2.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("[")) {
yyResult = pArrayQualifierList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$4 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = pAssignmentExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$5.
final Node v$g$5 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("ArrayDeclarator", v$1, v$g$4, v$g$5);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
} // End scope for v$g$5.
// Nested alternative 2.
yyResult = pVariableLength(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$6 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("ArrayDeclarator", v$1, v$g$4, v$g$6);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
}
}
// Done.
yyError = yyError.select("direct declarator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.VariableLength.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pVariableLength(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fVariableLength)
yyColumn.chunk1.fVariableLength = pVariableLength$1(yyStart);
return yyColumn.chunk1.fVariableLength;
}
/** Actually parse xtc.lang.CPattern.VariableLength. */
private Result pVariableLength$1(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("*")) {
yyValue = GNode.create("VariableLength", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("variable length expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.SimpleDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSimpleDeclarator(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <PatternVariable>.
yyResult = pStringVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("SimpleDeclarator", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Declarator>.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String id = yyResult.semanticValue();
yyState.bind(toText(id));
yyValue = GNode.create("SimpleDeclarator", id);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ParameterTypeList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParameterTypeList(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fParameterTypeList)
yyColumn.chunk1.fParameterTypeList = pParameterTypeList$1(yyStart);
return yyColumn.chunk1.fParameterTypeList;
}
/** Actually parse xtc.lang.CPattern.ParameterTypeList. */
private Result pParameterTypeList$1(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
String yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pParameterList(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("...")) {
final String v$el$1 = "...";
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("'...' expected", yyBase);
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
{ // Start scope for v$g$2.
final String v$g$2 = yyOpValue1;
yyValue = GNode.create("ParameterTypeList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ParameterList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParameterList(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pParameterDeclaration(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pParameterDeclaration(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("ParameterList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ParameterDeclaration.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParameterDeclaration(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyResult = pDeclarationSpecifiers(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pDeclarator(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
yyValue = GNode.create("ParameterDeclaration", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
// Commit the state modification.
yyState.commit();
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$3.
}
// Nested alternative 2.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = pAbstractDeclarator(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$4.
final Node v$g$4 = yyOpValue1;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for v$g$5.
final Node v$g$5 = yyOpValue1;
yyValue = GNode.create("ParameterDeclaration", v$g$1, v$g$4, v$g$5);
yyValue.setLocation(location(yyStart));
// Commit the state modification.
yyState.commit();
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$5.
} // End scope for v$g$4.
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributedAbstractDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributedAbstractDeclarator(final int yyStart)
throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyResult = pAbstractDeclarator(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("AttributedAbstractDeclarator", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} // End scope for v$g$1.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AbstractDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAbstractDeclarator(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fAbstractDeclarator)
yyColumn.chunk1.fAbstractDeclarator = pAbstractDeclarator$1(yyStart);
return yyColumn.chunk1.fAbstractDeclarator;
}
/** Actually parse xtc.lang.CPattern.AbstractDeclarator. */
private Result pAbstractDeclarator$1(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pPointer(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for p.
final Node p = yyOpValue1;
yyResult = pDirectAbstractDeclarator(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node d = yyResult.semanticValue();
if ((null != p) || (null != d)) {
yyValue = GNode.create("AbstractDeclarator", p, d);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
} // End scope for p.
// Done.
yyError = yyError.select("abstract declarator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DirectAbstractDeclarator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDirectAbstractDeclarator(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Parenthesized>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pAttributedAbstractDeclarator(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$7 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$8 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$8, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$9.
final Pair<Action<Node>> v$9 = yyRepValue1.reverse();
yyValue = apply(v$9, v$g$7, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$9.
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
// Alternative <Empty>.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$11 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$11, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$12.
final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
yyValue = apply(v$12, null, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$12.
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.DirectAbstractDeclarator$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDirectAbstractDeclarator$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("[")) {
final String v$g$2 = "[";
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyOption1 = yyChoice1;
yyOpValue1 = null;
yyResult = pAssignmentExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("DirectAbstractDeclarator", v$1, v$g$2, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
} // End scope for v$g$3.
// Nested alternative 2.
yyResult = pVariableLength(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$4 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("DirectAbstractDeclarator", v$1, v$g$2, v$g$4);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
}
// Alternative 2.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
final String v$g$5 = "(";
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pParameterTypeList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$6.
final Node v$g$6 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("DirectAbstractDeclarator", v$1, v$g$5, v$g$6);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
} // End scope for v$g$6.
}
// Done.
yyError = yyError.select("direct abstract declarator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.IdentifierList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pIdentifierList(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<String> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String id1 = yyResult.semanticValue();
yyState.bind(toText(id1));
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pCIdentifier$Identifier(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final String id2 = yyResult.semanticValue();
yyState.bind(toText(id2));
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<String>(id2, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$1.
final Pair<String> v$g$1 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("IdentifierList", id1, v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$1.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ArrayQualifierList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pArrayQualifierList(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pArrayQualifierList$$Choice1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$g$1.
final Pair<Node> v$g$1 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("ArrayQualifierList", v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$1.
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.ArrayQualifierList$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pArrayQualifierList$$Choice1(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("static")) {
yyValue = GNode.create("StaticSpecifier", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("volatile")) {
final String v$g$1 = "volatile";
yyValue = GNode.create("VolatileQualifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__volatile")) {
final String v$g$2 = "__volatile";
yyValue = GNode.create("VolatileQualifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__volatile__")) {
final String v$g$3 = "__volatile__";
yyValue = GNode.create("VolatileQualifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("restrict")) {
final String v$g$1 = "restrict";
yyValue = GNode.create("RestrictQualifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 6.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__restrict")) {
final String v$g$2 = "__restrict";
yyValue = GNode.create("RestrictQualifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 7.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__restrict__")) {
final String v$g$3 = "__restrict__";
yyValue = GNode.create("RestrictQualifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 8.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("const")) {
final String v$g$1 = "const";
yyValue = GNode.create("ConstantQualifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 9.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__const")) {
final String v$g$2 = "__const";
yyValue = GNode.create("ConstantQualifier", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 10.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__const__")) {
final String v$g$3 = "__const__";
yyValue = GNode.create("ConstantQualifier", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 11.
yyResult = pAttributeSpecifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("array qualifier list expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.FloatingPointTypeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pFloatingPointTypeSpecifier(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("_Complex")) {
final String v$g$1 = "_Complex";
yyValue = GNode.create("Complex", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__complex__")) {
final String v$g$2 = "__complex__";
yyValue = GNode.create("Complex", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("double")) {
yyValue = GNode.create("Double", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("float")) {
yyValue = GNode.create("Float", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("floating point type specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.IntegerTypeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pIntegerTypeSpecifier(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("long")) {
yyValue = GNode.create("Long", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("int")) {
yyValue = GNode.create("Int", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("short")) {
yyValue = GNode.create("Short", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("char")) {
yyValue = GNode.create("Char", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("_Bool")) {
yyValue = GNode.create("Bool", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 6.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("unsigned")) {
yyValue = GNode.create("Unsigned", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 7.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("signed")) {
final String v$g$1 = "signed";
yyValue = GNode.create("Signed", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 8.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__signed")) {
final String v$g$2 = "__signed";
yyValue = GNode.create("Signed", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 9.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__signed__")) {
final String v$g$3 = "__signed__";
yyValue = GNode.create("Signed", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("integer type specifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.TypeofKeyword.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeofKeyword(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("typeof")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__typeof")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__typeof__")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("typeof keyword expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Initializer.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInitializer(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Complex>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("{")) {
yyResult = pInitializerList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyOption1 = yyResult.index;
} else {
yyError = yyError.select("',' expected", yyBase);
}
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
}
// Alternative <Simple>.
yyResult = pAssignmentExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("initializer expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.InitializerList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInitializerList(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pInitializerListEntry(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pInitializerListEntry(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("InitializerList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Alternative 2.
if (GCC) {
yyValue = GNode.create("InitializerList", false);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyStart, yyError);
}
// Done.
yyError = yyError.select("initializer list expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.InitializerListEntry.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInitializerListEntry(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pDesignation(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyResult = pInitializer(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("InitializerListEntry", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} // End scope for v$g$1.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Designation.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDesignation(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Standard>.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDesignator(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
final Pair<Node> v$g$1 = yyRepValue1.reverse();
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("=")) {
yyValue = GNode.createFromPair("Designation", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("'=' expected", yyBase);
}
}
// Alternative 2.
if (GCC) {
final int yyChoice1 = yyStart;
// Nested alternative 1.
yyResult = pObsoleteArrayDesignation(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pObsoleteFieldDesignation(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("designation expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Designator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDesignator(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Array>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("[")) {
final String v$g$1 = "[";
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = GNode.create("Designator", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
}
// Alternative <ArrayRange>.
if (GCC) {
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("[")) {
final String v$g$3 = "[";
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$4 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("...")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$5 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = GNode.create("Designator", v$g$3, v$g$4, v$g$5);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
} else {
yyError = yyError.select("'...' expected", yyBase);
}
}
}
}
// Alternative <Structure>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(".")) {
final String v$g$6 = ".";
yyResult = pPrimaryIdentifier(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$7 = yyResult.semanticValue();
yyValue = GNode.create("Designator", v$g$6, v$g$7);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("designator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ObsoleteArrayDesignation.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pObsoleteArrayDesignation(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("[")) {
final String v$g$1 = "[";
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyBase = yyChoice1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = GNode.create("ObsoleteArrayDesignation", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
// Nested alternative 2.
yyBase = yyChoice1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("...")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = GNode.create("ObsoleteArrayDesignation", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
} else {
yyError = yyError.select("'...' expected", yyBase);
}
}
}
// Done.
yyError = yyError.select("obsolete array designation expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ObsoleteFieldDesignation.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pObsoleteFieldDesignation(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyValue = GNode.create("ObsoleteFieldDesignation", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.TypeName.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeName(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk1) yyColumn.chunk1 = new Chunk1();
if (null == yyColumn.chunk1.fTypeName)
yyColumn.chunk1.fTypeName = pTypeName$1(yyStart);
return yyColumn.chunk1.fTypeName;
}
/** Actually parse xtc.lang.CPattern.TypeName. */
private Result pTypeName$1(final int yyStart) throws IOException {
Result yyResult;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative 1.
yyResult = pSpecifierQualifierList(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAbstractDeclarator(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
yyValue = GNode.create("TypeName", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
// Commit the state modification.
yyState.commit();
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$2.
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributeSpecifierList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeSpecifierList(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fAttributeSpecifierList)
yyColumn.chunk2.fAttributeSpecifierList = pAttributeSpecifierList$1(yyStart);
return yyColumn.chunk2.fAttributeSpecifierList;
}
/** Actually parse xtc.lang.CPattern.AttributeSpecifierList. */
private Result pAttributeSpecifierList$1(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pAttributeSpecifierPlus(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$1 = yyResult.semanticValue();
yyValue = GNode.createFromPair("AttributeSpecifierList", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributeSpecifierPlus.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeSpecifierPlus(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Pair<Node> yyRepValue1;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pAttributeSpecifier(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
if (yyRepeated1) {
yyValue = yyRepValue1.reverse();
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributeSpecifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeSpecifier(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fAttributeSpecifier)
yyColumn.chunk2.fAttributeSpecifier = pAttributeSpecifier$1(yyStart);
return yyColumn.chunk2.fAttributeSpecifier;
}
/** Actually parse xtc.lang.CPattern.AttributeSpecifier. */
private Result pAttributeSpecifier$1(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pAttributeKeyword(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("AttributeSpecifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
} // End scope for v$g$1.
} else {
yyError = yyError.select("'(' expected", yyBase);
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributeKeyword.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeKeyword(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__attribute")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__attribute__")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("attribute keyword expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributeList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeList(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pAttributeListEntry(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pAttributeListEntry(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("AttributeList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AttributeListEntry.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAttributeListEntry(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
int yyOption2;
Node yyOpValue2;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$Word(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyOption2 = yyResult.index;
yyOpValue2 = null;
yyResult = pExpressionList(yyOption2);
yyError = yyResult.select(yyError, yyOption2);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption2 = yyResult.index;
yyOpValue2 = v$el$2;
}
{ // Start scope for v$el$1.
final Node v$el$1 = yyOpValue2;
yyBase = yyOption2;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("')' expected", yyBase);
}
} // End scope for v$el$1.
} else {
yyError = yyError.select("'(' expected", yyBase);
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
yyValue = GNode.create("AttributeListEntry", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Statement.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStatement(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fStatement)
yyColumn.chunk2.fStatement = pStatement$1(yyStart);
return yyColumn.chunk2.fStatement;
}
/** Actually parse xtc.lang.CPattern.Statement. */
private Result pStatement$1(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCommaExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("ExpressionStatement", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
// Alternative <Compound>.
yyResult = pCompoundStatement(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("if")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyBase = yyChoice1;
yyResult = pKeyword(yyBase);
if (yyResult.hasValue("else")) {
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = GNode.create("IfElseStatement", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'else' expected", yyBase);
}
// Nested alternative 2.
yyValue = GNode.create("IfStatement", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyChoice1, yyError);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("while")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("WhileStatement", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("do")) {
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pKeyword(yyBase);
if (yyResult.hasValue("while")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("DoStatement", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
} else {
yyError = yyError.select("'while' expected", yyBase);
}
}
}
// Alternative 6.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("for")) {
yyResult = pPushScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pInitialClause(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pCommaExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pCommaExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$4 = yyResult.semanticValue();
yyResult = pPopScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("ForStatement", v$g$1, v$g$2, v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
} // End scope for v$g$3.
} else {
yyError = yyError.select("';' expected", yyBase);
}
} // End scope for v$g$2.
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
}
// Alternative 7.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("switch")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("SwitchStatement", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative <Complete>.
yyResult = pLabel(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyResult = pStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("LabeledStatement", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative <Incomplete>.
if (GCC) {
yyResult = pLabel(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = GNode.create("LabeledStatement", v$g$3, null);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 10.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("break")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("BreakStatement", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
// Alternative 11.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("continue")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("ContinueStatement", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
// Alternative 12.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("return")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pCommaExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("ReturnStatement", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
} // End scope for v$g$1.
}
// Alternative 13.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("goto")) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pGotoLabel(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("GotoStatement", null, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
// Nested alternative 2.
yyResult = pPrimaryIdentifier(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("GotoStatement", null, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
}
// Alternative <Computed>.
if (GCC) {
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("goto")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("*")) {
final String v$g$4 = "*";
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$5 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("GotoStatement", v$g$4, v$g$5);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
}
} else {
yyError = yyError.select("'*' expected", yyBase);
}
}
}
// Alternative 15.
yyResult = pAsmKeyword(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pTypeQualifier(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$1.
final Node v$g$1 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pAssemblyArgument(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
final String v$g$3 = ";";
yyValue = GNode.create("AssemblyStatement", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
} // End scope for v$g$1.
}
// Alternative 16.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(";")) {
yyValue = GNode.create("EmptyStatement", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("statement expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Label.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLabel(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Patterned>.
yyResult = pStringVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
yyValue = GNode.create("NamedLabel", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$2.
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
// Alternative <Label>.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAttributeSpecifierList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$4.
final Node v$g$4 = yyOpValue1;
yyValue = GNode.create("NamedLabel", v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyOption1, yyError);
} // End scope for v$g$4.
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
// Alternative <Range>.
if (GCC) {
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("case")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("...")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyValue = GNode.create("CaseLabel", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
} else {
yyError = yyError.select("'...' expected", yyBase);
}
}
}
}
// Alternative <Simple>.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("case")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyValue = GNode.create("CaseLabel", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("default")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyValue = GNode.create("DefaultLabel", false);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
// Done.
yyError = yyError.select("label expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.CompoundStatement.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCompoundStatement(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fCompoundStatement)
yyColumn.chunk2.fCompoundStatement = pCompoundStatement$1(yyStart);
return yyColumn.chunk2.fCompoundStatement;
}
/** Actually parse xtc.lang.CPattern.CompoundStatement. */
private Result pCompoundStatement$1(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Compound>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("{")) {
yyResult = pPushScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pLocalLabelDeclarationStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$1 = yyResult.semanticValue();
yyResult = pDeclarationOrStatementStar(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$2 = yyResult.semanticValue();
yyResult = pAnnotations(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyResult = pPopScope(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("CompoundStatement", v$g$1.size() + v$g$2.size() + 1).
addAll(v$g$1).addAll(v$g$2).add(v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
}
}
}
}
// Done.
yyError = yyError.select("compound statement expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.LocalLabelDeclarationStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLocalLabelDeclarationStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Node> yyRepValue1;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pLocalLabelDeclaration(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for yyValue.
yyValue = yyRepValue1.reverse();
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for yyValue.
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.LocalLabelDeclaration.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLocalLabelDeclaration(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<String> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__label__")) {
yyResult = pCIdentifier$Identifier(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pCIdentifier$Identifier(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final String v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<String>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<String> v$g$2 = yyRepValue1.reverse();
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
yyValue = GNode.createFromPair("LocalLabelDeclaration", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
} // End scope for v$g$2.
}
}
// Done.
yyError = yyError.select("local label declaration expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationOrStatementStar.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationOrStatementStar(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Node> yyRepValue1;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pDeclarationOrStatement(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
break;
}
{ // Start scope for yyValue.
yyValue = yyRepValue1.reverse();
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for yyValue.
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.DeclarationOrStatement.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDeclarationOrStatement(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative <Declaration>.
yyState.mark();
yyResult = pDeclaration(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node d = yyResult.semanticValue();
yyValue = yyState.annotate(d);
// Commit the state modification.
yyState.commit();
setLocation(yyValue, yyStart);
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Statement>.
yyResult = pStatement(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node s = yyResult.semanticValue();
yyValue = yyState.annotate(s);
// Commit the state modification.
yyState.commit();
setLocation(yyValue, yyStart);
return yyResult.createValue(yyValue, yyError);
}
// Alternative <ListPattern>.
yyResult = pNodeListVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v = yyResult.semanticValue();
yyValue = yyState.annotate(v);
// Commit the state modification.
yyState.commit();
setLocation(yyValue, yyStart);
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Pattern>.
yyResult = pNodeVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v = yyResult.semanticValue();
yyValue = yyState.annotate(v);
// Commit the state modification.
yyState.commit();
setLocation(yyValue, yyStart);
return yyResult.createValue(yyValue, yyError);
}
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.InitialClause.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pInitialClause(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative <Declaration>.
yyResult = pDeclaration(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Expression>.
yyOption1 = yyStart;
yyOpValue1 = null;
yyResult = pCommaExpression(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$3 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$3;
}
{ // Start scope for yyValue.
yyValue = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(";")) {
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("';' expected", yyBase);
}
} // End scope for yyValue.
// Abort the state modification.
yyState.abort();
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.CommaExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCommaExpression(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fCommaExpression)
yyColumn.chunk2.fCommaExpression = pCommaExpression$1(yyStart);
return yyColumn.chunk2.fCommaExpression;
}
/** Actually parse xtc.lang.CPattern.CommaExpression. */
private Result pCommaExpression$1(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pAssignmentExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pCommaExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$3 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$3, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$4.
final Pair<Action<Node>> v$4 = yyRepValue1.reverse();
yyValue = apply(v$4, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$4.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.CommaExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCommaExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Comma>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(",")) {
yyResult = pAssignmentExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("CommaExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("comma expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AssignmentExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssignmentExpression(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fAssignmentExpression)
yyColumn.chunk2.fAssignmentExpression = pAssignmentExpression$1(yyStart);
return yyColumn.chunk2.fAssignmentExpression;
}
/** Actually parse xtc.lang.CPattern.AssignmentExpression. */
private Result pAssignmentExpression$1(final int yyStart)
throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Assignment>.
yyResult = pUnaryExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyResult = pAssignmentOperator(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pAssignmentExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = GNode.create("AssignmentExpression", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative <Base>.
yyResult = pConditionalExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AssignmentOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssignmentOperator(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Equal>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("=")) {
yyValue = "=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <PlusEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("+=")) {
yyValue = "+=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <MinusEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("-=")) {
yyValue = "-=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <TimesEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("*=")) {
yyValue = "*=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <OverEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("/=")) {
yyValue = "/=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <ModuloEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("%=")) {
yyValue = "%=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <LeftEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("<<=")) {
yyValue = "<<=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <RightEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(">>=")) {
yyValue = ">>=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <AndEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("&=")) {
yyValue = "&=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <XorEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("^=")) {
yyValue = "^=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <OrEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("|=")) {
yyValue = "|=";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("assignment operator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ConditionalExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pConditionalExpression(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fConditionalExpression)
yyColumn.chunk2.fConditionalExpression = pConditionalExpression$1(yyStart);
return yyColumn.chunk2.fConditionalExpression;
}
/** Actually parse xtc.lang.CPattern.ConditionalExpression. */
private Result pConditionalExpression$1(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Conditional>.
yyResult = pLogicalOrExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("?")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = GNode.create("ConditionalExpression", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("':' expected", yyBase);
}
}
} else {
yyError = yyError.select("'?' expected", yyBase);
}
}
// Alternative <IncompleteConditional>.
if (GCC) {
yyResult = pLogicalOrExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$4 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("?")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyResult = pConditionalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$6 = yyResult.semanticValue();
yyValue = GNode.create("ConditionalExpression", v$g$4, null, v$g$6);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("':' expected", yyBase);
}
} else {
yyError = yyError.select("'?' expected", yyBase);
}
}
}
// Alternative <Base>.
yyResult = pLogicalOrExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("conditional expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.LogicalOrExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLogicalOrExpression(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fLogicalOrExpression)
yyColumn.chunk2.fLogicalOrExpression = pLogicalOrExpression$1(yyStart);
return yyColumn.chunk2.fLogicalOrExpression;
}
/** Actually parse xtc.lang.CPattern.LogicalOrExpression. */
private Result pLogicalOrExpression$1(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pLogicalAndExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pLogicalOrExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$3 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$3, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$4.
final Pair<Action<Node>> v$4 = yyRepValue1.reverse();
yyValue = apply(v$4, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$4.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.LogicalOrExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLogicalOrExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Or>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("||")) {
yyResult = pLogicalAndExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("LogicalOrExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("logical or expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.LogicalAndExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLogicalAndExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pBitwiseOrExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pLogicalAndExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$3 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$3, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$4.
final Pair<Action<Node>> v$4 = yyRepValue1.reverse();
yyValue = apply(v$4, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$4.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.LogicalAndExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLogicalAndExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <And>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("&&")) {
yyResult = pBitwiseOrExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("LogicalAndExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("logical and expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.BitwiseOrExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBitwiseOrExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pBitwiseXorExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pBitwiseOrExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$3 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$3, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$4.
final Pair<Action<Node>> v$4 = yyRepValue1.reverse();
yyValue = apply(v$4, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$4.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.BitwiseOrExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBitwiseOrExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Or>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("|")) {
yyResult = pBitwiseXorExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("BitwiseOrExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("bitwise or expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.BitwiseXorExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBitwiseXorExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pBitwiseAndExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pBitwiseXorExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$3 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$3, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$4.
final Pair<Action<Node>> v$4 = yyRepValue1.reverse();
yyValue = apply(v$4, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$4.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.BitwiseXorExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBitwiseXorExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Xor>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("^")) {
yyResult = pBitwiseAndExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("BitwiseXorExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("bitwise xor expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.BitwiseAndExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBitwiseAndExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pEqualityExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pBitwiseAndExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$3 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$3, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$4.
final Pair<Action<Node>> v$4 = yyRepValue1.reverse();
yyValue = apply(v$4, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$4.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.BitwiseAndExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBitwiseAndExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <And>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("&")) {
yyResult = pEqualityExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("BitwiseAndExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("bitwise and expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.EqualityExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEqualityExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pRelationalExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pEqualityExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$4 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$4, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$5.
final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
yyValue = apply(v$5, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$5.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.EqualityExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEqualityExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Recursion>.
yyResult = pEqualityOperator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pRelationalExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("EqualityExpression", v$1, v$g$2, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.EqualityOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEqualityOperator(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Equal>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("==")) {
yyValue = "==";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <NotEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("!=")) {
yyValue = "!=";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("equality operator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.RelationalExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pRelationalExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pShiftExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pRelationalExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$4 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$4, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$5.
final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
yyValue = apply(v$5, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$5.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.RelationalExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pRelationalExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Recursion>.
yyResult = pRelationalOperator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pShiftExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("RelationalExpression", v$1, v$g$2, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.RelationalOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pRelationalOperator(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <LessEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("<=")) {
yyValue = "<=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Less>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("<")) {
yyValue = "<";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <GreaterEqual>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(">=")) {
yyValue = ">=";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Greater>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(">")) {
yyValue = ">";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("relational operator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ShiftExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pShiftExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pAdditiveExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pShiftExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$4 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$4, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$5.
final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
yyValue = apply(v$5, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$5.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.ShiftExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pShiftExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Recursion>.
yyResult = pShiftOperator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pAdditiveExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("ShiftExpression", v$1, v$g$2, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ShiftOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pShiftOperator(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Left>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("<<")) {
yyValue = "<<";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Right>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(">>")) {
yyValue = ">>";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("shift operator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AdditiveExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAdditiveExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pMultiplicativeExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pAdditiveExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$4 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$4, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$5.
final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
yyValue = apply(v$5, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$5.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.AdditiveExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAdditiveExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Recursion>.
yyResult = pAdditiveOperator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pMultiplicativeExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("AdditiveExpression", v$1, v$g$2, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AdditiveOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAdditiveOperator(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Plus>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("+")) {
yyValue = "+";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Minus>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("-")) {
yyValue = "-";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("additive operator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.MultiplicativeExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMultiplicativeExpression(final int yyStart)
throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Base>.
yyResult = pCastExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pMultiplicativeExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$4 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$4, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$5.
final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
yyValue = apply(v$5, yyValue, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$5.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal
* xtc.lang.CFactory.MultiplicativeExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMultiplicativeExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Recursion>.
yyResult = pMultiplicativeOperator(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("MultiplicativeExpression", v$1, v$g$2, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.MultiplicativeOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pMultiplicativeOperator(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Times>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("*")) {
yyValue = "*";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Over>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("/")) {
yyValue = "/";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Modulo>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("%")) {
yyValue = "%";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("multiplicative operator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.CastExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCastExpression(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fCastExpression)
yyColumn.chunk2.fCastExpression = pCastExpression$1(yyStart);
return yyColumn.chunk2.fCastExpression;
}
/** Actually parse xtc.lang.CPattern.CastExpression. */
private Result pCastExpression$1(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Cast>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("CastExpression", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
// Alternative <Base>.
yyResult = pUnaryExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("cast expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.UnaryExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pUnaryExpression(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk2) yyColumn.chunk2 = new Chunk2();
if (null == yyColumn.chunk2.fUnaryExpression)
yyColumn.chunk2.fUnaryExpression = pUnaryExpression$1(yyStart);
return yyColumn.chunk2.fUnaryExpression;
}
/** Actually parse xtc.lang.CPattern.UnaryExpression. */
private Result pUnaryExpression$1(final int yyStart) throws IOException {
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("sizeof")) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyBase = yyChoice1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyPredMatched = false;
yyPredResult = pSymbol(yyResult.index);
if (yyPredResult.hasValue("{")) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = GNode.create("SizeofExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("unary expression expected", yyStart);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
// Nested alternative 2.
yyResult = pUnaryExpression(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("SizeofExpression", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pAlignofKeyword(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyBase = yyChoice1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyPredMatched = false;
yyPredResult = pSymbol(yyResult.index);
if (yyPredResult.hasValue("{")) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyValue = GNode.create("AlignofExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("unary expression expected", yyStart);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
// Nested alternative 2.
yyResult = pUnaryExpression(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("AlignofExpression", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__builtin_offsetof")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pPostfixExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("OffsetofExpression", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative 4.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__builtin_types_compatible_p")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("TypeCompatibilityExpression", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative 5.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("-")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("UnaryMinusExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 6.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("+")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("UnaryPlusExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 7.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("!")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("LogicalNegationExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 8.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("~")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("BitwiseNegationExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 9.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("&")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("AddressExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 10.
if (GCC) {
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("&&")) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pStringVariable(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("LabelAddressExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyResult = pCIdentifier$Identifier(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("LabelAddressExpression", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 11.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("*")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("IndirectionExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 12.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("++")) {
yyResult = pUnaryExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("PreincrementExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 13.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("--")) {
yyResult = pUnaryExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("PredecrementExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative <Extension>.
if (GCC) {
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__extension__")) {
yyResult = pCastExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("ExtensionExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative <Base>.
yyResult = pPostfixExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("unary expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AlignofKeyword.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAlignofKeyword(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__alignof__")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__alignof")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("alignof keyword expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.PostfixExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPostfixExpression(final int yyStart) throws IOException {
Result yyResult;
int yyRepetition1;
Pair<Action<Node>> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Compound>.
yyResult = pCompoundLiteral(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$9 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pPostfixExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$10 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$10, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$11.
final Pair<Action<Node>> v$11 = yyRepValue1.reverse();
yyValue = apply(v$11, v$g$9, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$11.
}
// Alternative <Primary>.
yyResult = pPrimaryExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$12 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyResult = pPostfixExpression$$Tail1(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Action<Node> v$13 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Action<Node>>(v$13, yyRepValue1);
continue;
}
break;
}
{ // Start scope for v$14.
final Pair<Action<Node>> v$14 = yyRepValue1.reverse();
yyValue = apply(v$14, v$g$12, yyStart);
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$14.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.PostfixExpression$$Tail1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPostfixExpression$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("[")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("SubscriptExpression", v$1, v$g$2);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
}
// Alternative 2.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(".")) {
yyResult = pCIdentifier$Identifier(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$3 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("DirectComponentSelection", v$1, v$g$3);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 3.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("->")) {
yyResult = pCIdentifier$Identifier(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$4 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("IndirectComponentSelection", v$1, v$g$4);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 4.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pArgumentPattern(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$5 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("FunctionCall", v$1, v$g$5);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
// Alternative 5.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(".")) {
yyResult = pStringVariable(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$6 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("DirectComponentSelection", v$1, v$g$6);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 6.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("->")) {
yyResult = pStringVariable(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$7 = yyResult.semanticValue();
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("IndirectComponentSelection", v$1, v$g$7);
}};
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 7.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pExpressionList(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$8.
final Node v$g$8 = yyOpValue1;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("FunctionCall", v$1, v$g$8);
}};
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
} // End scope for v$g$8.
}
// Alternative 8.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("++")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("PostincrementExpression", v$1);
}};
return yyResult.createValue(yyValue, yyError);
}
// Alternative 9.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("--")) {
yyValue = new Action<Node>() {
public Node run(Node v$1) {
return GNode.create("PostdecrementExpression", v$1);
}};
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("postfix expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ExpressionList.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExpressionList(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fExpressionList)
yyColumn.chunk3.fExpressionList = pExpressionList$1(yyStart);
return yyColumn.chunk3.fExpressionList;
}
/** Actually parse xtc.lang.CPattern.ExpressionList. */
private Result pExpressionList$1(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Expressions>.
yyResult = pAssignmentExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyResult = pExpressionList$$Star1(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$2 = yyResult.semanticValue();
yyValue = GNode.createFromPair("ExpressionList", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.ExpressionList$$Star1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExpressionList$$Star1(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fExpressionList$$Star1)
yyColumn.chunk3.fExpressionList$$Star1 = pExpressionList$$Star1$1(yyStart);
return yyColumn.chunk3.fExpressionList$$Star1;
}
/** Actually parse xtc.lang.CFactory.ExpressionList$$Star1. */
private Result pExpressionList$$Star1$1(final int yyStart)
throws IOException {
Result yyResult;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(",")) {
yyResult = pAssignmentExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyResult = pExpressionList$$Star1(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$2 = yyResult.semanticValue();
yyValue = new Pair<Node>(v$el$1, v$2);
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 2.
yyValue = Pair.empty();
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.CompoundLiteral.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCompoundLiteral(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("{")) {
yyResult = pInitializerList(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyOption1 = yyResult.index;
} else {
yyError = yyError.select("',' expected", yyBase);
}
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("}")) {
yyValue = GNode.create("CompoundLiteral", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("'}' expected", yyBase);
}
}
} else {
yyError = yyError.select("'{' expected", yyBase);
}
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
// Done.
yyError = yyError.select("compound literal expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.PrimaryExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPrimaryExpression(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <PatternVariable>.
yyResult = pNodeVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Constant>.
yyResult = pConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("PrimaryIdentifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
if (GCC) {
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pCompoundStatement(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("StatementAsExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
}
// Alternative 5.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__builtin_va_arg")) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pAssignmentExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pTypeName(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("VariableArgumentAccess", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Alternative <ParenthesizedExpression>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("(")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
}
// Done.
yyError = yyError.select("primary expression expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.PrimaryIdentifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPrimaryIdentifier(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("PrimaryIdentifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.SimpleAssemblyExpression.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSimpleAssemblyExpression(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pAsmKeyword(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pStringConstant(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("SimpleAssemblyExpression", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AssemblyArgument.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssemblyArgument(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pStringConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyBase = yyChoice1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAssemblyOperands(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
}
{ // Start scope for v$g$2.
final Node v$g$2 = yyOpValue1;
final int yyChoice2 = yyOption1;
// Nested alternative 1.
yyBase = yyChoice2;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyOption1 = yyResult.index;
yyOpValue1 = null;
yyResult = pAssemblyOperands(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final Node v$el$2 = yyResult.semanticValue();
yyOption1 = yyResult.index;
yyOpValue1 = v$el$2;
}
{ // Start scope for v$g$3.
final Node v$g$3 = yyOpValue1;
final int yyChoice3 = yyOption1;
// Nested alternative 1.
yyBase = yyChoice3;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(":")) {
yyResult = pAssemblyClobbers(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$4 = yyResult.semanticValue();
yyValue = GNode.create("AssemblyArgument", v$g$1, v$g$2, v$g$3, v$g$4);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
} else {
yyError = yyError.select("':' expected", yyBase);
}
// Nested alternative 2.
yyValue = GNode.create("AssemblyArgument", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyChoice3, yyError);
} // End scope for v$g$3.
} else {
yyError = yyError.select("':' expected", yyBase);
}
// Nested alternative 2.
yyValue = GNode.create("AssemblyArgument", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyChoice2, yyError);
} // End scope for v$g$2.
} else {
yyError = yyError.select("':' expected", yyBase);
}
// Nested alternative 2.
yyValue = GNode.create("AssemblyArgument", v$g$1);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyChoice1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AssemblyOperands.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssemblyOperands(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fAssemblyOperands)
yyColumn.chunk3.fAssemblyOperands = pAssemblyOperands$1(yyStart);
return yyColumn.chunk3.fAssemblyOperands;
}
/** Actually parse xtc.lang.CPattern.AssemblyOperands. */
private Result pAssemblyOperands$1(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pAssemblyOperand(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyResult = pAssemblyOperands$$Star1(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$g$2 = yyResult.semanticValue();
yyValue = GNode.createFromPair("AssemblyOperands", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.AssemblyOperands$$Star1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssemblyOperands$$Star1(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fAssemblyOperands$$Star1)
yyColumn.chunk3.fAssemblyOperands$$Star1 = pAssemblyOperands$$Star1$1(yyStart);
return yyColumn.chunk3.fAssemblyOperands$$Star1;
}
/** Actually parse xtc.lang.CFactory.AssemblyOperands$$Star1. */
private Result pAssemblyOperands$$Star1$1(final int yyStart)
throws IOException {
Result yyResult;
Pair<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue(",")) {
yyResult = pAssemblyOperand(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyResult = pAssemblyOperands$$Star1(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<Node> v$2 = yyResult.semanticValue();
yyValue = new Pair<Node>(v$el$1, v$2);
return yyResult.createValue(yyValue, yyError);
}
}
}
// Alternative 2.
yyValue = Pair.empty();
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AssemblyOperand.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssemblyOperand(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fAssemblyOperand)
yyColumn.chunk3.fAssemblyOperand = pAssemblyOperand$1(yyStart);
return yyColumn.chunk3.fAssemblyOperand;
}
/** Actually parse xtc.lang.CPattern.AssemblyOperand. */
private Result pAssemblyOperand$1(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
String yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyOption1 = yyStart;
yyOpValue1 = null;
yyBase = yyOption1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("[")) {
yyResult = pCIdentifier$Word(yyResult.index);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
final String v$el$1 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("]")) {
yyOption1 = yyResult.index;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("']' expected", yyBase);
}
}
} else {
yyError = yyError.select("'[' expected", yyBase);
}
{ // Start scope for v$g$1.
final String v$g$1 = yyOpValue1;
yyResult = pStringConstant(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$2 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue("(")) {
yyResult = pCommaExpression(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$3 = yyResult.semanticValue();
yyBase = yyResult.index;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(")")) {
yyValue = GNode.create("AssemblyOperand", v$g$1, v$g$2, v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
} else {
yyError = yyError.select("')' expected", yyBase);
}
}
} else {
yyError = yyError.select("'(' expected", yyBase);
}
}
} // End scope for v$g$1.
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AssemblyClobbers.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAssemblyClobbers(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<Node> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pStringConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(",")) {
yyResult = pStringConstant(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final Node v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("',' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<Node> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("AssemblyClobbers", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.AsmKeyword.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pAsmKeyword(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fAsmKeyword)
yyColumn.chunk3.fAsmKeyword = pAsmKeyword$1(yyStart);
return yyColumn.chunk3.fAsmKeyword;
}
/** Actually parse xtc.lang.CPattern.AsmKeyword. */
private Result pAsmKeyword$1(final int yyStart) throws IOException {
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("asm")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 2.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__asm")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Alternative 3.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("__asm__")) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("asm keyword expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.Pattern.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPattern(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Start a state modification.
yyState.start();
// Alternative <Declaration>.
yyResult = pDeclaration(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Function>.
yyResult = pFunctionDefinition(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Statement>.
yyResult = pStatement(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Expression>.
yyResult = pCommaExpression(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (! yyValue.hasName("NodeVariable")) {
// Commit the state modification.
yyState.commit();
return yyResult.createValue(yyValue, yyError);
}
}
// Abort the state modification.
yyState.abort();
// Done.
yyError = yyError.select("pattern expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.GotoLabel.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pGotoLabel(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pStringVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("PrimaryIdentifier", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.ArgumentPattern.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pArgumentPattern(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pNodeListVariable(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Node v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("ExpressionList", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.NodeVariable.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pNodeVariable(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fNodeVariable)
yyColumn.chunk3.fNodeVariable = pNodeVariable$1(yyStart);
return yyColumn.chunk3.fNodeVariable;
}
/** Actually parse xtc.lang.CPattern.NodeVariable. */
private Result pNodeVariable$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('#' == yyC) {
yyIndex = yyStart + 1;
yyResult = pCIdentifier$Word(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("NodeVariable", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("node variable expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.StringVariable.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStringVariable(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fStringVariable)
yyColumn.chunk3.fStringVariable = pStringVariable$1(yyStart);
return yyColumn.chunk3.fStringVariable;
}
/** Actually parse xtc.lang.CPattern.StringVariable. */
private Result pStringVariable$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('#' == yyC) {
yyIndex = yyStart + 1;
yyResult = pCIdentifier$Word(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("StringVariable", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("string variable expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CPattern.NodeListVariable.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pNodeListVariable(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fNodeListVariable)
yyColumn.chunk3.fNodeListVariable = pNodeListVariable$1(yyStart);
return yyColumn.chunk3.fNodeListVariable;
}
/** Actually parse xtc.lang.CPattern.NodeListVariable. */
private Result pNodeListVariable$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('#' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if ('[' == yyC) {
yyIndex = yyIndex + 1;
yyResult = pCIdentifier$WordCharacters(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyC = character(yyResult.index);
if (']' == yyC) {
yyIndex = yyResult.index + 1;
yyResult = pSpacing(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("NodeListVariable", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
// Done.
yyError = yyError.select("node list variable expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.Constant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pConstant(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pFloatingConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pIntegerConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 3.
yyResult = pCharacterConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Alternative 4.
yyResult = pStringConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.IntegerConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pIntegerConstant(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Hex>.
yyResult = pHexConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("IntegerConstant", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Octal>.
yyResult = pOctalConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("IntegerConstant", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Decimal>.
yyResult = pDecimalConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$3 = yyResult.semanticValue();
yyValue = GNode.create("IntegerConstant", v$g$3);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.DecimalConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDecimalConstant(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
int yyOption1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyRepetition1 = yyIndex;
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;
}
yyOption1 = yyRepetition1;
yyResult = pIntegerSuffix(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("decimal constant expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.HexConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHexConstant(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
int yyOption1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pHexPrefix(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
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) {
yyOption1 = yyRepetition1;
yyResult = pIntegerSuffix(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
// Done.
yyError = yyError.select("hex constant expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.HexPrefix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHexPrefix(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('0' == yyC) {
yyIndex = yyStart + 1;
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
switch (yyC) {
case 'X':
case 'x':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
// Done.
yyError = yyError.select("hex prefix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.OctalConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pOctalConstant(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
int yyOption1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('0' == yyC) {
yyIndex = yyStart + 1;
yyRepetition1 = yyIndex;
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':
{
yyRepetition1 = yyIndex;
continue;
}
default:
/* No match. */
}
}
break;
}
yyOption1 = yyRepetition1;
yyResult = pIntegerSuffix(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
// Done.
yyError = yyError.select("octal constant expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.IntegerSuffix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pIntegerSuffix(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pLongLongSuffix(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 'U':
case 'u':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
// Alternative 2.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case 'L':
case 'l':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case 'U':
case 'u':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case 'U':
case 'u':
{
final int yyChoice1 = yyIndex;
// 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 ('l' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
case 'L':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('L' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
default:
/* No match. */
}
}
// Nested alternative 2.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case 'L':
case 'l':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 3.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("integer suffix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.LongLongSuffix.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLongLongSuffix(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 'l':
{
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 ('L' == yyC) {
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("long long suffix expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.FloatingConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pFloatingConstant(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Decimal>.
yyResult = pDecimalFloatingConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyValue = GNode.create("FloatingConstant", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Hex>.
yyResult = pHexFloatingConstant(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyValue = GNode.create("FloatingConstant", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.DecimalFloatingConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDecimalFloatingConstant(final int yyStart)
throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
int yyOption1;
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) {
yyC = character(yyRepetition1);
if ('.' == yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
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;
}
yyOption1 = yyRepetition1;
yyResult = pExponent(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case 'F':
case 'L':
case 'f':
case 'l':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
// Alternative 2.
yyC = character(yyStart);
if ('.' == yyC) {
yyIndex = yyStart + 1;
yyRepetition1 = yyIndex;
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) {
yyOption1 = yyRepetition1;
yyResult = pExponent(yyOption1);
yyError = yyResult.select(yyError, yyOption1);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
}
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case 'F':
case 'L':
case 'f':
case 'l':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
// Alternative 3.
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) {
yyResult = pExponent(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case 'F':
case 'L':
case 'f':
case 'l':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
// Done.
yyError = yyError.select("decimal floating constant expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.HexFloatingConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHexFloatingConstant(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
int yyOption1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pHexPrefix(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyRepetition1 = yyChoice1;
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) {
yyC = character(yyRepetition1);
if ('.' == yyC) {
yyIndex = yyRepetition1 + 1;
yyRepetition1 = yyIndex;
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;
continue;
}
default:
/* No match. */
}
}
break;
}
yyResult = pBinaryExponent(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case 'F':
case 'L':
case 'f':
case 'l':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
}
// Nested alternative 2.
yyC = character(yyChoice1);
if ('.' == yyC) {
yyIndex = yyChoice1 + 1;
yyRepetition1 = yyIndex;
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) {
yyResult = pBinaryExponent(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case 'F':
case 'L':
case 'f':
case 'l':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
}
// Nested alternative 3.
yyRepetition1 = yyChoice1;
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) {
yyResult = pBinaryExponent(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyOption1 = yyResult.index;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case 'F':
case 'L':
case 'f':
case 'l':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyValue = difference(yyStart, yyOption1);
return new SemanticValue(yyValue, yyOption1, yyError);
}
}
}
// Done.
yyError = yyError.select("hex floating constant expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.Exponent.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExponent(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk3) yyColumn.chunk3 = new Chunk3();
if (null == yyColumn.chunk3.fExponent)
yyColumn.chunk3.fExponent = pExponent$1(yyStart);
return yyColumn.chunk3.fExponent;
}
/** Actually parse xtc.lang.CConstant.Exponent. */
private Result pExponent$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyOption1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case 'E':
case 'e':
{
yyOption1 = yyIndex;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case '+':
case '-':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyResult = p$$Shared2(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("exponent expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.$$Shared2.
* This nonterminal represents the duplicate productions
* xtc.lang.CFactory.Exponent$$Plus1
* and xtc.lang.CFactory.BinaryExponent$$Plus1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result p$$Shared2(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.f$$Shared2)
yyColumn.chunk4.f$$Shared2 = p$$Shared2$1(yyStart);
return yyColumn.chunk4.f$$Shared2;
}
/** Actually parse xtc.lang.CFactory.$$Shared2. */
private Result p$$Shared2$1(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 '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyResult = p$$Shared2(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select(" expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.BinaryExponent.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pBinaryExponent(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fBinaryExponent)
yyColumn.chunk4.fBinaryExponent = pBinaryExponent$1(yyStart);
return yyColumn.chunk4.fBinaryExponent;
}
/** Actually parse xtc.lang.CConstant.BinaryExponent. */
private Result pBinaryExponent$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyOption1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case 'P':
case 'p':
{
yyOption1 = yyIndex;
yyC = character(yyOption1);
if (-1 != yyC) {
yyIndex = yyOption1 + 1;
switch (yyC) {
case '+':
case '-':
{
yyOption1 = yyIndex;
}
break;
default:
/* No match. */
}
}
yyResult = p$$Shared2(yyOption1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("binary exponent expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.CharacterConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCharacterConstant(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pWideCharacterLiteral(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("CharacterConstant", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pCharacterLiteral(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$2 = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = GNode.create("CharacterConstant", v$g$2);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.WideCharacterLiteral.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWideCharacterLiteral(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('L' == yyC) {
yyIndex = yyStart + 1;
yyResult = pCharacterLiteral(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = difference(yyStart, yyResult.index);
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("wide character literal expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.CharacterLiteral.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCharacterLiteral(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fCharacterLiteral)
yyColumn.chunk4.fCharacterLiteral = pCharacterLiteral$1(yyStart);
return yyColumn.chunk4.fCharacterLiteral;
}
/** Actually parse xtc.lang.CConstant.CharacterLiteral. */
private Result pCharacterLiteral$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('\'' == yyC) {
yyIndex = yyStart + 1;
yyResult = pCharacterContents(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyC = character(yyResult.index);
if ('\'' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = difference(yyStart, yyIndex);
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Done.
yyError = yyError.select("character literal expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.CharacterContents.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCharacterContents(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
boolean yyRepeated1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
yyRepeated1 = false;
while (true) {
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\\':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyResult = pEscapeCode(yyChoice2);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
// Nested alternative 2.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case 'u':
{
yyResult = pHexQuad(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
}
break;
case 'U':
{
yyResult = pHexQuad(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyResult = pHexQuad(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
}
}
break;
default:
/* No match. */
}
}
}
break;
default:
/* No match. */
}
}
// Nested alternative 2.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\n':
case '\r':
case '\'':
case '\\':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
yyRepeated1 = true;
continue;
}
}
}
break;
}
if (yyRepeated1) {
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// Done.
yyError = yyError.select("character contents expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.StringConstant.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStringConstant(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fStringConstant)
yyColumn.chunk4.fStringConstant = pStringConstant$1(yyStart);
return yyColumn.chunk4.fStringConstant;
}
/** Actually parse xtc.lang.CConstant.StringConstant. */
private Result pStringConstant$1(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pStringConstant$$Plus1(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<String> v$g$1 = yyResult.semanticValue();
yyValue = GNode.createFromPair("StringConstant", v$g$1);
yyValue.setLocation(location(yyStart));
return yyResult.createValue(yyValue, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.StringConstant$$Choice1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStringConstant$$Choice1(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pWideStringLiteral(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Alternative 2.
yyResult = pStringLiteral(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse synthetic nonterminal xtc.lang.CFactory.StringConstant$$Plus1.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStringConstant$$Plus1(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fStringConstant$$Plus1)
yyColumn.chunk4.fStringConstant$$Plus1 = pStringConstant$$Plus1$1(yyStart);
return yyColumn.chunk4.fStringConstant$$Plus1;
}
/** Actually parse xtc.lang.CFactory.StringConstant$$Plus1. */
private Result pStringConstant$$Plus1$1(final int yyStart)
throws IOException {
Result yyResult;
Pair<String> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pStringConstant$$Choice1(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$el$1 = yyResult.semanticValue();
final int yyChoice1 = yyResult.index;
// Nested alternative 1.
yyResult = pStringConstant$$Plus1(yyChoice1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final Pair<String> v$4 = yyResult.semanticValue();
yyValue = new Pair<String>(v$el$1, v$4);
return yyResult.createValue(yyValue, yyError);
}
// Nested alternative 2.
yyValue = new Pair<String>(v$el$1);
return new SemanticValue(yyValue, yyChoice1, yyError);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.WideStringLiteral.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pWideStringLiteral(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('L' == yyC) {
yyIndex = yyStart + 1;
yyResult = pStringLiteral(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = difference(yyStart, yyResult.index);
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("wide string literal expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.StringLiteral.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStringLiteral(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fStringLiteral)
yyColumn.chunk4.fStringLiteral = pStringLiteral$1(yyStart);
return yyColumn.chunk4.fStringLiteral;
}
/** Actually parse xtc.lang.CConstant.StringLiteral. */
private Result pStringLiteral$1(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('\"' == yyC) {
yyIndex = yyStart + 1;
yyResult = pStringContents(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyC = character(yyResult.index);
if ('\"' == yyC) {
yyIndex = yyResult.index + 1;
yyValue = difference(yyStart, yyIndex);
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
// Done.
yyError = yyError.select("string literal expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.StringContents.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pStringContents(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
int yyRepetition1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\\':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyResult = pEscapeCode(yyChoice2);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
// Nested alternative 2.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case 'u':
{
yyResult = pHexQuad(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
break;
case 'U':
{
yyResult = pHexQuad(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyResult = pHexQuad(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
}
break;
default:
/* No match. */
}
}
}
break;
default:
/* No match. */
}
}
// Nested alternative 2.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\n':
case '\r':
case '\"':
case '\\':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
continue;
}
}
}
break;
}
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.EscapeCode.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEscapeCode(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
boolean yyRepeated1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if (-1 != yyC) {
yyIndex = yyStart + 1;
switch (yyC) {
case '\"':
case '\'':
case '?':
case '\\':
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
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':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
{
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.
yyValue = null;
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case 'x':
{
yyRepetition1 = yyIndex;
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 = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("escape code expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CConstant.HexQuad.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pHexQuad(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 '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':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 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':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 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':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 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':
{
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
}
break;
default:
/* No match. */
}
}
}
break;
default:
/* No match. */
}
}
}
break;
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("hex quad expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CIdentifier.Identifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCIdentifier$Identifier(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fCIdentifier$Identifier)
yyColumn.chunk4.fCIdentifier$Identifier = pCIdentifier$Identifier$1(yyStart);
return yyColumn.chunk4.fCIdentifier$Identifier;
}
/** Actually parse xtc.lang.CIdentifier.Identifier. */
private Result pCIdentifier$Identifier$1(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$Word(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (! contains(C_KEYWORDS, toText(yyValue))) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("identifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CIdentifier.Keyword.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pKeyword(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fKeyword)
yyColumn.chunk4.fKeyword = pKeyword$1(yyStart);
return yyColumn.chunk4.fKeyword;
}
/** Actually parse xtc.lang.CIdentifier.Keyword. */
private Result pKeyword$1(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$Word(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (contains(C_KEYWORDS, toText(yyValue))) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("keyword expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CIdentifier.Word.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCIdentifier$Word(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fCIdentifier$Word)
yyColumn.chunk4.fCIdentifier$Word = pCIdentifier$Word$1(yyStart);
return yyColumn.chunk4.fCIdentifier$Word;
}
/** Actually parse xtc.lang.CIdentifier.Word. */
private Result pCIdentifier$Word$1(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pCIdentifier$WordCharacters(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CIdentifier.WordCharacters.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pCIdentifier$WordCharacters(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')) ||
('_' == yyC) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyRepetition1 = yyIndex;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
if ((('0' <= yyC) && (yyC <= '9')) ||
(('A' <= yyC) && (yyC <= 'Z')) ||
('_' == yyC) ||
(('a' <= yyC) && (yyC <= 'z'))) {
yyRepetition1 = yyIndex;
continue;
}
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
}
// Done.
yyError = yyError.select("word characters expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSymbol.Symbol.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSymbol(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk4) yyColumn.chunk4 = new Chunk4();
if (null == yyColumn.chunk4.fSymbol)
yyColumn.chunk4.fSymbol = pSymbol$1(yyStart);
return yyColumn.chunk4.fSymbol;
}
/** Actually parse xtc.lang.CSymbol.Symbol. */
private Result pSymbol$1(final int yyStart) throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbolCharacters(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSymbol.SymbolCharacters.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSymbolCharacters(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 '>':
{
final int yyChoice1 = yyIndex;
// 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;
if ('=' == yyC) {
yyValue = ">>=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = ">>";
return new SemanticValue(yyValue, yyChoice2, yyError);
}
case '=':
{
yyValue = ">=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = ">";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '<':
{
final int yyChoice1 = yyIndex;
// 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;
if ('=' == yyC) {
yyValue = "<<=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "<<";
return new SemanticValue(yyValue, yyChoice2, yyError);
}
case '=':
{
yyValue = "<=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = "<";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '.':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('.' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('.' == yyC) {
yyValue = "...";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
// Nested alternative 2.
yyValue = ".";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '+':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '=':
{
yyValue = "+=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '+':
{
yyValue = "++";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = "+";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '-':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '=':
{
yyValue = "-=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '-':
{
yyValue = "--";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '>':
{
yyValue = "->";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = "-";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '*':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('=' == yyC) {
yyValue = "*=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "*";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '/':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('=' == yyC) {
yyValue = "/=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "/";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '%':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('=' == yyC) {
yyValue = "%=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "%";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '&':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '=':
{
yyValue = "&=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '&':
{
yyValue = "&&";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = "&";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '^':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('=' == yyC) {
yyValue = "^=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "^";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '|':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '=':
{
yyValue = "|=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
case '|':
{
yyValue = "||";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Nested alternative 2.
yyValue = "|";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '=':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('=' == yyC) {
yyValue = "==";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "=";
return new SemanticValue(yyValue, yyChoice1, yyError);
}
case '!':
{
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
if ('=' == yyC) {
yyValue = "!=";
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
// Nested alternative 2.
yyValue = "!";
return new SemanticValue(yyValue, yyChoice1, 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 '(':
{
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 '?':
{
yyValue = "?";
return new SemanticValue(yyValue, yyIndex, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("symbol characters expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.Spacing.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSpacing(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
boolean yyPredMatched;
int yyBase;
int yyRepetition1;
int yyRepetition2;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case ' ':
{
yyRepetition1 = yyIndex;
continue;
}
case '\t':
{
yyRepetition1 = yyIndex;
continue;
}
case '\f':
{
yyRepetition1 = yyIndex;
continue;
}
case '/':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
switch (yyC) {
case '*':
{
yyRepetition2 = yyIndex;
while (true) {
final int yyChoice2 = yyRepetition2;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case '*':
{
yyPredMatched = false;
yyC = character(yyIndex);
if ('/' == yyC) {
yyPredMatched = true;
}
if (! yyPredMatched) {
yyRepetition2 = yyIndex;
continue;
} else {
yyError = yyError.select("spacing expected", yyStart);
}
}
break;
default:
{
yyRepetition2 = yyIndex;
continue;
}
}
}
break;
}
yyBase = yyRepetition2;
yyC = character(yyBase);
if ('*' == yyC) {
yyIndex = yyRepetition2 + 1;
yyC = character(yyIndex);
if ('/' == yyC) {
yyIndex = yyIndex + 1;
yyRepetition1 = yyIndex;
continue;
} else {
yyError = yyError.select("'*/' expected", yyBase);
}
} else {
yyError = yyError.select("'*/' expected", yyBase);
}
}
break;
case '/':
{
yyRepetition2 = yyIndex;
while (true) {
yyC = character(yyRepetition2);
if (-1 != yyC) {
yyIndex = yyRepetition2 + 1;
switch (yyC) {
case '\n':
case '\r':
/* No match. */
break;
default:
{
yyRepetition2 = yyIndex;
continue;
}
}
}
break;
}
yyPredResult = pLineTerminator(yyRepetition2);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyRepetition1 = yyRepetition2;
continue;
}
}
break;
default:
/* No match. */
}
}
}
break;
case '\r':
{
final int yyChoice2 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice2);
if ('\n' == yyC) {
yyIndex = yyChoice2 + 1;
yyResult = pDirective(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
// Nested alternative 2.
yyResult = pDirective(yyChoice2);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
break;
case '\n':
{
yyResult = pDirective(yyIndex);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
}
break;
default:
/* No match. */
}
}
break;
}
yyValue = null;
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.Space.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pSpace(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("space expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.LineTerminator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLineTerminator(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 ('\n' == yyC) {
yyIndex = yyChoice1 + 1;
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);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("line terminator expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.EndOfFile.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEndOfFile(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("end of file expected", yyStart);
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.Directive.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pDirective(final int yyStart) throws IOException {
int yyC;
int yyIndex;
Result yyResult;
Result yyPredResult;
int yyBase;
int yyRepetition1;
boolean yyRepeated1;
int yyOption1;
String yyOpValue1;
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyC = character(yyStart);
if ('#' == yyC) {
yyIndex = yyStart + 1;
final int yyChoice1 = yyIndex;
// Nested alternative 1.
yyC = character(yyChoice1);
if (' ' == yyC) {
yyIndex = yyChoice1 + 1;
yyResult = pLineNumber(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String line = yyResult.semanticValue();
yyC = character(yyResult.index);
if (' ' == yyC) {
yyIndex = yyResult.index + 1;
yyC = character(yyIndex);
if ('\"' == yyC) {
yyIndex = yyIndex + 1;
yyResult = pFileName(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String file = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\"' == yyC) {
yyIndex = yyResult.index + 1;
yyOption1 = yyIndex;
yyOpValue1 = null;
yyBase = yyOption1;
yyC = character(yyBase);
if (' ' == yyC) {
yyIndex = yyOption1 + 1;
yyC = character(yyIndex);
if ('1' == yyC) {
yyIndex = yyIndex + 1;
final String v$el$1 = " 1";
yyOption1 = yyIndex;
yyOpValue1 = v$el$1;
} else {
yyError = yyError.select("' 1' expected", yyBase);
}
} else {
yyError = yyError.select("' 1' expected", yyBase);
}
{ // Start scope for f1.
final String f1 = yyOpValue1;
yyOpValue1 = null;
yyBase = yyOption1;
yyC = character(yyBase);
if (' ' == yyC) {
yyIndex = yyOption1 + 1;
yyC = character(yyIndex);
if ('2' == yyC) {
yyIndex = yyIndex + 1;
final String v$el$2 = " 2";
yyOption1 = yyIndex;
yyOpValue1 = v$el$2;
} else {
yyError = yyError.select("' 2' expected", yyBase);
}
} else {
yyError = yyError.select("' 2' expected", yyBase);
}
{ // Start scope for f2.
final String f2 = yyOpValue1;
yyOpValue1 = null;
yyBase = yyOption1;
yyC = character(yyBase);
if (' ' == yyC) {
yyIndex = yyOption1 + 1;
yyC = character(yyIndex);
if ('3' == yyC) {
yyIndex = yyIndex + 1;
final String v$el$3 = " 3";
yyOption1 = yyIndex;
yyOpValue1 = v$el$3;
} else {
yyError = yyError.select("' 3' expected", yyBase);
}
} else {
yyError = yyError.select("' 3' expected", yyBase);
}
{ // Start scope for f3.
final String f3 = yyOpValue1;
yyOpValue1 = null;
yyBase = yyOption1;
yyC = character(yyBase);
if (' ' == yyC) {
yyIndex = yyOption1 + 1;
yyC = character(yyIndex);
if ('4' == yyC) {
yyIndex = yyIndex + 1;
final String v$el$4 = " 4";
yyOption1 = yyIndex;
yyOpValue1 = v$el$4;
} else {
yyError = yyError.select("' 4' expected", yyBase);
}
} else {
yyError = yyError.select("' 4' expected", yyBase);
}
{ // Start scope for f4.
final String f4 = yyOpValue1;
yyPredResult = pLineTerminator(yyOption1);
yyError = yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
final int lineNo = Integer.parseInt(line);
if (RELOCATE) setLocation(yyStart, file, lineNo-1, FIRST_COLUMN);
yyState.lineMarker(file, lineNo, f1, f2, f3, f4, location(yyStart));
yyValue = null;
return new SemanticValue(yyValue, yyOption1, yyError);
}
} // End scope for f4.
} // End scope for f3.
} // End scope for f2.
} // End scope for f1.
}
}
}
}
}
}
// Nested alternative 2.
yyRepetition1 = yyChoice1;
while (true) {
yyResult = pSpace(yyRepetition1);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
continue;
}
break;
}
{ // Start scope for nested choice.
final int yyChoice2 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice2);
if (-1 != yyC) {
yyIndex = yyChoice2 + 1;
switch (yyC) {
case 'p':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('r' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('a' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('g' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('m' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('a' == yyC) {
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if (' ' == yyC) {
yyResult = pPragma(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String pragma = yyResult.semanticValue();
yyPredResult =
pLineTerminator(yyResult.index);
yyError =
yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyState.pragma(pragma, location(yyStart));
yyValue = null;
return yyResult.createValue(yyValue, yyError);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
break;
case 'i':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
if ('d' == yyC) {
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) {
yyRepetition1 = yyIndex;
yyRepeated1 = false;
while (true) {
yyResult = pSpace(yyRepetition1);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyRepetition1 = yyResult.index;
yyRepeated1 = true;
continue;
}
break;
}
if (yyRepeated1) {
yyC = character(yyRepetition1);
if ('\"' == yyC) {
yyIndex = yyRepetition1 + 1;
yyResult = pFileName(yyIndex);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String s = yyResult.semanticValue();
yyC = character(yyResult.index);
if ('\"' == yyC) {
yyIndex = yyResult.index + 1;
yyPredResult = pLineTerminator(yyIndex);
yyError =
yyPredResult.select(yyError);
if (yyPredResult.hasValue()) {
yyState.ident(s, location(yyStart));
yyValue = null;
return new SemanticValue(yyValue, yyIndex, yyError);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
break;
default:
/* No match. */
}
}
} // End scope for nested choice.
}
// Alternative 2.
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.LineNumber.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pLineNumber(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;
switch (yyC) {
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
yyRepetition1 = yyIndex;
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 = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
default:
/* No match. */
}
}
// Done.
yyError = yyError.select("line number expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.FileName.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pFileName(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
final int yyChoice1 = yyRepetition1;
// Nested alternative 1.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\\':
{
yyC = character(yyIndex);
if (-1 != yyC) {
yyIndex = yyIndex + 1;
yyRepetition1 = yyIndex;
continue;
}
}
break;
default:
/* No match. */
}
}
// Nested alternative 2.
yyC = character(yyChoice1);
if (-1 != yyC) {
yyIndex = yyChoice1 + 1;
switch (yyC) {
case '\"':
case '\\':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
continue;
}
}
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CSpacing.Pragma.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPragma(final int yyStart) throws IOException {
int yyC;
int yyIndex;
int yyRepetition1;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyRepetition1 = yyStart;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
switch (yyC) {
case '\n':
case '\r':
/* No match. */
break;
default:
{
yyRepetition1 = yyIndex;
continue;
}
}
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.TypedefContext.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypedefContext(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.typedef();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.ParameterContext.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pParameterContext(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.parameters();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.FunctionDeclaratorContext.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pFunctionDeclaratorContext(final int yyStart)
throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.functionDeclarator();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.TypeSpecContext.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pTypeSpecContext(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.typeSpecifier();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.PushScope.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPushScope(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.pushScope();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.PopScope.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pPopScope(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.popScope();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.EnterStructure.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pEnterStructure(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.enterStructure();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.CContext.ExitStructure.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pExitStructure(final int yyStart) throws IOException {
Void yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyState.exitStructure();
yyValue = null;
return new SemanticValue(yyValue, yyStart, yyError);
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.JavaIdentifier.QualifiedIdentifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pQualifiedIdentifier(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
Pair<String> yyRepValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$Identifier(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
final String v$g$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = Pair.empty();
while (true) {
yyBase = yyRepetition1;
yyResult = pSymbol(yyBase);
if (yyResult.hasValue(".")) {
yyResult = pJavaIdentifier$Identifier(yyResult.index);
yyError = yyResult.select(yyError, yyRepetition1);
if (yyResult.hasValue()) {
final String v$el$1 = yyResult.semanticValue();
yyRepetition1 = yyResult.index;
yyRepValue1 = new Pair<String>(v$el$1, yyRepValue1);
continue;
}
} else {
yyError = yyError.select("'.' expected", yyBase);
}
break;
}
{ // Start scope for v$g$2.
final Pair<String> v$g$2 = yyRepValue1.reverse();
yyValue = GNode.createFromPair("QualifiedIdentifier", v$g$1, v$g$2);
yyValue.setLocation(location(yyStart));
return new SemanticValue(yyValue, yyRepetition1, yyError);
} // End scope for v$g$2.
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.JavaIdentifier.Identifier.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pJavaIdentifier$Identifier(final int yyStart)
throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk5) yyColumn.chunk5 = new Chunk5();
if (null == yyColumn.chunk5.fJavaIdentifier$Identifier)
yyColumn.chunk5.fJavaIdentifier$Identifier = pJavaIdentifier$Identifier$1(yyStart);
return yyColumn.chunk5.fJavaIdentifier$Identifier;
}
/** Actually parse xtc.lang.JavaIdentifier.Identifier. */
private Result pJavaIdentifier$Identifier$1(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$Word(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
if (! contains(JAVA_KEYWORDS, toText(yyValue))) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
yyError = yyError.select("identifier expected", yyStart);
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.JavaIdentifier.Word.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pJavaIdentifier$Word(final int yyStart) throws IOException {
CFactoryParserColumn yyColumn = (CFactoryParserColumn)column(yyStart);
if (null == yyColumn.chunk5) yyColumn.chunk5 = new Chunk5();
if (null == yyColumn.chunk5.fJavaIdentifier$Word)
yyColumn.chunk5.fJavaIdentifier$Word = pJavaIdentifier$Word$1(yyStart);
return yyColumn.chunk5.fJavaIdentifier$Word;
}
/** Actually parse xtc.lang.JavaIdentifier.Word. */
private Result pJavaIdentifier$Word$1(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pJavaIdentifier$WordCharacters(yyStart);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
yyValue = yyResult.semanticValue();
yyResult = pSpacing(yyResult.index);
yyError = yyResult.select(yyError);
if (yyResult.hasValue()) {
return yyResult.createValue(yyValue, yyError);
}
}
// Done.
return yyError;
}
// =========================================================================
/**
* Parse nonterminal xtc.lang.JavaIdentifier.WordCharacters.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/
private Result pJavaIdentifier$WordCharacters(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;
final char start = (char)yyC;
if (Character.isJavaIdentifierStart(start)) {
yyRepetition1 = yyIndex;
while (true) {
yyC = character(yyRepetition1);
if (-1 != yyC) {
yyIndex = yyRepetition1 + 1;
final char part = (char)yyC;
if (Character.isJavaIdentifierPart(part)) {
yyRepetition1 = yyIndex;
continue;
}
}
break;
}
yyValue = difference(yyStart, yyRepetition1);
return new SemanticValue(yyValue, yyRepetition1, yyError);
}
}
// Done.
yyError = yyError.select("word characters expected", yyStart);
return yyError;
}
// =========================================================================
static {
add(JAVA_KEYWORDS, new String[] {
"abstract", "continue", "for", "new", "switch",
"assert", "default", "if", "package", "synchronized",
"boolean", "do", "goto", "private", "this",
"break", "double", "implements", "protected", "throw",
"byte", "else", "import", "public", "throws",
"case", "instanceof", "return", "transient",
"catch", "extends", "int", "short", "try",
"char", "final", "interface", "static", "void",
"class", "finally", "long", "strictfp", "volatile",
"const", "float", "native", "super", "while"
});
}
static {
add(C_KEYWORDS, new String[] {
"auto", "break", "case", "char",
"const", "continue", "default", "do",
"double", "else", "enum", "extern",
"float", "for", "goto", "if",
"int", "long", "register", "return",
"short", "signed", "sizeof", "static",
"struct", "switch", "typedef", "union",
"unsigned", "void", "volatile", "while"
});
if (C99) add(C_KEYWORDS, new String[] {
"_Bool", "_Complex", "inline",
"restrict"
});
if (GCC) add(C_KEYWORDS, new String[] {
"__alignof", "__alignof__",
"asm", "__asm", "__asm__",
"__attribute", "__attribute__",
"__builtin_offsetof",
"__builtin_types_compatible_p",
"__builtin_va_arg", "__builtin_va_list",
"__complex__",
"__const", "__const__",
"__extension__",
"__inline", "__inline__",
"__label__",
"__restrict", "__restrict__",
"__signed", "__signed__",
"__thread",
"typeof", "__typeof", "__typeof__",
"__volatile", "__volatile__"
});
}
// =========================================================================
/**
* Get the specified text.
*
* @param s The text.
* @return The text.
*/
protected static final String toText(String s) {
return s;
}
// =========================================================================
/**
* Add the specified values to the specified set.
*
* @param set The set.
* @param values The new values.
*/
protected static final <T> void add(Set<T> set, T[] values) {
for (T v : values) set.add(v);
}
/**
* Check whether the specified set contains the specified value.
*
* @param set The set.
* @param value The value.
* @return <code>true</code> if the set contains the value.
*/
protected static final <T> boolean contains(Set<T> set, T value) {
return set.contains(value);
}
}