Package org.apache.velocity.runtime.parser

Examples of org.apache.velocity.runtime.parser.Parser


                getLog().error("Could not auto-initialize Velocity", e);
                throw new IllegalStateException("Velocity could not be initialized!");
            }
        }

        Parser parser = new Parser(this);
        parser.setDirectives(runtimeDirectives);
        return parser;
    }
View Full Code Here


                throw new IllegalStateException("Velocity could not be initialized!");
            }
        }

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();

        if (parser == null) {
            /*
             *  if we couldn't get a parser from the pool
             *  make one and log it.
             */

            if (log.isInfoEnabled()) {
                log.info("Runtime : ran out of parsers. Creating a new one. "
                    + " Please increment the parser.pool.size property."
                    + " The current value is too small.");
            }

            parser = createNewParser();

        }

        /*
         *  now, if we have a parser
         */

        if (parser != null) {
            try {
                /*
                 *  dump namespace if we are told to.  Generally, you want to
                 *  do this - you don't in special circumstances, such as
                 *  when a VM is getting init()-ed & parsed
                 */

                if (dumpNamespace) {
                    dumpVMNamespace(templateName);
                }

                ast = parser.parse(reader, templateName);
            }
            finally {
                /*
                 *  put it back
                 */
 
View Full Code Here

                getLog().error("Could not auto-initialize Velocity", e);
                throw new IllegalStateException("Velocity could not be initialized!");
            }
        }

        Parser parser = new Parser(this);
        parser.setDirectives(runtimeDirectives);
        return parser;
    }
View Full Code Here

                throw new IllegalStateException("Velocity could not be initialized!");
            }
        }

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();

        if (parser == null) {
            /*
             *  if we couldn't get a parser from the pool
             *  make one and log it.
             */

            if (log.isInfoEnabled()) {
                log.info("Runtime : ran out of parsers. Creating a new one. "
                    + " Please increment the parser.pool.size property."
                    + " The current value is too small.");
            }

            parser = createNewParser();

        }

        /*
         *  now, if we have a parser
         */

        if (parser != null) {
            try {
                /*
                 *  dump namespace if we are told to.  Generally, you want to
                 *  do this - you don't in special circumstances, such as
                 *  when a VM is getting init()-ed & parsed
                 */

                if (dumpNamespace) {
                    dumpVMNamespace(templateName);
                }

                ast = parser.parse(reader, templateName);
            }
            finally {
                /*
                 *  put it back
                 */
 
View Full Code Here

     */
    public Parser createNewParser()
    {
        requireInitialization();

        Parser parser = new Parser(this);
        parser.setDirectives(runtimeDirectives);
        return parser;
    }
View Full Code Here

    public SimpleNode parse(Reader reader, String templateName, boolean dumpNamespace)
        throws ParseException
    {
        requireInitialization();

        Parser parser = (Parser) parserPool.get();
        boolean keepParser = true;
        if (parser == null)
        {
            /*
             *  if we couldn't get a parser from the pool make one and log it.
             */
            if (log.isInfoEnabled())
            {
                log.info("Runtime : ran out of parsers. Creating a new one. "
                      + " Please increment the parser.pool.size property."
                      + " The current value is too small.");
            }
            parser = createNewParser();
            keepParser = false;
        }

        try
        {
            /*
             *  dump namespace if we are told to.  Generally, you want to
             *  do this - you don't in special circumstances, such as
             *  when a VM is getting init()-ed & parsed
             */
            if (dumpNamespace)
            {
                dumpVMNamespace(templateName);
            }
            return parser.parse(reader, templateName);
        }
        finally
        {
            if (keepParser)
            {
View Full Code Here

     */
    public Parser createNewParser()
    {
        requireInitialization();

        Parser parser = new Parser(this);
        parser.setDirectives(runtimeDirectives);
        return parser;
    }
View Full Code Here

    public SimpleNode parse(Reader reader, String templateName, boolean dumpNamespace)
        throws ParseException
    {
        requireInitialization();

        Parser parser = (Parser) parserPool.get();
        boolean keepParser = true;
        if (parser == null)
        {
            /*
             *  if we couldn't get a parser from the pool make one and log it.
             */
            if (log.isInfoEnabled())
            {
                log.info("Runtime : ran out of parsers. Creating a new one. "
                      + " Please increment the parser.pool.size property."
                      + " The current value is too small.");
            }
            parser = createNewParser();
            keepParser = false;
        }

        try
        {
            /*
             *  dump namespace if we are told to.  Generally, you want to
             *  do this - you don't in special circumstances, such as
             *  when a VM is getting init()-ed & parsed
             */
            if (dumpNamespace)
            {
                dumpVMNamespace(templateName);
            }
            return parser.parse(reader, templateName);
        }
        finally
        {
            if (keepParser)
            {
View Full Code Here

     *
     * @return Parser javacc generated parser
     */
    public Parser createNewParser()
    {
        Parser parser = new Parser( this );
        parser.setDirectives(runtimeDirectives);
        return parser;
    }
View Full Code Here

    public SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
        throws ParseException
    {

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();
        boolean madeNew = false;

        if (parser == null)
        {
            /*
             *  if we couldn't get a parser from the pool
             *  make one and log it.
             */
           
            error("Runtime : ran out of parsers. Creating new.  "
                  + " Please increment the parser.pool.size property."
                  + " The current value is too small.");

            parser = createNewParser();

            if( parser != null )
            {
                madeNew = true;
            }
        }

        /*
         *  now, if we have a parser
         */

        if (parser != null)
        {
            try
            {
                /*
                 *  dump namespace if we are told to.  Generally, you want to
                 *  do this - you don't in special circumstances, such as
                 *  when a VM is getting init()-ed & parsed
                 */

                if ( dumpNamespace )
                {
                    dumpVMNamespace( templateName );
                }

                ast = parser.parse( reader, templateName );
            }
            finally
            {
                /*
                 *  if this came from the pool, then put back
View Full Code Here

TOP

Related Classes of org.apache.velocity.runtime.parser.Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.