Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
nl.basjes.codeowners.parser.CodeOwnersParser Maven / Gradle / Ivy
// Generated from nl/basjes/codeowners/parser/CodeOwnersParser.g4 by ANTLR 4.13.2
package nl.basjes.codeowners.parser;
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", "CheckReturnValue", "this-escape"})
public class CodeOwnersParser extends Parser {
static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
OPTIONAL=1, BLOCKOPEN=2, COMMENT=3, SPACES=4, USERID=5, NEWLINE=6, FILEEXPRESSION=7,
SECTION_SPACES=8, SECTIONVALUE=9;
public static final int
RULE_codeowners = 0, RULE_configLine = 1;
private static String[] makeRuleNames() {
return new String[] {
"codeowners", "configLine"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'^'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, "OPTIONAL", "BLOCKOPEN", "COMMENT", "SPACES", "USERID", "NEWLINE",
"FILEEXPRESSION", "SECTION_SPACES", "SECTIONVALUE"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "CodeOwnersParser.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public CodeOwnersParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@SuppressWarnings("CheckReturnValue")
public static class CodeownersContext extends ParserRuleContext {
public List configLine() {
return getRuleContexts(ConfigLineContext.class);
}
public ConfigLineContext configLine(int i) {
return getRuleContext(ConfigLineContext.class,i);
}
public CodeownersContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_codeowners; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).enterCodeowners(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).exitCodeowners(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof CodeOwnersParserVisitor ) return ((CodeOwnersParserVisitor extends T>)visitor).visitCodeowners(this);
else return visitor.visitChildren(this);
}
}
public final CodeownersContext codeowners() throws RecognitionException {
CodeownersContext _localctx = new CodeownersContext(_ctx, getState());
enterRule(_localctx, 0, RULE_codeowners);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(5);
_errHandler.sync(this);
_la = _input.LA(1);
do {
{
{
setState(4);
configLine();
}
}
setState(7);
_errHandler.sync(this);
_la = _input.LA(1);
} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & 714L) != 0) );
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
@SuppressWarnings("CheckReturnValue")
public static class ConfigLineContext extends ParserRuleContext {
public ConfigLineContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_configLine; }
public ConfigLineContext() { }
public void copyFrom(ConfigLineContext ctx) {
super.copyFrom(ctx);
}
}
@SuppressWarnings("CheckReturnValue")
public static class ApprovalRuleContext extends ConfigLineContext {
public Token fileExpression;
public TerminalNode FILEEXPRESSION() { return getToken(CodeOwnersParser.FILEEXPRESSION, 0); }
public List USERID() { return getTokens(CodeOwnersParser.USERID); }
public TerminalNode USERID(int i) {
return getToken(CodeOwnersParser.USERID, i);
}
public ApprovalRuleContext(ConfigLineContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).enterApprovalRule(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).exitApprovalRule(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof CodeOwnersParserVisitor ) return ((CodeOwnersParserVisitor extends T>)visitor).visitApprovalRule(this);
else return visitor.visitChildren(this);
}
}
@SuppressWarnings("CheckReturnValue")
public static class SectionContext extends ConfigLineContext {
public Token optional;
public Token section;
public Token approvers;
public Token defaultApprovers;
public List SECTIONVALUE() { return getTokens(CodeOwnersParser.SECTIONVALUE); }
public TerminalNode SECTIONVALUE(int i) {
return getToken(CodeOwnersParser.SECTIONVALUE, i);
}
public TerminalNode OPTIONAL() { return getToken(CodeOwnersParser.OPTIONAL, 0); }
public List USERID() { return getTokens(CodeOwnersParser.USERID); }
public TerminalNode USERID(int i) {
return getToken(CodeOwnersParser.USERID, i);
}
public SectionContext(ConfigLineContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).enterSection(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).exitSection(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof CodeOwnersParserVisitor ) return ((CodeOwnersParserVisitor extends T>)visitor).visitSection(this);
else return visitor.visitChildren(this);
}
}
@SuppressWarnings("CheckReturnValue")
public static class CommentContext extends ConfigLineContext {
public TerminalNode COMMENT() { return getToken(CodeOwnersParser.COMMENT, 0); }
public List NEWLINE() { return getTokens(CodeOwnersParser.NEWLINE); }
public TerminalNode NEWLINE(int i) {
return getToken(CodeOwnersParser.NEWLINE, i);
}
public CommentContext(ConfigLineContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).enterComment(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof CodeOwnersParserListener ) ((CodeOwnersParserListener)listener).exitComment(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof CodeOwnersParserVisitor ) return ((CodeOwnersParserVisitor extends T>)visitor).visitComment(this);
else return visitor.visitChildren(this);
}
}
public final ConfigLineContext configLine() throws RecognitionException {
ConfigLineContext _localctx = new ConfigLineContext(_ctx, getState());
enterRule(_localctx, 2, RULE_configLine);
int _la;
try {
int _alt;
setState(37);
_errHandler.sync(this);
switch (_input.LA(1)) {
case OPTIONAL:
case SECTIONVALUE:
_localctx = new SectionContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(10);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==OPTIONAL) {
{
setState(9);
((SectionContext)_localctx).optional = match(OPTIONAL);
}
}
setState(12);
((SectionContext)_localctx).section = match(SECTIONVALUE);
setState(14);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
case 1:
{
setState(13);
((SectionContext)_localctx).approvers = match(SECTIONVALUE);
}
break;
}
setState(19);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==USERID) {
{
{
setState(16);
((SectionContext)_localctx).defaultApprovers = match(USERID);
}
}
setState(21);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
case FILEEXPRESSION:
_localctx = new ApprovalRuleContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(22);
((ApprovalRuleContext)_localctx).fileExpression = match(FILEEXPRESSION);
setState(26);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==USERID) {
{
{
setState(23);
match(USERID);
}
}
setState(28);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
case COMMENT:
case NEWLINE:
_localctx = new CommentContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(30);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==COMMENT) {
{
setState(29);
match(COMMENT);
}
}
setState(33);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1:
{
{
setState(32);
match(NEWLINE);
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(35);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
}
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 final String _serializedATN =
"\u0004\u0001\t(\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0001"+
"\u0000\u0004\u0000\u0006\b\u0000\u000b\u0000\f\u0000\u0007\u0001\u0001"+
"\u0003\u0001\u000b\b\u0001\u0001\u0001\u0001\u0001\u0003\u0001\u000f\b"+
"\u0001\u0001\u0001\u0005\u0001\u0012\b\u0001\n\u0001\f\u0001\u0015\t\u0001"+
"\u0001\u0001\u0001\u0001\u0005\u0001\u0019\b\u0001\n\u0001\f\u0001\u001c"+
"\t\u0001\u0001\u0001\u0003\u0001\u001f\b\u0001\u0001\u0001\u0004\u0001"+
"\"\b\u0001\u000b\u0001\f\u0001#\u0003\u0001&\b\u0001\u0001\u0001\u0000"+
"\u0000\u0002\u0000\u0002\u0000\u0000.\u0000\u0005\u0001\u0000\u0000\u0000"+
"\u0002%\u0001\u0000\u0000\u0000\u0004\u0006\u0003\u0002\u0001\u0000\u0005"+
"\u0004\u0001\u0000\u0000\u0000\u0006\u0007\u0001\u0000\u0000\u0000\u0007"+
"\u0005\u0001\u0000\u0000\u0000\u0007\b\u0001\u0000\u0000\u0000\b\u0001"+
"\u0001\u0000\u0000\u0000\t\u000b\u0005\u0001\u0000\u0000\n\t\u0001\u0000"+
"\u0000\u0000\n\u000b\u0001\u0000\u0000\u0000\u000b\f\u0001\u0000\u0000"+
"\u0000\f\u000e\u0005\t\u0000\u0000\r\u000f\u0005\t\u0000\u0000\u000e\r"+
"\u0001\u0000\u0000\u0000\u000e\u000f\u0001\u0000\u0000\u0000\u000f\u0013"+
"\u0001\u0000\u0000\u0000\u0010\u0012\u0005\u0005\u0000\u0000\u0011\u0010"+
"\u0001\u0000\u0000\u0000\u0012\u0015\u0001\u0000\u0000\u0000\u0013\u0011"+
"\u0001\u0000\u0000\u0000\u0013\u0014\u0001\u0000\u0000\u0000\u0014&\u0001"+
"\u0000\u0000\u0000\u0015\u0013\u0001\u0000\u0000\u0000\u0016\u001a\u0005"+
"\u0007\u0000\u0000\u0017\u0019\u0005\u0005\u0000\u0000\u0018\u0017\u0001"+
"\u0000\u0000\u0000\u0019\u001c\u0001\u0000\u0000\u0000\u001a\u0018\u0001"+
"\u0000\u0000\u0000\u001a\u001b\u0001\u0000\u0000\u0000\u001b&\u0001\u0000"+
"\u0000\u0000\u001c\u001a\u0001\u0000\u0000\u0000\u001d\u001f\u0005\u0003"+
"\u0000\u0000\u001e\u001d\u0001\u0000\u0000\u0000\u001e\u001f\u0001\u0000"+
"\u0000\u0000\u001f!\u0001\u0000\u0000\u0000 \"\u0005\u0006\u0000\u0000"+
"! \u0001\u0000\u0000\u0000\"#\u0001\u0000\u0000\u0000#!\u0001\u0000\u0000"+
"\u0000#$\u0001\u0000\u0000\u0000$&\u0001\u0000\u0000\u0000%\n\u0001\u0000"+
"\u0000\u0000%\u0016\u0001\u0000\u0000\u0000%\u001e\u0001\u0000\u0000\u0000"+
"&\u0003\u0001\u0000\u0000\u0000\b\u0007\n\u000e\u0013\u001a\u001e#%";
public static final ATN _ATN =
new ATNDeserializer().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);
}
}
}