// Generated from ./src/domain/grammar/StepGrammar.g4 by ANTLR 4.7.1
// jshint ignore: start
var antlr4 = require('antlr4/index');
var StepGrammarListener = require('./StepGrammarListener').StepGrammarListener;
var StepGrammarVisitor = require('./StepGrammarVisitor').StepGrammarVisitor;

var grammarFileName = "StepGrammar.g4";

var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
    "\u0003\u000eM\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004\u0004\t",
    "\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t\u0007\u0004",
    "\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0003\u0002\u0003",
    "\u0002\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
    "\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
    "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
    "\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0005\t2\n\t\u0003\n\u0003",
    "\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0005\n;\n\n\u0003\n\u0003",
    "\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0007\nE\n\n\f\n",
    "\u000e\nH\u000b\n\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0002",
    "\u0003\u0012\f\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0002",
    "\u0003\u0003\u0002\u000b\f\u0002I\u0002\u0016\u0003\u0002\u0002\u0002",
    "\u0004\u0018\u0003\u0002\u0002\u0002\u0006\u001a\u0003\u0002\u0002\u0002",
    "\b\u001d\u0003\u0002\u0002\u0002\n \u0003\u0002\u0002\u0002\f#\u0003",
    "\u0002\u0002\u0002\u000e%\u0003\u0002\u0002\u0002\u00101\u0003\u0002",
    "\u0002\u0002\u0012:\u0003\u0002\u0002\u0002\u0014I\u0003\u0002\u0002",
    "\u0002\u0016\u0017\u0007\r\u0002\u0002\u0017\u0003\u0003\u0002\u0002",
    "\u0002\u0018\u0019\u0005\u0012\n\u0002\u0019\u0005\u0003\u0002\u0002",
    "\u0002\u001a\u001b\u0007\u0005\u0002\u0002\u001b\u001c\u0005\u0012\n",
    "\u0002\u001c\u0007\u0003\u0002\u0002\u0002\u001d\u001e\u0007\u0006\u0002",
    "\u0002\u001e\u001f\u0005\u0012\n\u0002\u001f\t\u0003\u0002\u0002\u0002",
    " !\u0007\u0007\u0002\u0002!\"\u0005\u0012\n\u0002\"\u000b\u0003\u0002",
    "\u0002\u0002#$\u0005\u0012\n\u0002$\r\u0003\u0002\u0002\u0002%&\t\u0002",
    "\u0002\u0002&\u000f\u0003\u0002\u0002\u0002\'(\u0007\t\u0002\u0002(",
    ")\u0005\u000e\b\u0002)*\u0005\u0012\n\u0002*+\u0007\n\u0002\u0002+,",
    "\u0005\u0012\n\u0002,2\u0003\u0002\u0002\u0002-.\u0007\t\u0002\u0002",
    "./\u0005\u000e\b\u0002/0\u0005\u0012\n\u000202\u0003\u0002\u0002\u0002",
    "1\'\u0003\u0002\u0002\u00021-\u0003\u0002\u0002\u00022\u0011\u0003\u0002",
    "\u0002\u000234\b\n\u0001\u00024;\u0005\u0002\u0002\u00025;\u0005\u0010",
    "\t\u000267\u0007\u0003\u0002\u000278\u0005\u0004\u0003\u000289\u0007",
    "\u0004\u0002\u00029;\u0003\u0002\u0002\u0002:3\u0003\u0002\u0002\u0002",
    ":5\u0003\u0002\u0002\u0002:6\u0003\u0002\u0002\u0002;F\u0003\u0002\u0002",
    "\u0002<=\f\b\u0002\u0002=E\u0005\f\u0007\u0002>?\f\u0007\u0002\u0002",
    "?E\u0005\u0006\u0004\u0002@A\f\u0006\u0002\u0002AE\u0005\b\u0005\u0002",
    "BC\f\u0004\u0002\u0002CE\u0005\n\u0006\u0002D<\u0003\u0002\u0002\u0002",
    "D>\u0003\u0002\u0002\u0002D@\u0003\u0002\u0002\u0002DB\u0003\u0002\u0002",
    "\u0002EH\u0003\u0002\u0002\u0002FD\u0003\u0002\u0002\u0002FG\u0003\u0002",
    "\u0002\u0002G\u0013\u0003\u0002\u0002\u0002HF\u0003\u0002\u0002\u0002",
    "IJ\u0005\u0012\n\u0002JK\u0007\u0002\u0002\u0003K\u0015\u0003\u0002",
    "\u0002\u0002\u00061:DF"].join("");


var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);

var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });

var sharedContextCache = new antlr4.PredictionContextCache();

var literalNames = [ null, "'('", "')'", "'and'", "'or'", "'=>'", "','", 
                     "'if'", "'else'" ];

var symbolicNames = [ null, null, null, "AND", "OR", "ARROW", "COMA", "IF", 
                      "ELSE", "SINGLE_STRING", "DOUBLE_STRING", "ID", "WS" ];

var ruleNames =  [ "action", "par_step", "and_step", "or_step", "arrow_step", 
                   "sequence_step", "string", "check", "step", "main" ];

function StepGrammarParser (input) {
	antlr4.Parser.call(this, input);
    this._interp = new antlr4.atn.ParserATNSimulator(this, atn, decisionsToDFA, sharedContextCache);
    this.ruleNames = ruleNames;
    this.literalNames = literalNames;
    this.symbolicNames = symbolicNames;
    return this;
}

StepGrammarParser.prototype = Object.create(antlr4.Parser.prototype);
StepGrammarParser.prototype.constructor = StepGrammarParser;

Object.defineProperty(StepGrammarParser.prototype, "atn", {
	get : function() {
		return atn;
	}
});

StepGrammarParser.EOF = antlr4.Token.EOF;
StepGrammarParser.T__0 = 1;
StepGrammarParser.T__1 = 2;
StepGrammarParser.AND = 3;
StepGrammarParser.OR = 4;
StepGrammarParser.ARROW = 5;
StepGrammarParser.COMA = 6;
StepGrammarParser.IF = 7;
StepGrammarParser.ELSE = 8;
StepGrammarParser.SINGLE_STRING = 9;
StepGrammarParser.DOUBLE_STRING = 10;
StepGrammarParser.ID = 11;
StepGrammarParser.WS = 12;

StepGrammarParser.RULE_action = 0;
StepGrammarParser.RULE_par_step = 1;
StepGrammarParser.RULE_and_step = 2;
StepGrammarParser.RULE_or_step = 3;
StepGrammarParser.RULE_arrow_step = 4;
StepGrammarParser.RULE_sequence_step = 5;
StepGrammarParser.RULE_string = 6;
StepGrammarParser.RULE_check = 7;
StepGrammarParser.RULE_step = 8;
StepGrammarParser.RULE_main = 9;

function ActionContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_action;
    return this;
}

ActionContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
ActionContext.prototype.constructor = ActionContext;

ActionContext.prototype.ID = function() {
    return this.getToken(StepGrammarParser.ID, 0);
};

ActionContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterAction(this);
	}
};

ActionContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitAction(this);
	}
};

ActionContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitAction(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.ActionContext = ActionContext;

StepGrammarParser.prototype.action = function() {

    var localctx = new ActionContext(this, this._ctx, this.state);
    this.enterRule(localctx, 0, StepGrammarParser.RULE_action);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 20;
        this.match(StepGrammarParser.ID);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function Par_stepContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_par_step;
    return this;
}

Par_stepContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
Par_stepContext.prototype.constructor = Par_stepContext;

Par_stepContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

Par_stepContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterPar_step(this);
	}
};

Par_stepContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitPar_step(this);
	}
};

Par_stepContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitPar_step(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.Par_stepContext = Par_stepContext;

StepGrammarParser.prototype.par_step = function() {

    var localctx = new Par_stepContext(this, this._ctx, this.state);
    this.enterRule(localctx, 2, StepGrammarParser.RULE_par_step);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 22;
        this.step(0);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function And_stepContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_and_step;
    return this;
}

And_stepContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
And_stepContext.prototype.constructor = And_stepContext;

And_stepContext.prototype.AND = function() {
    return this.getToken(StepGrammarParser.AND, 0);
};

And_stepContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

And_stepContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterAnd_step(this);
	}
};

And_stepContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitAnd_step(this);
	}
};

And_stepContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitAnd_step(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.And_stepContext = And_stepContext;

StepGrammarParser.prototype.and_step = function() {

    var localctx = new And_stepContext(this, this._ctx, this.state);
    this.enterRule(localctx, 4, StepGrammarParser.RULE_and_step);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 24;
        this.match(StepGrammarParser.AND);
        this.state = 25;
        this.step(0);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function Or_stepContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_or_step;
    return this;
}

Or_stepContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
Or_stepContext.prototype.constructor = Or_stepContext;

Or_stepContext.prototype.OR = function() {
    return this.getToken(StepGrammarParser.OR, 0);
};

Or_stepContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

Or_stepContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterOr_step(this);
	}
};

Or_stepContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitOr_step(this);
	}
};

Or_stepContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitOr_step(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.Or_stepContext = Or_stepContext;

StepGrammarParser.prototype.or_step = function() {

    var localctx = new Or_stepContext(this, this._ctx, this.state);
    this.enterRule(localctx, 6, StepGrammarParser.RULE_or_step);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 27;
        this.match(StepGrammarParser.OR);
        this.state = 28;
        this.step(0);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function Arrow_stepContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_arrow_step;
    return this;
}

Arrow_stepContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
Arrow_stepContext.prototype.constructor = Arrow_stepContext;

Arrow_stepContext.prototype.ARROW = function() {
    return this.getToken(StepGrammarParser.ARROW, 0);
};

Arrow_stepContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

Arrow_stepContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterArrow_step(this);
	}
};

Arrow_stepContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitArrow_step(this);
	}
};

Arrow_stepContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitArrow_step(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.Arrow_stepContext = Arrow_stepContext;

StepGrammarParser.prototype.arrow_step = function() {

    var localctx = new Arrow_stepContext(this, this._ctx, this.state);
    this.enterRule(localctx, 8, StepGrammarParser.RULE_arrow_step);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 30;
        this.match(StepGrammarParser.ARROW);
        this.state = 31;
        this.step(0);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function Sequence_stepContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_sequence_step;
    return this;
}

Sequence_stepContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
Sequence_stepContext.prototype.constructor = Sequence_stepContext;

Sequence_stepContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

Sequence_stepContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterSequence_step(this);
	}
};

Sequence_stepContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitSequence_step(this);
	}
};

Sequence_stepContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitSequence_step(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.Sequence_stepContext = Sequence_stepContext;

StepGrammarParser.prototype.sequence_step = function() {

    var localctx = new Sequence_stepContext(this, this._ctx, this.state);
    this.enterRule(localctx, 10, StepGrammarParser.RULE_sequence_step);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 33;
        this.step(0);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function StringContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_string;
    return this;
}

StringContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
StringContext.prototype.constructor = StringContext;

StringContext.prototype.SINGLE_STRING = function() {
    return this.getToken(StepGrammarParser.SINGLE_STRING, 0);
};

StringContext.prototype.DOUBLE_STRING = function() {
    return this.getToken(StepGrammarParser.DOUBLE_STRING, 0);
};

StringContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterString(this);
	}
};

StringContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitString(this);
	}
};

StringContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitString(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.StringContext = StringContext;

StepGrammarParser.prototype.string = function() {

    var localctx = new StringContext(this, this._ctx, this.state);
    this.enterRule(localctx, 12, StepGrammarParser.RULE_string);
    var _la = 0; // Token type
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 35;
        _la = this._input.LA(1);
        if(!(_la===StepGrammarParser.SINGLE_STRING || _la===StepGrammarParser.DOUBLE_STRING)) {
        this._errHandler.recoverInline(this);
        }
        else {
        	this._errHandler.reportMatch(this);
            this.consume();
        }
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function CheckContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_check;
    return this;
}

CheckContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
CheckContext.prototype.constructor = CheckContext;

CheckContext.prototype.IF = function() {
    return this.getToken(StepGrammarParser.IF, 0);
};

CheckContext.prototype.string = function() {
    return this.getTypedRuleContext(StringContext,0);
};

CheckContext.prototype.step = function(i) {
    if(i===undefined) {
        i = null;
    }
    if(i===null) {
        return this.getTypedRuleContexts(StepContext);
    } else {
        return this.getTypedRuleContext(StepContext,i);
    }
};

CheckContext.prototype.ELSE = function() {
    return this.getToken(StepGrammarParser.ELSE, 0);
};

CheckContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterCheck(this);
	}
};

CheckContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitCheck(this);
	}
};

CheckContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitCheck(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.CheckContext = CheckContext;

StepGrammarParser.prototype.check = function() {

    var localctx = new CheckContext(this, this._ctx, this.state);
    this.enterRule(localctx, 14, StepGrammarParser.RULE_check);
    try {
        this.state = 47;
        this._errHandler.sync(this);
        var la_ = this._interp.adaptivePredict(this._input,0,this._ctx);
        switch(la_) {
        case 1:
            this.enterOuterAlt(localctx, 1);
            this.state = 37;
            this.match(StepGrammarParser.IF);
            this.state = 38;
            this.string();
            this.state = 39;
            this.step(0);
            this.state = 40;
            this.match(StepGrammarParser.ELSE);
            this.state = 41;
            this.step(0);
            break;

        case 2:
            this.enterOuterAlt(localctx, 2);
            this.state = 43;
            this.match(StepGrammarParser.IF);
            this.state = 44;
            this.string();
            this.state = 45;
            this.step(0);
            break;

        }
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};

function StepContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_step;
    return this;
}

StepContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
StepContext.prototype.constructor = StepContext;

StepContext.prototype.action = function() {
    return this.getTypedRuleContext(ActionContext,0);
};

StepContext.prototype.check = function() {
    return this.getTypedRuleContext(CheckContext,0);
};

StepContext.prototype.par_step = function() {
    return this.getTypedRuleContext(Par_stepContext,0);
};

StepContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

StepContext.prototype.sequence_step = function() {
    return this.getTypedRuleContext(Sequence_stepContext,0);
};

StepContext.prototype.and_step = function() {
    return this.getTypedRuleContext(And_stepContext,0);
};

StepContext.prototype.or_step = function() {
    return this.getTypedRuleContext(Or_stepContext,0);
};

StepContext.prototype.arrow_step = function() {
    return this.getTypedRuleContext(Arrow_stepContext,0);
};

StepContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterStep(this);
	}
};

StepContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitStep(this);
	}
};

StepContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitStep(this);
    } else {
        return visitor.visitChildren(this);
    }
};



StepGrammarParser.prototype.step = function(_p) {
	if(_p===undefined) {
	    _p = 0;
	}
    var _parentctx = this._ctx;
    var _parentState = this.state;
    var localctx = new StepContext(this, this._ctx, _parentState);
    var _prevctx = localctx;
    var _startState = 16;
    this.enterRecursionRule(localctx, 16, StepGrammarParser.RULE_step, _p);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 56;
        this._errHandler.sync(this);
        switch(this._input.LA(1)) {
        case StepGrammarParser.ID:
            this.state = 50;
            this.action();
            break;
        case StepGrammarParser.IF:
            this.state = 51;
            this.check();
            break;
        case StepGrammarParser.T__0:
            this.state = 52;
            this.match(StepGrammarParser.T__0);
            this.state = 53;
            this.par_step();
            this.state = 54;
            this.match(StepGrammarParser.T__1);
            break;
        default:
            throw new antlr4.error.NoViableAltException(this);
        }
        this._ctx.stop = this._input.LT(-1);
        this.state = 68;
        this._errHandler.sync(this);
        var _alt = this._interp.adaptivePredict(this._input,3,this._ctx)
        while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) {
            if(_alt===1) {
                if(this._parseListeners!==null) {
                    this.triggerExitRuleEvent();
                }
                _prevctx = localctx;
                this.state = 66;
                this._errHandler.sync(this);
                var la_ = this._interp.adaptivePredict(this._input,2,this._ctx);
                switch(la_) {
                case 1:
                    localctx = new StepContext(this, _parentctx, _parentState);
                    this.pushNewRecursionContext(localctx, _startState, StepGrammarParser.RULE_step);
                    this.state = 58;
                    if (!( this.precpred(this._ctx, 6))) {
                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 6)");
                    }
                    this.state = 59;
                    this.sequence_step();
                    break;

                case 2:
                    localctx = new StepContext(this, _parentctx, _parentState);
                    this.pushNewRecursionContext(localctx, _startState, StepGrammarParser.RULE_step);
                    this.state = 60;
                    if (!( this.precpred(this._ctx, 5))) {
                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 5)");
                    }
                    this.state = 61;
                    this.and_step();
                    break;

                case 3:
                    localctx = new StepContext(this, _parentctx, _parentState);
                    this.pushNewRecursionContext(localctx, _startState, StepGrammarParser.RULE_step);
                    this.state = 62;
                    if (!( this.precpred(this._ctx, 4))) {
                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 4)");
                    }
                    this.state = 63;
                    this.or_step();
                    break;

                case 4:
                    localctx = new StepContext(this, _parentctx, _parentState);
                    this.pushNewRecursionContext(localctx, _startState, StepGrammarParser.RULE_step);
                    this.state = 64;
                    if (!( this.precpred(this._ctx, 2))) {
                        throw new antlr4.error.FailedPredicateException(this, "this.precpred(this._ctx, 2)");
                    }
                    this.state = 65;
                    this.arrow_step();
                    break;

                } 
            }
            this.state = 70;
            this._errHandler.sync(this);
            _alt = this._interp.adaptivePredict(this._input,3,this._ctx);
        }

    } catch( error) {
        if(error instanceof antlr4.error.RecognitionException) {
	        localctx.exception = error;
	        this._errHandler.reportError(this, error);
	        this._errHandler.recover(this, error);
	    } else {
	    	throw error;
	    }
    } finally {
        this.unrollRecursionContexts(_parentctx)
    }
    return localctx;
};

