Package org.rythmengine.internal

Examples of org.rythmengine.internal.IContext.step()


                    patterns.put(s, p);
                }
                Matcher m = p.matcher(remain());
                if (m.matches()) {
                    s = m.group(1);
                    ctx.step(s.length());
                    ctx.enterDirectiveComment();
                    return Token.EMPTY_TOKEN;
                }
                // try <!-- }
                s = "(" + sCommentStart + "\\s*)\\}.*";
 
View Full Code Here


                    patterns.put(s, p);
                }
                m = p.matcher(remain());
                if (m.matches()) {
                    s = m.group(1);
                    ctx.step(s.length());
                    ctx.enterDirectiveComment();
                    return Token.EMPTY_TOKEN;
                }
            }
            type = type.getParent();
View Full Code Here

            patterns.put(blockEnd, p);
        }
        Matcher m = p.matcher(remain);
        if (m.matches()) {
            String matched = m.group(1);
            ctx.step(matched.length());
            ctx.popCodeType();
            String s = String.format("p(\"%s\");__ctx.popCodeType();", matched, curType);
            return new CodeToken(s, ctx);
        }
View Full Code Here

        if (!ctx.getDialect().enableScripting()) {
            throw new TemplateParser.ScriptingDisabledException(ctx);
        }
        String s = r.stringMatched(1);
        int curLine = ctx.currentLine();
        ctx.step(s.length());
        s = r.stringMatched(2);
        s = s.substring(1); // strip left "{"
        s = s.substring(0, s.length() - 1); // strip right "}"
        r = new Regex(".*[ \\t\\n\\r\\}]+if[ \\t]*\\(.*");
        boolean hasIfStatement = r.search(" " + s);
View Full Code Here

        }
        s = m.group(1);
        if (s.length() == 0) {
            return null;
        }
        ctx.step(s.length());
        s = s.replace(String.format("%s%s", a, a), a).replace("\\", "\\\\");
        if ("".equals(s)) {
            return Token.EMPTY_TOKEN;
        } else {
            return new Token.StringToken(s, ctx);
View Full Code Here

            }
            s = m.group(1);
        }
        // keep ">" or "]" for case like <a id=".." @if (...) class="error" @>
        if (s.endsWith(">") || s.endsWith("]") || s.endsWith("\n")) s = s.substring(0, s.length() - 1);
        ctx.step(s.length());
        boolean hasLineBreak = s.contains("\\n") || s.contains("\\r");
        try {
            s = ctx.closeBlock();
            if (hasLineBreak) s = s + "\n"; // fix #53
        } catch (ParseException e) {
View Full Code Here

                    patterns.put(s, p);
                }
                Matcher m = p.matcher(remain());
                if (m.matches()) {
                    s = m.group(1);
                    ctx.step(s.length());
                    ctx.leaveDirectiveComment();
                    return Token.EMPTY_TOKEN;
                }
            }
            type = type.getParent();
View Full Code Here

                }
                Matcher m = pStart.matcher(remain);
                if (m.matches()) {
                    ctx.pushCodeType(type);
                    String matched = m.group(1);
                    ctx.step(matched.length());
                    String s = matched;
                    if (matched.indexOf('@') > -1) {
                        // process internal template
                        char ch = s.charAt(0);
                        s = s.substring(1); //prevent CodeTypeBlockStartSensor to sense it again
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.