Package com.creativewidgetworks.goldparser.engine

Examples of com.creativewidgetworks.goldparser.engine.Reduction


    private GOLDParser theParser;
    private String variableName;

    public Id(GOLDParser parser) {
        theParser = parser;
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            if (reduction.size() == 1) {
                variableName = reduction.get(0).asString();
            } else {
                parser.raiseParserException(Simple2.formatMessage("error.param_count", "1", String.valueOf(reduction.size())));
            }
        } else {
            parser.raiseParserException(Simple2.formatMessage("error.no_reduction"));
        }       
    }
View Full Code Here


public class Parenthesis extends Reduction {

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

public class Statements extends Reduction {
    private Reduction statement1;
    private Reduction statement2;

    public Statements(GOLDParser parser) {
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            if (reduction.size() > 0 && reduction.size() < 3) {
                statement1 = reduction.get(0).asReduction();
                statement2 = (reduction.size() > 1) ? reduction.get(1).asReduction() : null;
            } else {
                parser.raiseParserException(Simple2.formatMessage("error.param_count_range", "1", "2", String.valueOf(reduction.size())));
            }
        } else {
            parser.raiseParserException(Simple2.formatMessage("error.no_reduction"));
        }        
    }
View Full Code Here

public class WhileLoop extends Reduction {
    private Reduction conditional;
    private Reduction statements;

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

    private String variableName;
    private Reduction variableValue;

    public Assign(GOLDParser parser) {
        theParser = parser;
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            if (reduction.size() == 4) {
                variableName = reduction.get(1).asString();
                variableValue = reduction.get(3).asReduction();
            } else {
                parser.raiseParserException(Simple2.formatMessage("error.param_count", "4", String.valueOf(reduction.size())));
            }
        } else {
            parser.raiseParserException(Simple2.formatMessage("error.no_reduction"));
        }
    }
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.