Package eas.math.fundamentalAlgorithms.type2grammars.charty.nonsense

Examples of eas.math.fundamentalAlgorithms.type2grammars.charty.nonsense.GrammarSyntaxException


            final String line = sc.next().trim();
            if (!line.startsWith("#")) {

                final String[] parts = line.split("\\s+");
                if (parts.length < 2 || !"->".equals(parts[1]))
                    throw new GrammarSyntaxException("Can't understand "
                            + "production '" + line + "'.");

                final String lhs = parts[0];
                final String[] rhs = Arrays.copyOfRange(parts, 2, parts.length);
                if (rhs.length == 0)
                    throw new GrammarSyntaxException("Right hand side missing"
                            + " in '" + line + "'.");

                if (!addProduction(lhs, rhs))
                    throw new GrammarSyntaxException("Production '" + line
                            + "' is declared more than once.");
            }
        }

        if (productions.isEmpty())
            throw new GrammarSyntaxException("There must be at least one"
                    + " production.");
    }
View Full Code Here

TOP

Related Classes of eas.math.fundamentalAlgorithms.type2grammars.charty.nonsense.GrammarSyntaxException

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.