Package org.parboiled.support

Examples of org.parboiled.support.Characters


*/
public class GetStarterCharVisitor extends DefaultMatcherVisitor<Character> {

    @Override
    public Character visit(AnyOfMatcher matcher) {
        Characters characters = matcher.characters;
        if (!characters.isSubtractive()) {
            return characters.getChars()[0];
        }

        // for substractive sets we try to randomly choose a fitting character
        Random random = new Random();
        char c;
        do {
            c = (char) random.nextInt(Character.MAX_VALUE);
        } while (!Character.isDefined(c) || !characters.contains(c));
        return c;
    }
View Full Code Here

TOP

Related Classes of org.parboiled.support.Characters

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.