コード例 #1
0
        //throws RecognitionException, TokenStreamException
        public void anonymousTemplate()
        {
            returnAST = null;
            ASTPair currentAST = ASTPair.GetInstance();
            antlr.stringtemplate.language.StringTemplateAST anonymousTemplate_AST = null;
            IToken  t = null;
            antlr.stringtemplate.language.StringTemplateAST t_AST = null;

            try {      // for error handling
            t = LT(1);
            t_AST = (antlr.stringtemplate.language.StringTemplateAST) astFactory.create(t);
            astFactory.addASTChild(currentAST, (AST)t_AST);
            match(ANONYMOUS_TEMPLATE);
            if (0==inputState.guessing)
            {

                StringTemplate anonymous = new StringTemplate();
                anonymous.setGroup(self.getGroup());
                anonymous.setEnclosingInstance(self);
                anonymous.setTemplate(t.getText());
                t_AST.setStringTemplate(anonymous);

            }
            anonymousTemplate_AST = (antlr.stringtemplate.language.StringTemplateAST)currentAST.root;
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_3_);
            }
            else
            {
                throw ex;
            }
            }
            returnAST = anonymousTemplate_AST;
            ASTPair.PutInstance(currentAST);
        }