Examples of ParserBase


Examples of org.rythmengine.internal.parser.ParserBase

    public Keyword keyword() {
        return Keyword.ARGS;
    }

    public IParser create(final IContext ctx) {
        return new ParserBase(ctx) {
            /*
             * parse @args {...}
             */
            public Token go2(String s) {
                Regex r = reg(dialect());
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

            }
        }
    }

    public IParser create(final IContext ctx) {
        return new ParserBase(ctx) {
            public Token go() {
                Regex r = reg(dialect());
                if (!r.search(remain())) {
                    raiseParseException("bad @renderBody statement. Correct usage: @renderBody(params...)");
                }
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

    static final Pattern P_HEREDOC_SIMBOL = Pattern.compile("(\\s*<<).*", Pattern.DOTALL);
    static final Pattern P_STANDARD_BLOCK = Pattern.compile("(\\s*\\{).*", Pattern.DOTALL);

    @Override
    public IParser create(IContext ctx) {
        return new ParserBase(ctx) {

            String testTag(String name) {
                return engine_.testTemplate(name, ctx().getTemplateClass());
            }

View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

        parsers.add(new ParserDispatcher(ctx));
        parsers.add(new BlockCloseParser(ctx));
        parsers.add(new ScriptParser(ctx));
        parsers.add(new StringTokenParser(ctx));
        // add a fail through parser to prevent unlimited loop
        parsers.add(new ParserBase(ctx) {
            @Override
            public Token go() {
                TemplateParser p = (TemplateParser) ctx();
                if (lastCursor < p.cursor) return null;
                //logger.warn("fail-through parser reached. is there anything wrong in your template? line: %s", ctx.currentLine());
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

        final String caret = caret_;
        if (null == r1 || null == r2) {
            throw new DialectNotSupportException(dialect.id());
        }

        return new ParserBase(ctx) {

            @Override
            public Token go() {
                String s = remain();
                if (r1.search(s)) {
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

    protected String patternStr() {
        return R;
    }

    public IParser create(final IContext ctx) {
        return new ParserBase(ctx) {
            public Token go() {
                String remain = remain();
                String line;
                Regex r = new Regex(String.format("\\n?[ \\t\\x0B\\f]*%s%s(\\([ \t\f]*\\))?[ \t\f]*((?@{}))[ \\t\\x0B\\f]*\\n?", a(), keyword()));
                String matched;
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

//            }
//        };
//    }

    public IParser create(final IContext ctx) {
        return new ParserBase(ctx) {
            public Token go() {
                Regex r = reg(dialect());
                if (!r.search(remain()))
                    raiseParseException("bad @assign statement. Correct usage: @assign(myVariable){...}");
                String matched = r.stringMatched();
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

    private final Pattern P = Pattern.compile("^((\\n[ \\t\\x0B\\f]*}[ \\t\\x0B\\f]*)\\n).*", Pattern.DOTALL);

    @Override
    public IParser create(final IContext ctx) {
        return new ParserBase(ctx) {
            @Override
            public Token go() {
                String remain = remain();
                char c = remain.charAt(0);
                if ('{' == c) {
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

        final IDialect dialect = ctx.getDialect();
        //if (!(dialect instanceof Rythm)) throw new DialectNotSupportException(dialect.id());
        final String caret_ = dialect.a();

        return new ParserBase(ctx) {

            @Override
            public Token go() {
                final String caret_ = dialect.a();
                final Regex r1 = new Regex(String.format(patternStr1(), caret_));
View Full Code Here

Examples of org.rythmengine.internal.parser.ParserBase

    public Keyword keyword() {
        return Keyword.RENDER_SECTION;
    }

    public IParser create(final IContext ctx) {
        return new ParserBase(ctx) {
            public Token go() {
                Matcher m = ptn(dialect()).matcher(remain());
                if (!m.matches()) return null;
                String matched = m.group(1);
                boolean lineBreak = false;
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.