public final ANTLRv3TreeFilter.atom_return atom() throws RecognitionException {
        ANTLRv3TreeFilter.atom_return retval = new ANTLRv3TreeFilter.atom_return();
        retval.start = input.LT(1);

        CommonTree RULE_REF9=null;
        CommonTree RULE_REF10=null;
        ANTLRv3TreeFilter.terminal_return terminal11 = null;


        try {
            // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:261:3: ( ^( ( '^' | '!' ) atom ) -> {%{\"[>^!atom<]\"}} | range -> {%{\"[>range<]\"}} | notSet -> {%{\"[>notset<]\"}} | ^( RULE_REF ARG_ACTION ) -> ref(id=$RULE_REF) | RULE_REF -> ref(id=$RULE_REF) | terminal -> {$terminal.st})
            int alt35=6;
            switch ( input.LA(1) ) {
            case ROOT:
            case BANG:
                {
                alt35=1;
                }
                break;
            case CHAR_RANGE:
                {
                alt35=2;
                }
                break;
            case 89:
                {
                alt35=3;
                }
                break;
            case RULE_REF:
                {
                int LA35_4 = input.LA(2);

                if ( (LA35_4==DOWN) ) {
                    alt35=4;
                }
                else if ( (LA35_4==UP||(LA35_4>=BLOCK && LA35_4<=SYNPRED)||LA35_4==CHAR_RANGE||LA35_4==EOA||(LA35_4>=SEMPRED && LA35_4<=SYN_SEMPRED)||(LA35_4>=TREE_BEGIN && LA35_4<=BANG)||(LA35_4>=TOKEN_REF && LA35_4<=ACTION)||LA35_4==RULE_REF||LA35_4==71||LA35_4==87||LA35_4==89||LA35_4==92) ) {
                    alt35=5;
                }
                else {
                    NoViableAltException nvae =
                        new NoViableAltException("", 35, 4, input);

                    throw nvae;
                }
                }
                break;
            case TOKEN_REF:
            case STRING_LITERAL:
            case CHAR_LITERAL:
            case 92:
                {
                alt35=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 35, 0, input);

                throw nvae;
            }

            switch (alt35) {
                case 1 :
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:261:5: ^( ( '^' | '!' ) atom )
                    {
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:261:7: ( '^' | '!' )
                    int alt34=2;
                    int LA34_0 = input.LA(1);

                    if ( (LA34_0==ROOT) ) {
                        alt34=1;
                    }
                    else if ( (LA34_0==BANG) ) {
                        alt34=2;
                    }
                    else {
                        NoViableAltException nvae =
                            new NoViableAltException("", 34, 0, input);

                        throw nvae;
                    }
                    switch (alt34) {
                        case 1 :
                            // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:261:8: '^'
                            {
                            match(input,ROOT,FOLLOW_ROOT_in_atom1323); 

                            }
                            break;
                        case 2 :
                            // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:261:12: '!'
                            {
                            match(input,BANG,FOLLOW_BANG_in_atom1325); 

                            }
                            break;

                    }


                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_atom_in_atom1328);
                    atom();

                    state._fsp--;


                    match(input, Token.UP, null); 


                    // TEMPLATE REWRITE
                    // 263:5: -> {%{\"[>^!atom<]\"}}
                    {
                        retval.st = new StringTemplate(templateLib,"[>^!atom<]");
                    }


                    }
                    break;
                case 2 :
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:265:4: range
                    {
                    pushFollow(FOLLOW_range_in_atom1344);
                    range();

                    state._fsp--;



                    // TEMPLATE REWRITE
                    // 267:5: -> {%{\"[>range<]\"}}
                    {
                        retval.st = new StringTemplate(templateLib,"[>range<]");
                    }


                    }
                    break;
                case 3 :
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:269:4: notSet
                    {
                    pushFollow(FOLLOW_notSet_in_atom1359);
                    notSet();

                    state._fsp--;



                    // TEMPLATE REWRITE
                    // 271:5: -> {%{\"[>notset<]\"}}
                    {
                        retval.st = new StringTemplate(templateLib,"[>notset<]");
                    }


                    }
                    break;
                case 4 :
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:273:5: ^( RULE_REF ARG_ACTION )
                    {
                    RULE_REF9=(CommonTree)match(input,RULE_REF,FOLLOW_RULE_REF_in_atom1376); 

                    match(input, Token.DOWN, null); 
                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_atom1378); 

                    match(input, Token.UP, null); 


                    // TEMPLATE REWRITE
                    // 275:5: -> ref(id=$RULE_REF)
                    {
                        retval.st = templateLib.getInstanceOf("ref",
                      new STAttrMap().put("id", RULE_REF9));
                    }


                    }
                    break;
                case 5 :
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:279:5: RULE_REF
                    {
                    RULE_REF10=(CommonTree)match(input,RULE_REF,FOLLOW_RULE_REF_in_atom1415); 


                    // TEMPLATE REWRITE
                    // 281:5: -> ref(id=$RULE_REF)
                    {
                        retval.st = templateLib.getInstanceOf("ref",
                      new STAttrMap().put("id", RULE_REF10));
                    }


                    }
                    break;
                case 6 :
                    // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:285:5: terminal
                    {
                    pushFollow(FOLLOW_terminal_in_atom1451);
                    terminal11=terminal();

                    state._fsp--;



                    // TEMPLATE REWRITE
                    // 287:5: -> {$terminal.st}
                    {
                        retval.st = (terminal11!=null?terminal11.st:null);
                    }


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }