All Downloads are FREE. Search and download functionalities are using the official Maven repository.

antlr.treepat.TreepatParser Maven / Gradle / Ivy

Go to download

Treepat is a language to recognise patterns in trees in a similar way as regular expressions recognize patterns in strings. Treepat includes analogous operators to regex union, concatenation, and closure, which are extended to the notion of trees.

There is a newer version: 2.0.0
Show newest version
// Generated from antlr/treepat/Treepat.g4 by ANTLR 4.1
package antlr.treepat;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class TreepatParser extends Parser {
	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		DOT=1, OR_SIGN=2, PAR_OPEN=3, PAR_CLOSE=4, NUMBER_SIGN=5, AT_SIGN=6, ASTERISK=7, 
		ID=8, NEWLINE=9, WS=10, INDENT=11, DEDENT=12;
	public static final String[] tokenNames = {
		"", "'.'", "'|'", "'('", "')'", "'#'", "'@'", "'*'", "ID", "NEWLINE", 
		"WS", "INDENT", "DEDENT"
	};
	public static final int
		RULE_treepat = 0, RULE_subtree = 1, RULE_depthClosure = 2, RULE_indentWrapper = 3, 
		RULE_nestedIndent = 4, RULE_indent = 5, RULE_sibling = 6, RULE_union = 7, 
		RULE_child = 8, RULE_breadthClosure = 9, RULE_atomTerm = 10, RULE_atomTermWrapper = 11, 
		RULE_depthTerm = 12, RULE_node = 13, RULE_dot = 14, RULE_nested = 15;
	public static final String[] ruleNames = {
		"treepat", "subtree", "depthClosure", "indentWrapper", "nestedIndent", 
		"indent", "sibling", "union", "child", "breadthClosure", "atomTerm", "atomTermWrapper", 
		"depthTerm", "node", "dot", "nested"
	};

	@Override
	public String getGrammarFileName() { return "Treepat.g4"; }

	@Override
	public String[] getTokenNames() { return tokenNames; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public ATN getATN() { return _ATN; }

	public TreepatParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class TreepatContext extends ParserRuleContext {
		public SubtreeContext subtree() {
			return getRuleContext(SubtreeContext.class,0);
		}
		public TreepatContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_treepat; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterTreepat(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitTreepat(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitTreepat(this);
			else return visitor.visitChildren(this);
		}
	}

	public final TreepatContext treepat() throws RecognitionException {
		TreepatContext _localctx = new TreepatContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_treepat);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(32); subtree();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class SubtreeContext extends ParserRuleContext {
		public SiblingContext sibling() {
			return getRuleContext(SiblingContext.class,0);
		}
		public SubtreeContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_subtree; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterSubtree(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitSubtree(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitSubtree(this);
			else return visitor.visitChildren(this);
		}
	}

	public final SubtreeContext subtree() throws RecognitionException {
		SubtreeContext _localctx = new SubtreeContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_subtree);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(34); sibling();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class DepthClosureContext extends ParserRuleContext {
		public TerminalNode NUMBER_SIGN() { return getToken(TreepatParser.NUMBER_SIGN, 0); }
		public IndentWrapperContext indentWrapper() {
			return getRuleContext(IndentWrapperContext.class,0);
		}
		public DepthClosureContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_depthClosure; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterDepthClosure(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitDepthClosure(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitDepthClosure(this);
			else return visitor.visitChildren(this);
		}
	}

	public final DepthClosureContext depthClosure() throws RecognitionException {
		DepthClosureContext _localctx = new DepthClosureContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_depthClosure);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(36); indentWrapper();
			setState(37); match(NUMBER_SIGN);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class IndentWrapperContext extends ParserRuleContext {
		public IndentContext indent() {
			return getRuleContext(IndentContext.class,0);
		}
		public NestedIndentContext nestedIndent() {
			return getRuleContext(NestedIndentContext.class,0);
		}
		public IndentWrapperContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_indentWrapper; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterIndentWrapper(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitIndentWrapper(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitIndentWrapper(this);
			else return visitor.visitChildren(this);
		}
	}

	public final IndentWrapperContext indentWrapper() throws RecognitionException {
		IndentWrapperContext _localctx = new IndentWrapperContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_indentWrapper);
		try {
			setState(41);
			switch (_input.LA(1)) {
			case NEWLINE:
				enterOuterAlt(_localctx, 1);
				{
				setState(39); indent();
				}
				break;
			case PAR_OPEN:
				enterOuterAlt(_localctx, 2);
				{
				setState(40); nestedIndent();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class NestedIndentContext extends ParserRuleContext {
		public IndentContext indent() {
			return getRuleContext(IndentContext.class,0);
		}
		public TerminalNode PAR_CLOSE() { return getToken(TreepatParser.PAR_CLOSE, 0); }
		public TerminalNode PAR_OPEN() { return getToken(TreepatParser.PAR_OPEN, 0); }
		public NestedIndentContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_nestedIndent; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterNestedIndent(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitNestedIndent(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitNestedIndent(this);
			else return visitor.visitChildren(this);
		}
	}

	public final NestedIndentContext nestedIndent() throws RecognitionException {
		NestedIndentContext _localctx = new NestedIndentContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_nestedIndent);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(43); match(PAR_OPEN);
			setState(44); indent();
			setState(45); match(PAR_CLOSE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class IndentContext extends ParserRuleContext {
		public SubtreeContext subtree() {
			return getRuleContext(SubtreeContext.class,0);
		}
		public TerminalNode DEDENT() { return getToken(TreepatParser.DEDENT, 0); }
		public TerminalNode NEWLINE() { return getToken(TreepatParser.NEWLINE, 0); }
		public TerminalNode INDENT() { return getToken(TreepatParser.INDENT, 0); }
		public IndentContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_indent; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterIndent(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitIndent(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitIndent(this);
			else return visitor.visitChildren(this);
		}
	}

	public final IndentContext indent() throws RecognitionException {
		IndentContext _localctx = new IndentContext(_ctx, getState());
		enterRule(_localctx, 10, RULE_indent);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(47); match(NEWLINE);
			setState(48); match(INDENT);
			setState(49); subtree();
			setState(50); match(DEDENT);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class SiblingContext extends ParserRuleContext {
		public List union() {
			return getRuleContexts(UnionContext.class);
		}
		public UnionContext union(int i) {
			return getRuleContext(UnionContext.class,i);
		}
		public SiblingContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_sibling; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterSibling(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitSibling(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitSibling(this);
			else return visitor.visitChildren(this);
		}
	}

	public final SiblingContext sibling() throws RecognitionException {
		SiblingContext _localctx = new SiblingContext(_ctx, getState());
		enterRule(_localctx, 12, RULE_sibling);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(53); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(52); union();
				}
				}
				setState(55); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DOT) | (1L << PAR_OPEN) | (1L << AT_SIGN) | (1L << ID) | (1L << NEWLINE))) != 0) );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class UnionContext extends ParserRuleContext {
		public List child() {
			return getRuleContexts(ChildContext.class);
		}
		public ChildContext child(int i) {
			return getRuleContext(ChildContext.class,i);
		}
		public TerminalNode OR_SIGN(int i) {
			return getToken(TreepatParser.OR_SIGN, i);
		}
		public List OR_SIGN() { return getTokens(TreepatParser.OR_SIGN); }
		public UnionContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_union; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterUnion(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitUnion(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitUnion(this);
			else return visitor.visitChildren(this);
		}
	}

	public final UnionContext union() throws RecognitionException {
		UnionContext _localctx = new UnionContext(_ctx, getState());
		enterRule(_localctx, 14, RULE_union);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(57); child();
			setState(62);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==OR_SIGN) {
				{
				{
				setState(58); match(OR_SIGN);
				setState(59); child();
				}
				}
				setState(64);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ChildContext extends ParserRuleContext {
		public IndentWrapperContext indentWrapper() {
			return getRuleContext(IndentWrapperContext.class,0);
		}
		public BreadthClosureContext breadthClosure() {
			return getRuleContext(BreadthClosureContext.class,0);
		}
		public ChildContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_child; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterChild(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitChild(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitChild(this);
			else return visitor.visitChildren(this);
		}
	}

	public final ChildContext child() throws RecognitionException {
		ChildContext _localctx = new ChildContext(_ctx, getState());
		enterRule(_localctx, 16, RULE_child);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(65); breadthClosure();
			setState(67);
			switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
			case 1:
				{
				setState(66); indentWrapper();
				}
				break;
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class BreadthClosureContext extends ParserRuleContext {
		public List NEWLINE() { return getTokens(TreepatParser.NEWLINE); }
		public TerminalNode NEWLINE(int i) {
			return getToken(TreepatParser.NEWLINE, i);
		}
		public AtomTermContext atomTerm() {
			return getRuleContext(AtomTermContext.class,0);
		}
		public TerminalNode ASTERISK() { return getToken(TreepatParser.ASTERISK, 0); }
		public BreadthClosureContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_breadthClosure; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterBreadthClosure(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitBreadthClosure(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitBreadthClosure(this);
			else return visitor.visitChildren(this);
		}
	}

	public final BreadthClosureContext breadthClosure() throws RecognitionException {
		BreadthClosureContext _localctx = new BreadthClosureContext(_ctx, getState());
		enterRule(_localctx, 18, RULE_breadthClosure);
		int _la;
		try {
			int _alt;
			enterOuterAlt(_localctx, 1);
			{
			setState(69); atomTerm();
			setState(71);
			_la = _input.LA(1);
			if (_la==ASTERISK) {
				{
				setState(70); match(ASTERISK);
				}
			}

			setState(76);
			_errHandler.sync(this);
			_alt = getInterpreter().adaptivePredict(_input,5,_ctx);
			while ( _alt!=2 && _alt!=-1 ) {
				if ( _alt==1 ) {
					{
					{
					setState(73); match(NEWLINE);
					}
					} 
				}
				setState(78);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,5,_ctx);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class AtomTermContext extends ParserRuleContext {
		public List NEWLINE() { return getTokens(TreepatParser.NEWLINE); }
		public TerminalNode NEWLINE(int i) {
			return getToken(TreepatParser.NEWLINE, i);
		}
		public AtomTermWrapperContext atomTermWrapper() {
			return getRuleContext(AtomTermWrapperContext.class,0);
		}
		public AtomTermContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_atomTerm; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterAtomTerm(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitAtomTerm(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitAtomTerm(this);
			else return visitor.visitChildren(this);
		}
	}

	public final AtomTermContext atomTerm() throws RecognitionException {
		AtomTermContext _localctx = new AtomTermContext(_ctx, getState());
		enterRule(_localctx, 20, RULE_atomTerm);
		try {
			int _alt;
			enterOuterAlt(_localctx, 1);
			{
			setState(82);
			_errHandler.sync(this);
			_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
			while ( _alt!=2 && _alt!=-1 ) {
				if ( _alt==1 ) {
					{
					{
					setState(79); match(NEWLINE);
					}
					} 
				}
				setState(84);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
			}
			setState(85); atomTermWrapper();
			setState(89);
			_errHandler.sync(this);
			_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
			while ( _alt!=2 && _alt!=-1 ) {
				if ( _alt==1 ) {
					{
					{
					setState(86); match(NEWLINE);
					}
					} 
				}
				setState(91);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class AtomTermWrapperContext extends ParserRuleContext {
		public DepthTermContext depthTerm() {
			return getRuleContext(DepthTermContext.class,0);
		}
		public NodeContext node() {
			return getRuleContext(NodeContext.class,0);
		}
		public NestedContext nested() {
			return getRuleContext(NestedContext.class,0);
		}
		public DepthClosureContext depthClosure() {
			return getRuleContext(DepthClosureContext.class,0);
		}
		public AtomTermWrapperContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_atomTermWrapper; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterAtomTermWrapper(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitAtomTermWrapper(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitAtomTermWrapper(this);
			else return visitor.visitChildren(this);
		}
	}

	public final AtomTermWrapperContext atomTermWrapper() throws RecognitionException {
		AtomTermWrapperContext _localctx = new AtomTermWrapperContext(_ctx, getState());
		enterRule(_localctx, 22, RULE_atomTermWrapper);
		try {
			setState(96);
			switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				setState(92); depthClosure();
				}
				break;

			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(93); nested();
				}
				break;

			case 3:
				enterOuterAlt(_localctx, 3);
				{
				setState(94); depthTerm();
				}
				break;

			case 4:
				enterOuterAlt(_localctx, 4);
				{
				setState(95); node();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class DepthTermContext extends ParserRuleContext {
		public TerminalNode AT_SIGN() { return getToken(TreepatParser.AT_SIGN, 0); }
		public NodeContext node() {
			return getRuleContext(NodeContext.class,0);
		}
		public DepthTermContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_depthTerm; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterDepthTerm(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitDepthTerm(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitDepthTerm(this);
			else return visitor.visitChildren(this);
		}
	}

	public final DepthTermContext depthTerm() throws RecognitionException {
		DepthTermContext _localctx = new DepthTermContext(_ctx, getState());
		enterRule(_localctx, 24, RULE_depthTerm);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(98); match(AT_SIGN);
			setState(99); node();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class NodeContext extends ParserRuleContext {
		public Token name;
		public TerminalNode ID() { return getToken(TreepatParser.ID, 0); }
		public DotContext dot() {
			return getRuleContext(DotContext.class,0);
		}
		public NodeContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_node; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterNode(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitNode(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitNode(this);
			else return visitor.visitChildren(this);
		}
	}

	public final NodeContext node() throws RecognitionException {
		NodeContext _localctx = new NodeContext(_ctx, getState());
		enterRule(_localctx, 26, RULE_node);
		try {
			setState(103);
			switch (_input.LA(1)) {
			case ID:
				enterOuterAlt(_localctx, 1);
				{
				setState(101); ((NodeContext)_localctx).name = match(ID);
				}
				break;
			case DOT:
				enterOuterAlt(_localctx, 2);
				{
				setState(102); dot();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class DotContext extends ParserRuleContext {
		public TerminalNode DOT() { return getToken(TreepatParser.DOT, 0); }
		public DotContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_dot; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterDot(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitDot(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitDot(this);
			else return visitor.visitChildren(this);
		}
	}

	public final DotContext dot() throws RecognitionException {
		DotContext _localctx = new DotContext(_ctx, getState());
		enterRule(_localctx, 28, RULE_dot);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(105); match(DOT);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class NestedContext extends ParserRuleContext {
		public SubtreeContext subtree() {
			return getRuleContext(SubtreeContext.class,0);
		}
		public TerminalNode PAR_CLOSE() { return getToken(TreepatParser.PAR_CLOSE, 0); }
		public TerminalNode PAR_OPEN() { return getToken(TreepatParser.PAR_OPEN, 0); }
		public NestedContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_nested; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).enterNested(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof TreepatListener ) ((TreepatListener)listener).exitNested(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof TreepatVisitor ) return ((TreepatVisitor)visitor).visitNested(this);
			else return visitor.visitChildren(this);
		}
	}

	public final NestedContext nested() throws RecognitionException {
		NestedContext _localctx = new NestedContext(_ctx, getState());
		enterRule(_localctx, 30, RULE_nested);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(107); match(PAR_OPEN);
			setState(108); subtree();
			setState(109); match(PAR_CLOSE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\3\16r\4\2\t\2\4\3\t"+
		"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4"+
		"\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\3\2\3\2\3\3\3\3"+
		"\3\4\3\4\3\4\3\5\3\5\5\5,\n\5\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\b"+
		"\6\b8\n\b\r\b\16\b9\3\t\3\t\3\t\7\t?\n\t\f\t\16\tB\13\t\3\n\3\n\5\nF\n"+
		"\n\3\13\3\13\5\13J\n\13\3\13\7\13M\n\13\f\13\16\13P\13\13\3\f\7\fS\n\f"+
		"\f\f\16\fV\13\f\3\f\3\f\7\fZ\n\f\f\f\16\f]\13\f\3\r\3\r\3\r\3\r\5\rc\n"+
		"\r\3\16\3\16\3\16\3\17\3\17\5\17j\n\17\3\20\3\20\3\21\3\21\3\21\3\21\3"+
		"\21\2\22\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \2\2m\2\"\3\2\2\2\4$\3"+
		"\2\2\2\6&\3\2\2\2\b+\3\2\2\2\n-\3\2\2\2\f\61\3\2\2\2\16\67\3\2\2\2\20"+
		";\3\2\2\2\22C\3\2\2\2\24G\3\2\2\2\26T\3\2\2\2\30b\3\2\2\2\32d\3\2\2\2"+
		"\34i\3\2\2\2\36k\3\2\2\2 m\3\2\2\2\"#\5\4\3\2#\3\3\2\2\2$%\5\16\b\2%\5"+
		"\3\2\2\2&\'\5\b\5\2\'(\7\7\2\2(\7\3\2\2\2),\5\f\7\2*,\5\n\6\2+)\3\2\2"+
		"\2+*\3\2\2\2,\t\3\2\2\2-.\7\5\2\2./\5\f\7\2/\60\7\6\2\2\60\13\3\2\2\2"+
		"\61\62\7\13\2\2\62\63\7\r\2\2\63\64\5\4\3\2\64\65\7\16\2\2\65\r\3\2\2"+
		"\2\668\5\20\t\2\67\66\3\2\2\289\3\2\2\29\67\3\2\2\29:\3\2\2\2:\17\3\2"+
		"\2\2;@\5\22\n\2<=\7\4\2\2=?\5\22\n\2><\3\2\2\2?B\3\2\2\2@>\3\2\2\2@A\3"+
		"\2\2\2A\21\3\2\2\2B@\3\2\2\2CE\5\24\13\2DF\5\b\5\2ED\3\2\2\2EF\3\2\2\2"+
		"F\23\3\2\2\2GI\5\26\f\2HJ\7\t\2\2IH\3\2\2\2IJ\3\2\2\2JN\3\2\2\2KM\7\13"+
		"\2\2LK\3\2\2\2MP\3\2\2\2NL\3\2\2\2NO\3\2\2\2O\25\3\2\2\2PN\3\2\2\2QS\7"+
		"\13\2\2RQ\3\2\2\2SV\3\2\2\2TR\3\2\2\2TU\3\2\2\2UW\3\2\2\2VT\3\2\2\2W["+
		"\5\30\r\2XZ\7\13\2\2YX\3\2\2\2Z]\3\2\2\2[Y\3\2\2\2[\\\3\2\2\2\\\27\3\2"+
		"\2\2][\3\2\2\2^c\5\6\4\2_c\5 \21\2`c\5\32\16\2ac\5\34\17\2b^\3\2\2\2b"+
		"_\3\2\2\2b`\3\2\2\2ba\3\2\2\2c\31\3\2\2\2de\7\b\2\2ef\5\34\17\2f\33\3"+
		"\2\2\2gj\7\n\2\2hj\5\36\20\2ig\3\2\2\2ih\3\2\2\2j\35\3\2\2\2kl\7\3\2\2"+
		"l\37\3\2\2\2mn\7\5\2\2no\5\4\3\2op\7\6\2\2p!\3\2\2\2\f+9@EINT[bi";
	public static final ATN _ATN =
		ATNSimulator.deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy