Package com.creativewidgetworks.goldparser.engine

Examples of com.creativewidgetworks.goldparser.engine.Reduction


     * @return Boolean to indicate if processing should stop (true) or continue (false).
     */
    protected boolean processReduction() {
        if (!generateTree && ruleHandlers.size() > 0) {
            try {
                Reduction reduction = createInstance();
                setCurrentReduction(reduction);
            } catch (Throwable t) {
                addErrorMessage(t.getMessage());
                return true;
            }
View Full Code Here


            raiseParserException(FormatHelper.formatMessage("messages", "error.handler_none", rule));
        }
    }
   
    protected Reduction createInstance() throws ParserException {
        Reduction currentReduction = getCurrentReduction();
        String ruleName = currentReduction.getParent().toString();
        return createInstance(ruleName);
    }
View Full Code Here

        String ruleName = currentReduction.getParent().toString();
        return createInstance(ruleName);
    }
   
    protected Reduction createInstance(String ruleName) throws ParserException {
        Reduction reduction = null;

        // Look up the handler for the rule and construct an instance of the class
        Class clazz = ruleHandlers.get(ruleName);
        if (clazz == null) {
            clazz = ruleHandlers.get(ruleName.replace("'", "")); // Try removing single quotes
View Full Code Here

     * @return Boolean to indicate if processing should stop (true) or continue (false).
     */
    protected boolean processReduction() {
        if (!generateTree && ruleHandlers.size() > 0) {
            try {
                Reduction reduction = createInstance();
                setCurrentReduction(reduction);
            } catch (Throwable t) {
                addErrorMessage(t.getMessage());
                return true;
            }
View Full Code Here

            raiseParserException(FormatHelper.formatMessage("messages", "error.handler_none", rule));
        }
    }
   
    protected Reduction createInstance() throws ParserException {
        Reduction currentReduction = getCurrentReduction();
        String ruleName = currentReduction.getParent().toString();
        return createInstance(ruleName);
    }
View Full Code Here

        String ruleName = currentReduction.getParent().toString();
        return createInstance(ruleName);
    }
   
    protected Reduction createInstance(String ruleName) throws ParserException {
        Reduction reduction = null;

        // Look up the handler for the rule and construct an instance of the class
        Class clazz = ruleHandlers.get(ruleName);
        if (clazz == null) {
            clazz = ruleHandlers.get(ruleName.replace("'", "")); // Try removing single quotes
View Full Code Here

public class Return extends Reduction {

    private Reduction statements;

    public Return(GOLDParser parser) {
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            if (reduction.size() == 2) {
                statements = parser.getCurrentReduction().get(1).asReduction();
            } else if (reduction.size() != 1) {
                parser.raiseParserException(Simple3.formatMessage("error.param_count", "2", String.valueOf(reduction.size())));
            }
        } else {
            parser.raiseParserException(Simple3.formatMessage("error.no_reduction"));
        }
    }
View Full Code Here

    private Reduction leftExpression;
    private Reduction rightExpression;

    public Expression(GOLDParser parser) {
        theParser = parser;
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            if (reduction.size() == 3) {
                leftExpression  = reduction.get(0).asReduction();
                theOperator     = reduction.get(1).asString();
                rightExpression = reduction.get(2).asReduction()
                if (validOperators.indexOf(theOperator + " ") == -1) {
                    parser.raiseParserException(Simple3.formatMessage("error.invalid_operator", validOperators, theOperator));
                }
            } else {
                parser.raiseParserException(Simple3.formatMessage("error.param_count", "3", String.valueOf(reduction.size())));
            }
        } else {
            parser.raiseParserException(Simple3.formatMessage("error.no_reduction"));
        }       
    }
View Full Code Here

     * @return Boolean to indicate if processing should stop (true) or continue (false).
     */
    protected boolean processReduction() {
        if (!generateTree && ruleHandlers.size() > 0) {
            try {
                Reduction reduction = createInstance();
                setCurrentReduction(reduction);
            } catch (Throwable t) {
                addErrorMessage(t.getMessage());
                return true;
            }
View Full Code Here

            raiseParserException(FormatHelper.formatMessage("messages", "error.handler_none", rule));
        }
    }
   
    protected Reduction createInstance() throws ParserException {
        Reduction currentReduction = getCurrentReduction();
        String ruleName = currentReduction.getParent().toString();
        return createInstance(ruleName);
    }
View Full Code Here

TOP

Related Classes of com.creativewidgetworks.goldparser.engine.Reduction

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.