Package webit.script.core.text

Examples of webit.script.core.text.TextStatementFactory


     */
    public TemplateAST parse(final Template template) throws ParseException {
        Lexer lexer = null;
        final Engine myEngine = template.engine;
        final Resource resource = template.resource;
        final TextStatementFactory textStatFactory = myEngine.getTextStatementFactory();
        this.template = template;
        this.engine = myEngine;
        this.textStatementFactory = textStatFactory;
        this.locateVarForce = !myEngine.isLooseVar();
        this.nativeFactory = myEngine.getNativeFactory();
        this.varmgr = new VariantManager(myEngine);
        this.currentLabelIndex = 0;
        this.labelsIndexMap.put(null, 0);
        try {
            //ISSUE: LexerProvider
            lexer = new Lexer(resource.openReader());
            lexer.setTrimCodeBlockBlankLine(myEngine.isTrimCodeBlockBlankLine());
            if (resource instanceof ResourceOffset) {
                lexer.setOffset((ResourceOffset) resource);
            } else {
                lexer.setOffset(0, 0);
            }
            textStatFactory.startTemplateParser(template);
            return (TemplateAST) this.parse(lexer).value;
        } catch (ParseException e) {
            throw e;
        } catch (Exception e) {
            throw new ParseException(e);
        } finally {
            textStatFactory.finishTemplateParser(template);
            if (lexer != null) {
                try {
                    lexer.yyclose();
                } catch (IOException ignore) {
                }
View Full Code Here

TOP

Related Classes of webit.script.core.text.TextStatementFactory

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.