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

edu.uvm.ccts.arden.mlm.antlr.MLMParser Maven / Gradle / Ivy

Go to download

ANTLR grammar and Java logic used to traverse the generated abstract syntax trees related to Arden-syntax Medical Logic Modules (MLMs)

There is a newer version: 1.2
Show newest version
// Generated from MLM.g4 by ANTLR 4.1
package edu.uvm.ccts.arden.mlm.antlr;
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 MLMParser extends Parser {
	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		T__0=1, CategoryID=2, SlotID=3, Data=4, WS=5;
	public static final String[] tokenNames = {
		"", "'end:'", "CategoryID", "SlotID", "Data", "WS"
	};
	public static final int
		RULE_init = 0, RULE_category = 1, RULE_slot = 2;
	public static final String[] ruleNames = {
		"init", "category", "slot"
	};

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

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

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

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

	public MLMParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class InitContext extends ParserRuleContext {
		public List category() {
			return getRuleContexts(CategoryContext.class);
		}
		public TerminalNode EOF() { return getToken(MLMParser.EOF, 0); }
		public CategoryContext category(int i) {
			return getRuleContext(CategoryContext.class,i);
		}
		public InitContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_init; }
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof MLMVisitor ) return ((MLMVisitor)visitor).visitInit(this);
			else return visitor.visitChildren(this);
		}
	}

	public final InitContext init() throws RecognitionException {
		InitContext _localctx = new InitContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_init);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(7); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(6); category();
				}
				}
				setState(9); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==CategoryID );
			setState(11); match(1);
			setState(12); match(EOF);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class CategoryContext extends ParserRuleContext {
		public List slot() {
			return getRuleContexts(SlotContext.class);
		}
		public SlotContext slot(int i) {
			return getRuleContext(SlotContext.class,i);
		}
		public TerminalNode CategoryID() { return getToken(MLMParser.CategoryID, 0); }
		public CategoryContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_category; }
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof MLMVisitor ) return ((MLMVisitor)visitor).visitCategory(this);
			else return visitor.visitChildren(this);
		}
	}

	public final CategoryContext category() throws RecognitionException {
		CategoryContext _localctx = new CategoryContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_category);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(14); match(CategoryID);
			setState(16); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(15); slot();
				}
				}
				setState(18); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==SlotID );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class SlotContext extends ParserRuleContext {
		public TerminalNode SlotID() { return getToken(MLMParser.SlotID, 0); }
		public TerminalNode Data() { return getToken(MLMParser.Data, 0); }
		public SlotContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_slot; }
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof MLMVisitor ) return ((MLMVisitor)visitor).visitSlot(this);
			else return visitor.visitChildren(this);
		}
	}

	public final SlotContext slot() throws RecognitionException {
		SlotContext _localctx = new SlotContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_slot);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(20); match(SlotID);
			setState(21); match(Data);
			}
		}
		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\7\32\4\2\t\2\4\3"+
		"\t\3\4\4\t\4\3\2\6\2\n\n\2\r\2\16\2\13\3\2\3\2\3\2\3\3\3\3\6\3\23\n\3"+
		"\r\3\16\3\24\3\4\3\4\3\4\3\4\2\5\2\4\6\2\2\30\2\t\3\2\2\2\4\20\3\2\2\2"+
		"\6\26\3\2\2\2\b\n\5\4\3\2\t\b\3\2\2\2\n\13\3\2\2\2\13\t\3\2\2\2\13\f\3"+
		"\2\2\2\f\r\3\2\2\2\r\16\7\3\2\2\16\17\7\2\2\3\17\3\3\2\2\2\20\22\7\4\2"+
		"\2\21\23\5\6\4\2\22\21\3\2\2\2\23\24\3\2\2\2\24\22\3\2\2\2\24\25\3\2\2"+
		"\2\25\5\3\2\2\2\26\27\7\5\2\2\27\30\7\6\2\2\30\7\3\2\2\2\4\13\24";
	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 - 2025 Weber Informatics LLC | Privacy Policy