function MainContext(parser, parent, invokingState) {
	if(parent===undefined) {
	    parent = null;
	}
	if(invokingState===undefined || invokingState===null) {
		invokingState = -1;
	}
	antlr4.ParserRuleContext.call(this, parent, invokingState);
    this.parser = parser;
    this.ruleIndex = StepGrammarParser.RULE_main;
    return this;
}

MainContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
MainContext.prototype.constructor = MainContext;

MainContext.prototype.step = function() {
    return this.getTypedRuleContext(StepContext,0);
};

MainContext.prototype.EOF = function() {
    return this.getToken(StepGrammarParser.EOF, 0);
};

MainContext.prototype.enterRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.enterMain(this);
	}
};

MainContext.prototype.exitRule = function(listener) {
    if(listener instanceof StepGrammarListener ) {
        listener.exitMain(this);
	}
};

MainContext.prototype.accept = function(visitor) {
    if ( visitor instanceof StepGrammarVisitor ) {
        return visitor.visitMain(this);
    } else {
        return visitor.visitChildren(this);
    }
};




StepGrammarParser.MainContext = MainContext;

StepGrammarParser.prototype.main = function() {

    var localctx = new MainContext(this, this._ctx, this.state);
    this.enterRule(localctx, 18, StepGrammarParser.RULE_main);
    try {
        this.enterOuterAlt(localctx, 1);
        this.state = 71;
        this.step(0);
        this.state = 72;
        this.match(StepGrammarParser.EOF);
    } catch (re) {
    	if(re instanceof antlr4.error.RecognitionException) {
	        localctx.exception = re;
	        this._errHandler.reportError(this, re);
	        this._errHandler.recover(this, re);
	    } else {
	    	throw re;
	    }
    } finally {
        this.exitRule();
    }
    return localctx;
};


StepGrammarParser.prototype.sempred = function(localctx, ruleIndex, predIndex) {
	switch(ruleIndex) {
	case 8:
			return this.step_sempred(localctx, predIndex);
    default:
        throw "No predicate with index:" + ruleIndex;
   }
};

StepGrammarParser.prototype.step_sempred = function(localctx, predIndex) {
	switch(predIndex) {
		case 0:
			return this.precpred(this._ctx, 6);
		case 1:
			return this.precpred(this._ctx, 5);
		case 2:
			return this.precpred(this._ctx, 4);
		case 3:
			return this.precpred(this._ctx, 2);
		default:
			throw "No predicate with index:" + predIndex;
	}
};


exports.StepGrammarParser = StepGrammarParser;
