Examples of ExqlUnit


Examples of net.paoding.rose.jade.statement.expression.ExqlUnit

                    units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                }

                // 编译  {...} 内部的子句
                ExqlCompiler compiler = new ExqlCompiler(group);
                ExqlUnit unit = compiler.compileUnit();

                // 创建   {...}? 形式的子句
                units.add(new OptionUnit(unit));

                fromIndex = position;

                continue;
            }

            // 检查  # 后面的关键字
            String keyword = matcher.group(3);

            // 处理  #(:expr) 形式的子句
            if (keyword == null) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 创建文本子句
                    if (matcher.start() > fromIndex) {
                        units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                    }

                    // 创建  #(:expr) 形式的表达式
                    units.add(new ExprUnit(expr));

                    fromIndex = position;
                }
            }
            // 处理  ##(:expr) 形式的子句
            else if (keyword.equals(SHARP) || keyword.equals(JOIN)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 创建文本子句
                    if (matcher.start() > fromIndex) {
                        units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                    }

                    // 创建  ##(:expr) 形式的表达式
                    units.add(new JoinExprUnit(expr));

                    fromIndex = position;
                }
            }
            // 处理  #if(:expr) {...} #else {...} 形式的子句
            else if (keyword.equals(KEYWORD_IF)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 编译  {...} 单元
                    ExqlUnit unitIfTrue = compileBlock();
                    if (unitIfTrue != null) {

                        // 创建文本子句
                        if (matcher.start() > fromIndex) {
                            units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                        }

                        ExqlUnit unitIfFalse = null;

                        // 匹配  #else {...} 子句
                        if (match(SHARP_ELSE, position)) {

                            // 编译  {...} 单元
                            unitIfFalse = compileBlock();
                        }

                        // 创建  #if(:expr) {...} #else {...} 形式的子句
                        units.add(new ChoiceUnit(expr, unitIfTrue, unitIfFalse));

                        fromIndex = position;
                    }
                }
            }
            // 处理  #for(variant in :expr) {...} 形式的子句
            else if (keyword.equals(KEYWORD_FOR)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 编译  {...} 单元
                    ExqlUnit unit = compileBlock();
                    if (unit != null) {

                        // 创建文本子句
                        if (matcher.start() > fromIndex) {
                            units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.