예제 #1
0
        //throws RecognitionException, TokenStreamException
        public void group(
            StringTemplateGroup g
            )
        {
            IToken  name = null;
            IToken  s = null;
            IToken  i = null;
            IToken  i2 = null;

            this._group = g;

            try {      // for error handling
            match(LITERAL_group);
            name = LT(1);
            match(ID);
            g.Name = name.getText();
            {
                switch ( LA(1) )
                {
                case COLON:
                {
                    match(COLON);
                    s = LT(1);
                    match(ID);
                    g.SetSuperGroup(s.getText());
                    break;
                }
                case LITERAL_implements:
                case SEMI:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
                {
                case LITERAL_implements:
                {
                    match(LITERAL_implements);
                    i = LT(1);
                    match(ID);
                    g.ImplementInterface(i.getText());
                    {    // ( ... )*
                        for (;;)
                        {
                            if ((LA(1)==COMMA))
                            {
                                match(COMMA);
                                i2 = LT(1);
                                match(ID);
                                g.ImplementInterface(i2.getText());
                            }
                            else
                            {
                                goto _loop5_breakloop;
                            }

                        }
            _loop5_breakloop:						;
                    }    // ( ... )*
                    break;
                }
                case SEMI:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            match(SEMI);
            { // ( ... )+
                int _cnt7=0;
                for (;;)
                {
                    if ((LA(1)==ID||LA(1)==AT) && (LA(2)==ID||LA(2)==LPAREN||LA(2)==DEFINED_TO_BE) && (LA(3)==ID||LA(3)==DOT||LA(3)==RPAREN))
                    {
                        template(g);
                    }
                    else if ((LA(1)==ID) && (LA(2)==DEFINED_TO_BE) && (LA(3)==LBRACK)) {
                        mapdef(g);
                    }
                    else
                    {
                        if (_cnt7 >= 1) { goto _loop7_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
                    }

                    _cnt7++;
                }
            _loop7_breakloop:				;
            }    // ( ... )+
            }
            catch (RecognitionException ex)
            {
            reportError(ex);
            recover(ex,tokenSet_0_);
            }
        }