Examples of GrammarException


Examples of org.parboiled.errors.GrammarException

                String sb = '"' + String.valueOf(b) + '"';
                String msg = a.length == b.length ? sa + " is specified twice in a FirstOf(String...)" : sa +
                        " is a prefix of " + sb + " in a FirstOf(String...) and comes before " +
                        sb + ", which prevents " + sb +
                        " from ever matching! You should reverse the order of the two alternatives.";
                throw new GrammarException(msg);
            }
        }
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

     * @param errorMessageFormat the error message format
     * @param errorMessageArgs   the error message arguments
     */
    public static void ensure(boolean condition, String errorMessageFormat, Object... errorMessageArgs) {
        if (!condition) {
            throw new GrammarException(errorMessageFormat, errorMessageArgs);
        }
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

     * @param condition    the condition
     * @param errorMessage the error message
     */
    public static void ensure(boolean condition, String errorMessage) {
        if (!condition) {
            throw new GrammarException(errorMessage);
        }
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

        // collect all further matches as well
        int lastIndex = context.getCurrentIndex();
        while (subMatcher.getSubContext(context).runMatcher()) {
            int currentIndex = context.getCurrentIndex();
            if (currentIndex == lastIndex) {
                throw new GrammarException("The inner rule of OneOrMore rule '%s' must not allow empty matches",
                        context.getPath());
            }
            lastIndex = currentIndex;
        }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

    public boolean match(@NotNull MatcherContext context) {
        int lastIndex = context.getCurrentIndex();
        while (subMatcher.getSubContext(context).runMatcher()) {
            int currentLocation = context.getCurrentIndex();
            if (currentLocation == lastIndex) {
                throw new GrammarException("The inner rule of ZeroOrMore rule '%s' must not allow empty matches",
                        context.getPath());
            }
            lastIndex = currentLocation;
        }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

    public char getFirstMatchChar() {
        checkActionContext();
        int ix = subContext.startIndex;
        if (subContext.currentIndex <= ix) {
            throw new GrammarException("getFirstMatchChar called but previous rule did not match anything");
        }
        return inputBuffer.charAt(ix);
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

            return new ActionMatcher(action).label(action.toString());
        }
        Checks.ensure(!(obj instanceof Boolean), "Rule specification contains an unwrapped Boolean value, " +
                "if you were trying to specify a parser action wrap the expression with ACTION(...)");

        throw new GrammarException("'" + obj + "' cannot be automatically converted to a parser Rule");
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

                if (arg != null && !paramTypes[i].isAssignableFrom(arg.getClass())) continue outer;
                if (arg == null && paramTypes[i].isPrimitive()) continue outer;
            }
            return constructor;
        }
        throw new GrammarException("No constructor found for %s and the given %s arguments", type, args.length);
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

                if (arg != null && !paramTypes[i].isAssignableFrom(arg.getClass())) continue outer;
                if (arg == null && paramTypes[i].isPrimitive()) continue outer;
            }
            return constructor;
        }
        throw new GrammarException("No constructor found for %s and the given %s arguments", type, args.length);
    }
View Full Code Here

Examples of org.parboiled.errors.GrammarException

            return new ActionMatcher(action).label(action.toString());
        }
        Checks.ensure(!(obj instanceof Boolean), "Rule specification contains an unwrapped Boolean value, " +
                "if you were trying to specify a parser action wrap the expression with ACTION(...)");

        throw new GrammarException("'" + obj + "' cannot be automatically converted to a parser Rule");
    }
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.