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

hudson.scheduler.CrontabParser Maven / Gradle / Ivy

// $ANTLR 2.7.4: "crontab.g" -> "CrontabParser.java"$

  package hudson.scheduler;

import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;

public class CrontabParser extends BaseParser       implements CrontabParserTokenTypes
 {

protected CrontabParser(TokenBuffer tokenBuf, int k) {
  super(tokenBuf,k);
  tokenNames = _tokenNames;
}

public CrontabParser(TokenBuffer tokenBuf) {
  this(tokenBuf,1);
}

protected CrontabParser(TokenStream lexer, int k) {
  super(lexer,k);
  tokenNames = _tokenNames;
}

public CrontabParser(TokenStream lexer) {
  this(lexer,1);
}

public CrontabParser(ParserSharedInputState state) {
  super(state,1);
  tokenNames = _tokenNames;
}

	public final void startRule(
		CronTab table
	) throws RecognitionException, TokenStreamException, ANTLRException {
		
		
		long m,h,d,mnth,dow;
		
		
		m=expr(0);
		match(WS);
		h=expr(1);
		match(WS);
		d=expr(2);
		match(WS);
		mnth=expr(3);
		match(WS);
		dow=expr(4);
		match(Token.EOF_TYPE);
		if ( inputState.guessing==0 ) {
			
			table.bits[0]=m;
			table.bits[1]=h;
			table.bits[2]=d;
			table.bits[3]=mnth;
			table.dayOfWeek=(int)dow;
			
		}
	}
	
	public final long  expr(
		int field
	) throws RecognitionException, TokenStreamException, ANTLRException {
		long bits=0;
		
		
		long lhs,rhs=0;
		
		
		lhs=term(field);
		{
		switch ( LA(1)) {
		case 5:
		{
			match(5);
			rhs=expr(field);
			break;
		}
		case EOF:
		case WS:
		{
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		if ( inputState.guessing==0 ) {
			
			bits = lhs|rhs;
			
		}
		return bits;
	}
	
	public final long  term(
		int field
	) throws RecognitionException, TokenStreamException, ANTLRException {
		long bits=0;
		
		
		int d=1,s,e,t;
		
		
		boolean synPredMatched6 = false;
		if (((LA(1)==TOKEN))) {
			int _m6 = mark();
			synPredMatched6 = true;
			inputState.guessing++;
			try {
				{
				token();
				match(6);
				}
			}
			catch (RecognitionException pe) {
				synPredMatched6 = false;
			}
			rewind(_m6);
			inputState.guessing--;
		}
		if ( synPredMatched6 ) {
			s=token();
			match(6);
			e=token();
			{
			switch ( LA(1)) {
			case 7:
			{
				match(7);
				d=token();
				break;
			}
			case EOF:
			case WS:
			case 5:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			if ( inputState.guessing==0 ) {
				
				bits = doRange(s,e,d,field);
				
			}
		}
		else if ((LA(1)==TOKEN)) {
			t=token();
			if ( inputState.guessing==0 ) {
				
				rangeCheck(t,field);
				bits = 1L<",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"space",
		"\",\"",
		"\"-\"",
		"\"/\"",
		"\"*\"",
		"a number",
		"MINUS",
		"STAR",
		"DIV",
		"OR"
	};
	
	
	}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy