{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
match(LITERAL_class);
sub = LT(1);
match(ID);
match(LITERAL_extends);
sup = LT(1);
match(ID);
{
switch ( LA(1)) {
case SUBRULE_BLOCK:
{
sc=superClass();
break;
}
case SEMI:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
match(SEMI);
gr = (Grammar)hier.getGrammar(sub.getText());
if ( gr!=null ) {
// antlr.Tool.toolError("redefinition of grammar "+gr.getName()+" ignored");
gr=null;
throw new SemanticException("redefinition of grammar "+sub.getText(), file, sub.getLine(), sub.getColumn());
}
else {
gr = new Grammar(hier.getTool(), sub.getText(), sup.getText(), rules);
gr.superClass=sc;
if ( preamble!=null ) {
gr.setPreambleAction(preamble.getText());
}
}
{
switch ( LA(1)) {
case OPTIONS_START:
{
classOptions=optionSpec(gr);
break;
}
case ACTION:
case ID:
case TOKENS_SPEC:
case LITERAL_protected:
case LITERAL_private:
case LITERAL_public:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( gr!=null ) {
gr.setOptions(classOptions);
}
{
switch ( LA(1)) {
case TOKENS_SPEC:
{
tk = LT(1);
match(TOKENS_SPEC);
gr.setTokenSection(tk.getText());
break;
}
case ACTION:
case ID:
case LITERAL_protected:
case LITERAL_private:
case LITERAL_public:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
{
switch ( LA(1)) {
case ACTION:
{
memberA = LT(1);
match(ACTION);
gr.setMemberAction(memberA.getText());
break;
}
case ID:
case LITERAL_protected:
case LITERAL_private:
case LITERAL_public:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
{
int _cnt277=0;
_loop277:
do {
if ((_tokenSet_2.member(LA(1)))) {
rule(gr);
}
else {
if ( _cnt277>=1 ) { break _loop277; } else {throw new NoViableAltException(LT(1), getFilename());}
}
_cnt277++;
} while (true);
}