Exemplo n.º 1
0
        //throws RecognitionException, TokenStreamException
        public void anonymousTemplate()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            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(ref currentAST, (AST)t_AST);
            match(ANONYMOUS_TEMPLATE);
            if (0==inputState.guessing)
            {

                StringTemplate anonymous = new StringTemplate();
                anonymous.Group = self.Group;
                anonymous.EnclosingInstance = self;
                anonymous.Template = t.getText();
                anonymous.DefineFormalArguments(((StringTemplateToken)t).args);
                t_AST.StringTemplate = anonymous;

            }
            anonymousTemplate_AST = (Antlr.StringTemplate.Language.StringTemplateAST)currentAST.root;
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_5_);
            }
            else
            {
                throw ex;
            }
            }
            returnAST = anonymousTemplate_AST;
        }