Package org.parboiled.support

Examples of org.parboiled.support.DoWithMatcherVisitor


    public class Handler implements MatchHandler {
        private long timeCorrection;
        private int totalMatches;

        public boolean matchRoot(MatcherContext<?> rootContext) {
            rootContext.getMatcher().accept(new DoWithMatcherVisitor(new DoWithMatcherVisitor.Action() {
                public void process(Matcher matcher) {
                    RuleStats ruleStats = (RuleStats) matcher.getTag();
                    if (ruleStats == null) {
                        ruleStats = new RuleStats();
                        matcher.setTag(ruleStats);
                    } else {
                        ruleStats.clear();
                    }
                }
            }));

            totalMatches = 0;
            long timeStamp = System.nanoTime() - timeCorrection;
            boolean matched = rootContext.runMatcher();
            totalNanoTime += System.nanoTime() - timeCorrection - timeStamp;

            rootMatcher.accept(new DoWithMatcherVisitor(updateStatsAction));
            return matched;
        }
View Full Code Here

TOP

Related Classes of org.parboiled.support.DoWithMatcherVisitor

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.