Example #1
0
    def __init__(self, input, state=None):
        if state is None:
            state = RecognizerSharedState()

        Parser.__init__(self, input, state)

        self.dfa4 = self.DFA4(self,
                              4,
                              eot=self.DFA4_eot,
                              eof=self.DFA4_eof,
                              min=self.DFA4_min,
                              max=self.DFA4_max,
                              accept=self.DFA4_accept,
                              special=self.DFA4_special,
                              transition=self.DFA4_transition)

        self.ordinal_set = set()
        self.weekday_set = set()
        self.month_set = set()
        self.monthday_set = set()
        self.time_string = ''
        self.interval_mins = 0
        self.period_string = ''
        self.synchronized = False
        self.start_time_string = ''
        self.end_time_string = ''
Example #2
0
    def __init__(self, input, state=None):
        if state is None:
            state = RecognizerSharedState()

        Parser.__init__(self, input, state)


        self.dfa4 = self.DFA4(
            self, 4,
            eot = self.DFA4_eot,
            eof = self.DFA4_eof,
            min = self.DFA4_min,
            max = self.DFA4_max,
            accept = self.DFA4_accept,
            special = self.DFA4_special,
            transition = self.DFA4_transition
            )




        self.ordinal_set = set()
        self.weekday_set = set()
        self.month_set = set()
        self.monthday_set = set()
        self.time_string = ''
        self.interval_mins = 0
        self.period_string = ''
        self.synchronized = False
        self.start_time_string = ''
        self.end_time_string = ''
Example #3
0
    def __init__(self, input, state=None):
        if state is None:
            state = RecognizerSharedState()

        Parser.__init__(self, input, state)


        self.dfa3 = self.DFA3(
            self, 3,
            eot = self.DFA3_eot,
            eof = self.DFA3_eof,
            min = self.DFA3_min,
            max = self.DFA3_max,
            accept = self.DFA3_accept,
            special = self.DFA3_special,
            transition = self.DFA3_transition
            )




        self.ordinal_set = set()
        self.weekday_set = set()
        self.month_set = set()
        self.time_string = '';
        self.interval_mins = 0;
        self.period_string = '';
Example #4
0
    def combineFollows(self, exact):
        followSet = set()
        for localFollowSet in reversed(self.following):
            followSet |= localFollowSet
            if exact and EOR_TOKEN_TYPE not in localFollowSet:
                break

        followSet -= set([EOR_TOKEN_TYPE])
        return followSet
Example #5
0
    def month_of_quarter_ordinal(self, ):

        offset = None

        try:
            try:
                pass
                offset = self.input.LT(1)
                if (FIRST <= self.input.LA(1) <= THIRD):
                    self.input.consume()
                    self._state.errorRecovery = False

                else:
                    mse = MismatchedSetException(None, self.input)
                    raise mse



                jOffset = self.ValueOf(offset.type) - 1
                self.month_set = self.month_set.union(set([
                    jOffset + self.ValueOf(JANUARY), jOffset + self.ValueOf(APRIL),
                    jOffset + self.ValueOf(JULY), jOffset + self.ValueOf(OCTOBER)]))




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #6
0
    def recoverFromMismatchedElement(self, input, e, follow):
        """
        This code is factored out from mismatched token and mismatched set
        recovery.  It handles "single token insertion" error recovery for
        both.  No tokens are consumed to recover from insertions.  Return
        true if recovery was possible else return false.
        """
        
        if follow is None:
            # we have no information about the follow; we can only consume
            # a single token and hope for the best
            return False

        # compute what can follow this grammar element reference
        if EOR_TOKEN_TYPE in follow:
            viableTokensFollowingThisRule = \
                self.computeContextSensitiveRuleFOLLOW()
            
            follow = (follow | viableTokensFollowingThisRule) \
                     - set([EOR_TOKEN_TYPE])

        # if current token is consistent with what could come after set
        # then it is ok to "insert" the missing token, else throw exception
        if input.LA(1) in follow:
            self.reportError(e)
            return True

        # nothing to do; throw exception
        return False
Example #7
0
    def __init__(self, input, state=None):
        if state is None:
            state = RecognizerSharedState()

        Parser.__init__(self, input, state)





        self.ordinal_set = set()
        self.weekday_set = set()
        self.month_set = set()
        self.time_string = '';
        self.interval_mins = 0;
        self.period_string = '';
Example #8
0
    def month_of_quarter_ordinal(self, ):

        offset = None

        try:
            try:

                pass
                offset = self.input.LT(1)
                if (FIRST <= self.input.LA(1) <= THIRD):
                    self.input.consume()
                    self._state.errorRecovery = False

                else:
                    mse = MismatchedSetException(None, self.input)
                    raise mse

                jOffset = self.ValueOf(offset.type) - 1
                self.month_set = self.month_set.union(
                    set([
                        jOffset + self.ValueOf(JANUARY),
                        jOffset + self.ValueOf(APRIL),
                        jOffset + self.ValueOf(JULY),
                        jOffset + self.ValueOf(OCTOBER)
                    ]))

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
    def monthspec(self,):

        try:
            try:

                pass

                alt11 = 2
                LA11_0 = self.input.LA(1)

                if LA11_0 == MONTH:
                    alt11 = 1
                elif JANUARY <= LA11_0 <= DECEMBER:
                    alt11 = 2
                else:
                    nvae = NoViableAltException("", 11, 0, self.input)

                    raise nvae

                if alt11 == 1:

                    pass
                    self.match(self.input, MONTH, self.FOLLOW_MONTH_in_monthspec464)

                    self.month_set = self.month_set.union(
                        set(
                            [
                                self.ValueOf(JANUARY),
                                self.ValueOf(FEBRUARY),
                                self.ValueOf(MARCH),
                                self.ValueOf(APRIL),
                                self.ValueOf(MAY),
                                self.ValueOf(JUNE),
                                self.ValueOf(JULY),
                                self.ValueOf(AUGUST),
                                self.ValueOf(SEPTEMBER),
                                self.ValueOf(OCTOBER),
                                self.ValueOf(NOVEMBER),
                                self.ValueOf(DECEMBER),
                            ]
                        )
                    )

                elif alt11 == 2:

                    pass
                    self._state.following.append(self.FOLLOW_months_in_monthspec474)
                    self.months()

                    self._state.following.pop()

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #10
0
    def monthspec(self, ):

        try:
            try:

                pass

                alt11 = 2
                LA11_0 = self.input.LA(1)

                if (LA11_0 == MONTH):
                    alt11 = 1
                elif ((JANUARY <= LA11_0 <= DECEMBER)):
                    alt11 = 2
                else:
                    nvae = NoViableAltException("", 11, 0, self.input)

                    raise nvae

                if alt11 == 1:

                    pass
                    self.match(self.input, MONTH,
                               self.FOLLOW_MONTH_in_monthspec459)

                    self.month_set = self.month_set.union(
                        set([
                            self.ValueOf(JANUARY),
                            self.ValueOf(FEBRUARY),
                            self.ValueOf(MARCH),
                            self.ValueOf(APRIL),
                            self.ValueOf(MAY),
                            self.ValueOf(JUNE),
                            self.ValueOf(JULY),
                            self.ValueOf(AUGUST),
                            self.ValueOf(SEPTEMBER),
                            self.ValueOf(OCTOBER),
                            self.ValueOf(NOVEMBER),
                            self.ValueOf(DECEMBER)
                        ]))

                elif alt11 == 2:

                    pass
                    self._state.following.append(
                        self.FOLLOW_months_in_monthspec469)
                    self.months()

                    self._state.following.pop()

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #11
0
    def quarterspec(self, ):

        try:
            try:

                pass

                alt13 = 2
                LA13_0 = self.input.LA(1)

                if (LA13_0 == QUARTER):
                    alt13 = 1
                elif ((FIRST <= LA13_0 <= THIRD)):
                    alt13 = 2
                else:
                    nvae = NoViableAltException("", 13, 0, self.input)

                    raise nvae

                if alt13 == 1:

                    pass
                    self.match(self.input, QUARTER,
                               self.FOLLOW_QUARTER_in_quarterspec583)

                    self.month_set = self.month_set.union(
                        set([
                            self.ValueOf(JANUARY),
                            self.ValueOf(APRIL),
                            self.ValueOf(JULY),
                            self.ValueOf(OCTOBER)
                        ]))

                elif alt13 == 2:

                    pass

                    pass
                    self._state.following.append(
                        self.FOLLOW_quarter_ordinals_in_quarterspec595)
                    self.quarter_ordinals()

                    self._state.following.pop()
                    self.match(self.input, MONTH,
                               self.FOLLOW_MONTH_in_quarterspec597)
                    self.match(self.input, OF,
                               self.FOLLOW_OF_in_quarterspec599)
                    self.match(self.input, QUARTER,
                               self.FOLLOW_QUARTER_in_quarterspec601)

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #12
0
    def monthspec(self, ):

        try:
            try:
                # borg/borgcron/py/Groc.g:169:3: ( ( MONTH | months ) )
                # borg/borgcron/py/Groc.g:169:5: ( MONTH | months )
                pass 
                # borg/borgcron/py/Groc.g:169:5: ( MONTH | months )
                alt11 = 2
                LA11_0 = self.input.LA(1)

                if (LA11_0 == MONTH) :
                    alt11 = 1
                elif ((JANUARY <= LA11_0 <= DECEMBER)) :
                    alt11 = 2
                else:
                    nvae = NoViableAltException("", 11, 0, self.input)

                    raise nvae

                if alt11 == 1:
                    # borg/borgcron/py/Groc.g:169:7: MONTH
                    pass 
                    self.match(self.input, MONTH, self.FOLLOW_MONTH_in_monthspec459)
                    #action start
                                 
                    self.month_set = self.month_set.union(set([
                        self.ValueOf(JANUARY), self.ValueOf(FEBRUARY), self.ValueOf(MARCH),
                        self.ValueOf(APRIL), self.ValueOf(MAY), self.ValueOf(JUNE),
                        self.ValueOf(JULY), self.ValueOf(AUGUST), self.ValueOf(SEPTEMBER),
                        self.ValueOf(OCTOBER), self.ValueOf(NOVEMBER),
                        self.ValueOf(DECEMBER)]))
                          
                    #action end


                elif alt11 == 2:
                    # borg/borgcron/py/Groc.g:177:7: months
                    pass 
                    self._state.following.append(self.FOLLOW_months_in_monthspec469)
                    self.months()

                    self._state.following.pop()







            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 
Example #13
0
    def quarterspec(self, ):

        try:
            try:
                pass
                alt10 = 2
                LA10_0 = self.input.LA(1)

                if (LA10_0 == QUARTER) :
                    alt10 = 1
                elif ((FIRST <= LA10_0 <= THIRD)) :
                    alt10 = 2
                else:
                    nvae = NoViableAltException("", 10, 0, self.input)

                    raise nvae

                if alt10 == 1:
                    pass
                    self.match(self.input, QUARTER, self.FOLLOW_QUARTER_in_quarterspec497)

                    self.month_set = self.month_set.union(set([
                        self.ValueOf(JANUARY), self.ValueOf(APRIL), self.ValueOf(JULY),
                        self.ValueOf(OCTOBER)]))


                elif alt10 == 2:
                    pass
                    pass
                    self._state.following.append(self.FOLLOW_quarter_ordinals_in_quarterspec509)
                    self.quarter_ordinals()

                    self._state.following.pop()
                    self.match(self.input, MONTH, self.FOLLOW_MONTH_in_quarterspec511)
                    self.match(self.input, OF, self.FOLLOW_OF_in_quarterspec513)
                    self.match(self.input, QUARTER, self.FOLLOW_QUARTER_in_quarterspec515)










            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #14
0
    def __init__(self, input, state=None):
        if state is None:
            state = RecognizerSharedState()

        Parser.__init__(self, input, state)

        self.dfa3 = self.DFA3(self,
                              3,
                              eot=self.DFA3_eot,
                              eof=self.DFA3_eof,
                              min=self.DFA3_min,
                              max=self.DFA3_max,
                              accept=self.DFA3_accept,
                              special=self.DFA3_special,
                              transition=self.DFA3_transition)

        self.ordinal_set = set()
        self.weekday_set = set()
        self.month_set = set()
        self.time_string = ''
        self.interval_mins = 0
        self.period_string = ''
Example #15
0
    def combineFollows(self, exact):
        followSet = set()
        for idx, localFollowSet in reversed(list(enumerate(self._state.following))):
            followSet |= localFollowSet
            if exact:
                # can we see end of rule?
                if EOR_TOKEN_TYPE in localFollowSet:
                    # Only leave EOR in set if at top (start rule); this lets
                    # us know if have to include follow(start rule); i.e., EOF
                    if idx > 0:
                        followSet.remove(EOR_TOKEN_TYPE)

                else:
                    # can't see end of rule, quit
                    break

        return followSet
Example #16
0
    def combineFollows(self, exact):
        followSet = set()
        for idx, localFollowSet in reversed(list(enumerate(self._state.following))):
            followSet |= localFollowSet
            if exact:
                # can we see end of rule?
                if EOR_TOKEN_TYPE in localFollowSet:
                    # Only leave EOR in set if at top (start rule); this lets
                    # us know if have to include follow(start rule); i.e., EOF
                    if idx > 0:
                        followSet.remove(EOR_TOKEN_TYPE)
                        
                else:
                    # can't see end of rule, quit
                    break

        return followSet
Example #17
0
    def mismatchIsMissingToken(self, input, follow):
        if follow is None:
            # we have no information about the follow; we can only consume
            # a single token and hope for the best
            return False
        
        # compute what can follow this grammar element reference
        if EOR_TOKEN_TYPE in follow:
            if len(self._state.following) > 0:
                # remove EOR if we're not the start symbol
                follow = follow - set([EOR_TOKEN_TYPE])

            viableTokensFollowingThisRule = self.computeContextSensitiveRuleFOLLOW()
            follow = follow | viableTokensFollowingThisRule

        # if current token is consistent with what could come after set
        # then we know we're missing a token; error recovery is free to
        # "insert" the missing token
        if input.LA(1) in follow or EOR_TOKEN_TYPE in follow:
            return True

        return False
Example #18
0
    def mismatchIsMissingToken(self, input, follow):
        if follow is None:
            # we have no information about the follow; we can only consume
            # a single token and hope for the best
            return False

        # compute what can follow this grammar element reference
        if EOR_TOKEN_TYPE in follow:
            viableTokensFollowingThisRule = self.computeContextSensitiveRuleFOLLOW()
            follow = follow | viableTokensFollowingThisRule

            if len(self._state.following) > 0:
                # remove EOR if we're not the start symbol
                follow = follow - set([EOR_TOKEN_TYPE])

        # if current token is consistent with what could come after set
        # then we know we're missing a token; error recovery is free to
        # "insert" the missing token
        if input.LA(1) in follow or EOR_TOKEN_TYPE in follow:
            return True

        return False
Example #19
0
    def month_of_quarter_ordinal(self, ):

        offset = None

        try:
            try:
                # borg/borgcron/py/Groc.g:203:3: (offset= ( FIRST | SECOND | THIRD ) )
                # borg/borgcron/py/Groc.g:203:5: offset= ( FIRST | SECOND | THIRD )
                pass
                offset = self.input.LT(1)
                if (FIRST <= self.input.LA(1) <= THIRD):
                    self.input.consume()
                    self._state.errorRecovery = False

                else:
                    mse = MismatchedSetException(None, self.input)
                    raise mse

                #action start

                jOffset = self.ValueOf(offset.type) - 1
                self.month_set = self.month_set.union(
                    set([
                        jOffset + self.ValueOf(JANUARY),
                        jOffset + self.ValueOf(APRIL),
                        jOffset + self.ValueOf(JULY),
                        jOffset + self.ValueOf(OCTOBER)
                    ]))
                #action end

            except RecognitionException as re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #20
0
    def weekdays(self, ):

        try:
            try:
                pass
                alt7 = 2
                LA7_0 = self.input.LA(1)

                if (LA7_0 == DAY):
                    alt7 = 1
                elif ((MONDAY <= LA7_0 <= SUNDAY)):
                    alt7 = 2
                else:
                    nvae = NoViableAltException("", 7, 0, self.input)

                    raise nvae

                if alt7 == 1:
                    pass
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays280)

                    self.weekday_set = set([
                        self.ValueOf(SUNDAY),
                        self.ValueOf(MONDAY),
                        self.ValueOf(TUESDAY),
                        self.ValueOf(WEDNESDAY),
                        self.ValueOf(THURSDAY),
                        self.ValueOf(FRIDAY),
                        self.ValueOf(SATURDAY),
                        self.ValueOf(SUNDAY)
                    ])

                elif alt7 == 2:
                    pass
                    pass
                    self._state.following.append(
                        self.FOLLOW_weekday_in_weekdays288)
                    self.weekday()

                    self._state.following.pop()
                    while True:
                        alt6 = 2
                        LA6_0 = self.input.LA(1)

                        if (LA6_0 == COMMA):
                            alt6 = 1

                        if alt6 == 1:
                            pass
                            self.match(self.input, COMMA,
                                       self.FOLLOW_COMMA_in_weekdays291)
                            self._state.following.append(
                                self.FOLLOW_weekday_in_weekdays293)
                            self.weekday()

                            self._state.following.pop()

                        else:
                            break

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #21
0
    def weekdays(self, ):

        try:
            try:

                pass

                alt10 = 2
                LA10_0 = self.input.LA(1)

                if (LA10_0 == DAY):
                    alt10 = 1
                elif ((MONDAY <= LA10_0 <= SUNDAY)):
                    alt10 = 2
                else:
                    nvae = NoViableAltException("", 10, 0, self.input)

                    raise nvae

                if alt10 == 1:

                    pass
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays365)

                    if self.ordinal_set:

                        self.monthday_set = self.ordinal_set
                        self.ordinal_set = set()
                    else:
                        self.ordinal_set = self.ordinal_set.union(allOrdinals)
                        self.weekday_set = set([
                            self.ValueOf(SUNDAY),
                            self.ValueOf(MONDAY),
                            self.ValueOf(TUESDAY),
                            self.ValueOf(WEDNESDAY),
                            self.ValueOf(THURSDAY),
                            self.ValueOf(FRIDAY),
                            self.ValueOf(SATURDAY),
                            self.ValueOf(SUNDAY)
                        ])

                elif alt10 == 2:

                    pass

                    pass
                    self._state.following.append(
                        self.FOLLOW_weekday_in_weekdays373)
                    self.weekday()

                    self._state.following.pop()

                    while True:
                        alt9 = 2
                        LA9_0 = self.input.LA(1)

                        if (LA9_0 == COMMA):
                            alt9 = 1

                        if alt9 == 1:

                            pass
                            self.match(self.input, COMMA,
                                       self.FOLLOW_COMMA_in_weekdays376)
                            self._state.following.append(
                                self.FOLLOW_weekday_in_weekdays378)
                            self.weekday()

                            self._state.following.pop()

                        else:
                            break

                    if not self.ordinal_set:
                        self.ordinal_set = self.ordinal_set.union(allOrdinals)

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #22
0
    def specifictime(self, ):

        TIME1 = None

        try:
            try:
                # borg/borgcron/py/Groc.g:97:3: ( ( ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME ) )
                # borg/borgcron/py/Groc.g:97:5: ( ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME )
                pass 
                # borg/borgcron/py/Groc.g:97:5: ( ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME )
                # borg/borgcron/py/Groc.g:97:7: ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME
                pass 
                # borg/borgcron/py/Groc.g:97:7: ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) )
                alt4 = 2
                alt4 = self.dfa4.predict(self.input)
                if alt4 == 1:
                    # borg/borgcron/py/Groc.g:97:8: ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) )
                    pass 
                    # borg/borgcron/py/Groc.g:97:8: ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) )
                    # borg/borgcron/py/Groc.g:97:10: ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec )
                    pass 
                    # borg/borgcron/py/Groc.g:97:10: ( ( ordinals weekdays ) | monthdays )
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

                    if (LA2_0 == EVERY or (FIRST <= LA2_0 <= FOURTH_OR_FIFTH)) :
                        alt2 = 1
                    elif ((DIGIT <= LA2_0 <= DIGITS)) :
                        alt2 = 2
                    else:
                        nvae = NoViableAltException("", 2, 0, self.input)

                        raise nvae

                    if alt2 == 1:
                        # borg/borgcron/py/Groc.g:97:11: ( ordinals weekdays )
                        pass 
                        # borg/borgcron/py/Groc.g:97:11: ( ordinals weekdays )
                        # borg/borgcron/py/Groc.g:97:12: ordinals weekdays
                        pass 
                        self._state.following.append(self.FOLLOW_ordinals_in_specifictime72)
                        self.ordinals()

                        self._state.following.pop()
                        self._state.following.append(self.FOLLOW_weekdays_in_specifictime74)
                        self.weekdays()

                        self._state.following.pop()





                    elif alt2 == 2:
                        # borg/borgcron/py/Groc.g:97:31: monthdays
                        pass 
                        self._state.following.append(self.FOLLOW_monthdays_in_specifictime77)
                        self.monthdays()

                        self._state.following.pop()



                    self.match(self.input, OF, self.FOLLOW_OF_in_specifictime80)
                    # borg/borgcron/py/Groc.g:97:45: ( monthspec | quarterspec )
                    alt3 = 2
                    LA3_0 = self.input.LA(1)

                    if ((MONTH <= LA3_0 <= DECEMBER)) :
                        alt3 = 1
                    elif ((FIRST <= LA3_0 <= THIRD) or LA3_0 == QUARTER) :
                        alt3 = 2
                    else:
                        nvae = NoViableAltException("", 3, 0, self.input)

                        raise nvae

                    if alt3 == 1:
                        # borg/borgcron/py/Groc.g:97:46: monthspec
                        pass 
                        self._state.following.append(self.FOLLOW_monthspec_in_specifictime83)
                        self.monthspec()

                        self._state.following.pop()


                    elif alt3 == 2:
                        # borg/borgcron/py/Groc.g:97:56: quarterspec
                        pass 
                        self._state.following.append(self.FOLLOW_quarterspec_in_specifictime85)
                        self.quarterspec()

                        self._state.following.pop()








                elif alt4 == 2:
                    # borg/borgcron/py/Groc.g:98:11: ( ordinals weekdays )
                    pass 
                    # borg/borgcron/py/Groc.g:98:11: ( ordinals weekdays )
                    # borg/borgcron/py/Groc.g:98:12: ordinals weekdays
                    pass 
                    self._state.following.append(self.FOLLOW_ordinals_in_specifictime101)
                    self.ordinals()

                    self._state.following.pop()
                    self._state.following.append(self.FOLLOW_weekdays_in_specifictime103)
                    self.weekdays()

                    self._state.following.pop()
                    #action start
                    self.month_set = set(range(1,13)) 
                    #action end






                TIME1=self.match(self.input, TIME, self.FOLLOW_TIME_in_specifictime117)
                #action start
                self.time_string = TIME1.text 
                #action end







            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 
Example #23
0
    def weekdays(self, ):

        try:
            try:
                pass
                alt7 = 2
                LA7_0 = self.input.LA(1)

                if (LA7_0 == DAY) :
                    alt7 = 1
                elif ((MONDAY <= LA7_0 <= SUNDAY)) :
                    alt7 = 2
                else:
                    nvae = NoViableAltException("", 7, 0, self.input)

                    raise nvae

                if alt7 == 1:
                    pass
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays280)

                    self.weekday_set = set([self.ValueOf(SUNDAY), self.ValueOf(MONDAY),
                            self.ValueOf(TUESDAY), self.ValueOf(WEDNESDAY),
                            self.ValueOf(THURSDAY), self.ValueOf(FRIDAY),
                            self.ValueOf(SATURDAY), self.ValueOf(SUNDAY)])



                elif alt7 == 2:
                    pass
                    pass
                    self._state.following.append(self.FOLLOW_weekday_in_weekdays288)
                    self.weekday()

                    self._state.following.pop()
                    while True:
                        alt6 = 2
                        LA6_0 = self.input.LA(1)

                        if (LA6_0 == COMMA) :
                            alt6 = 1


                        if alt6 == 1:
                            pass
                            self.match(self.input, COMMA, self.FOLLOW_COMMA_in_weekdays291)
                            self._state.following.append(self.FOLLOW_weekday_in_weekdays293)
                            self.weekday()

                            self._state.following.pop()


                        else:
                            break












            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #24
0
    def weekdays(self, ):

        try:
            try:


                pass

                alt10 = 2
                LA10_0 = self.input.LA(1)

                if (LA10_0 == DAY) :
                    alt10 = 1
                elif ((MONDAY <= LA10_0 <= SUNDAY)) :
                    alt10 = 2
                else:
                    nvae = NoViableAltException("", 10, 0, self.input)

                    raise nvae

                if alt10 == 1:

                    pass
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays365)


                    if self.ordinal_set:


                      self.monthday_set = self.ordinal_set
                      self.ordinal_set = set()
                    else:
                      self.ordinal_set = self.ordinal_set.union(allOrdinals)
                      self.weekday_set = set([self.ValueOf(SUNDAY), self.ValueOf(MONDAY),
                              self.ValueOf(TUESDAY), self.ValueOf(WEDNESDAY),
                              self.ValueOf(THURSDAY), self.ValueOf(FRIDAY),
                              self.ValueOf(SATURDAY), self.ValueOf(SUNDAY)])




                elif alt10 == 2:

                    pass


                    pass
                    self._state.following.append(self.FOLLOW_weekday_in_weekdays373)
                    self.weekday()

                    self._state.following.pop()

                    while True:
                        alt9 = 2
                        LA9_0 = self.input.LA(1)

                        if (LA9_0 == COMMA) :
                            alt9 = 1


                        if alt9 == 1:

                            pass
                            self.match(self.input, COMMA, self.FOLLOW_COMMA_in_weekdays376)
                            self._state.following.append(self.FOLLOW_weekday_in_weekdays378)
                            self.weekday()

                            self._state.following.pop()


                        else:
                            break




                    if not self.ordinal_set:
                      self.ordinal_set = self.ordinal_set.union(allOrdinals)












            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
    def weekdays(self,):

        try:
            try:

                pass

                alt10 = 2
                LA10_0 = self.input.LA(1)

                if LA10_0 == DAY:
                    alt10 = 1
                elif MONDAY <= LA10_0 <= SUNDAY:
                    alt10 = 2
                else:
                    nvae = NoViableAltException("", 10, 0, self.input)

                    raise nvae

                if alt10 == 1:

                    pass
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays371)

                    self.weekday_set = set(
                        [
                            self.ValueOf(SUNDAY),
                            self.ValueOf(MONDAY),
                            self.ValueOf(TUESDAY),
                            self.ValueOf(WEDNESDAY),
                            self.ValueOf(THURSDAY),
                            self.ValueOf(FRIDAY),
                            self.ValueOf(SATURDAY),
                            self.ValueOf(SUNDAY),
                        ]
                    )

                elif alt10 == 2:

                    pass

                    pass
                    self._state.following.append(self.FOLLOW_weekday_in_weekdays379)
                    self.weekday()

                    self._state.following.pop()

                    while True:
                        alt9 = 2
                        LA9_0 = self.input.LA(1)

                        if LA9_0 == COMMA:
                            alt9 = 1

                        if alt9 == 1:

                            pass
                            self.match(self.input, COMMA, self.FOLLOW_COMMA_in_weekdays382)
                            self._state.following.append(self.FOLLOW_weekday_in_weekdays384)
                            self.weekday()

                            self._state.following.pop()

                        else:
                            break

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #26
0
    def quarterspec(self, ):

        try:
            try:
                # borg/borgcron/py/Groc.g:191:3: ( ( QUARTER | ( quarter_ordinals MONTH OF QUARTER ) ) )
                # borg/borgcron/py/Groc.g:191:5: ( QUARTER | ( quarter_ordinals MONTH OF QUARTER ) )
                pass 
                # borg/borgcron/py/Groc.g:191:5: ( QUARTER | ( quarter_ordinals MONTH OF QUARTER ) )
                alt13 = 2
                LA13_0 = self.input.LA(1)

                if (LA13_0 == QUARTER) :
                    alt13 = 1
                elif ((FIRST <= LA13_0 <= THIRD)) :
                    alt13 = 2
                else:
                    nvae = NoViableAltException("", 13, 0, self.input)

                    raise nvae

                if alt13 == 1:
                    # borg/borgcron/py/Groc.g:191:7: QUARTER
                    pass 
                    self.match(self.input, QUARTER, self.FOLLOW_QUARTER_in_quarterspec583)
                    #action start
                                   
                    self.month_set = self.month_set.union(set([
                        self.ValueOf(JANUARY), self.ValueOf(APRIL), self.ValueOf(JULY),
                        self.ValueOf(OCTOBER)])) 
                    #action end


                elif alt13 == 2:
                    # borg/borgcron/py/Groc.g:195:7: ( quarter_ordinals MONTH OF QUARTER )
                    pass 
                    # borg/borgcron/py/Groc.g:195:7: ( quarter_ordinals MONTH OF QUARTER )
                    # borg/borgcron/py/Groc.g:195:9: quarter_ordinals MONTH OF QUARTER
                    pass 
                    self._state.following.append(self.FOLLOW_quarter_ordinals_in_quarterspec595)
                    self.quarter_ordinals()

                    self._state.following.pop()
                    self.match(self.input, MONTH, self.FOLLOW_MONTH_in_quarterspec597)
                    self.match(self.input, OF, self.FOLLOW_OF_in_quarterspec599)
                    self.match(self.input, QUARTER, self.FOLLOW_QUARTER_in_quarterspec601)










            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 
Example #27
0
    def specifictime(self, ):

        TIME1 = None

        try:
            try:
                # borg/borgcron/py/Groc.g:97:3: ( ( ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME ) )
                # borg/borgcron/py/Groc.g:97:5: ( ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME )
                pass
                # borg/borgcron/py/Groc.g:97:5: ( ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME )
                # borg/borgcron/py/Groc.g:97:7: ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) ) TIME
                pass
                # borg/borgcron/py/Groc.g:97:7: ( ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) ) | ( ordinals weekdays ) )
                alt4 = 2
                alt4 = self.dfa4.predict(self.input)
                if alt4 == 1:
                    # borg/borgcron/py/Groc.g:97:8: ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) )
                    pass
                    # borg/borgcron/py/Groc.g:97:8: ( ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec ) )
                    # borg/borgcron/py/Groc.g:97:10: ( ( ordinals weekdays ) | monthdays ) OF ( monthspec | quarterspec )
                    pass
                    # borg/borgcron/py/Groc.g:97:10: ( ( ordinals weekdays ) | monthdays )
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

                    if (LA2_0 == EVERY or (FIRST <= LA2_0 <= FOURTH_OR_FIFTH)):
                        alt2 = 1
                    elif ((DIGIT <= LA2_0 <= DIGITS)):
                        alt2 = 2
                    else:
                        nvae = NoViableAltException("", 2, 0, self.input)

                        raise nvae

                    if alt2 == 1:
                        # borg/borgcron/py/Groc.g:97:11: ( ordinals weekdays )
                        pass
                        # borg/borgcron/py/Groc.g:97:11: ( ordinals weekdays )
                        # borg/borgcron/py/Groc.g:97:12: ordinals weekdays
                        pass
                        self._state.following.append(
                            self.FOLLOW_ordinals_in_specifictime72)
                        self.ordinals()

                        self._state.following.pop()
                        self._state.following.append(
                            self.FOLLOW_weekdays_in_specifictime74)
                        self.weekdays()

                        self._state.following.pop()

                    elif alt2 == 2:
                        # borg/borgcron/py/Groc.g:97:31: monthdays
                        pass
                        self._state.following.append(
                            self.FOLLOW_monthdays_in_specifictime77)
                        self.monthdays()

                        self._state.following.pop()

                    self.match(self.input, OF,
                               self.FOLLOW_OF_in_specifictime80)
                    # borg/borgcron/py/Groc.g:97:45: ( monthspec | quarterspec )
                    alt3 = 2
                    LA3_0 = self.input.LA(1)

                    if ((MONTH <= LA3_0 <= DECEMBER)):
                        alt3 = 1
                    elif ((FIRST <= LA3_0 <= THIRD) or LA3_0 == QUARTER):
                        alt3 = 2
                    else:
                        nvae = NoViableAltException("", 3, 0, self.input)

                        raise nvae

                    if alt3 == 1:
                        # borg/borgcron/py/Groc.g:97:46: monthspec
                        pass
                        self._state.following.append(
                            self.FOLLOW_monthspec_in_specifictime83)
                        self.monthspec()

                        self._state.following.pop()

                    elif alt3 == 2:
                        # borg/borgcron/py/Groc.g:97:56: quarterspec
                        pass
                        self._state.following.append(
                            self.FOLLOW_quarterspec_in_specifictime85)
                        self.quarterspec()

                        self._state.following.pop()

                elif alt4 == 2:
                    # borg/borgcron/py/Groc.g:98:11: ( ordinals weekdays )
                    pass
                    # borg/borgcron/py/Groc.g:98:11: ( ordinals weekdays )
                    # borg/borgcron/py/Groc.g:98:12: ordinals weekdays
                    pass
                    self._state.following.append(
                        self.FOLLOW_ordinals_in_specifictime101)
                    self.ordinals()

                    self._state.following.pop()
                    self._state.following.append(
                        self.FOLLOW_weekdays_in_specifictime103)
                    self.weekdays()

                    self._state.following.pop()
                    #action start
                    self.month_set = set(range(1, 13))
                    #action end

                TIME1 = self.match(self.input, TIME,
                                   self.FOLLOW_TIME_in_specifictime117)
                #action start
                self.time_string = TIME1.text
                #action end

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #28
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import sys
from antlr3 import *
from antlr3.compat import set, frozenset





allOrdinals = set([1, 2, 3, 4, 5])
numOrdinals = len(allOrdinals)




HIDDEN = BaseRecognizer.HIDDEN

THIRD=12
SEPTEMBER=35
FOURTH=13
SECOND=11
WEDNESDAY=21
NOVEMBER=37
SATURDAY=24
JULY=33
Example #29
0
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import sys
from antlr3 import *
from antlr3.compat import set, frozenset

allOrdinals = set([1, 2, 3, 4, 5])
numOrdinals = len(allOrdinals)

HIDDEN = BaseRecognizer.HIDDEN

THIRD = 13
SEPTEMBER = 36
WEDNESDAY = 22
APRIL = 31
JULY = 34
DIGITS = 8
MAY = 32
OCTOBER = 37
DAY = 19
EOF = -1
MARCH = 30
Example #30
0
    def specifictime(self, ):

        TIME1 = None

        try:
            try:
                pass
                pass
                alt3 = 2
                alt3 = self.dfa3.predict(self.input)
                if alt3 == 1:
                    pass
                    pass
                    pass
                    self._state.following.append(self.FOLLOW_ordinals_in_specifictime69)
                    self.ordinals()

                    self._state.following.pop()
                    self._state.following.append(self.FOLLOW_weekdays_in_specifictime71)
                    self.weekdays()

                    self._state.following.pop()



                    self.match(self.input, OF, self.FOLLOW_OF_in_specifictime74)
                    alt2 = 2
                    LA2_0 = self.input.LA(1)

                    if ((MONTH <= LA2_0 <= DECEMBER)) :
                        alt2 = 1
                    elif ((FIRST <= LA2_0 <= THIRD) or LA2_0 == QUARTER) :
                        alt2 = 2
                    else:
                        nvae = NoViableAltException("", 2, 0, self.input)

                        raise nvae

                    if alt2 == 1:
                        pass
                        self._state.following.append(self.FOLLOW_monthspec_in_specifictime77)
                        self.monthspec()

                        self._state.following.pop()


                    elif alt2 == 2:
                        pass
                        self._state.following.append(self.FOLLOW_quarterspec_in_specifictime79)
                        self.quarterspec()

                        self._state.following.pop()








                elif alt3 == 2:
                    pass
                    pass
                    self._state.following.append(self.FOLLOW_ordinals_in_specifictime96)
                    self.ordinals()

                    self._state.following.pop()
                    self._state.following.append(self.FOLLOW_weekdays_in_specifictime98)
                    self.weekdays()

                    self._state.following.pop()
                    self.month_set = set(range(1,13))






                TIME1=self.match(self.input, TIME, self.FOLLOW_TIME_in_specifictime112)
                self.time_string = TIME1.text







            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #31
0
    def specifictime(self, ):

        TIME1 = None

        try:
            try:

                pass

                pass

                alt4 = 2
                alt4 = self.dfa4.predict(self.input)
                if alt4 == 1:

                    pass

                    pass

                    alt2 = 2
                    LA2_0 = self.input.LA(1)

                    if (LA2_0 == EVERY or (FIRST <= LA2_0 <= FOURTH_OR_FIFTH)):
                        alt2 = 1
                    elif ((DIGIT <= LA2_0 <= DIGITS)):
                        alt2 = 2
                    else:
                        nvae = NoViableAltException("", 2, 0, self.input)

                        raise nvae

                    if alt2 == 1:

                        pass

                        pass
                        self._state.following.append(
                            self.FOLLOW_ordinals_in_specifictime72)
                        self.ordinals()

                        self._state.following.pop()
                        self._state.following.append(
                            self.FOLLOW_weekdays_in_specifictime74)
                        self.weekdays()

                        self._state.following.pop()

                    elif alt2 == 2:

                        pass
                        self._state.following.append(
                            self.FOLLOW_monthdays_in_specifictime77)
                        self.monthdays()

                        self._state.following.pop()

                    self.match(self.input, OF,
                               self.FOLLOW_OF_in_specifictime80)

                    alt3 = 2
                    LA3_0 = self.input.LA(1)

                    if ((MONTH <= LA3_0 <= DECEMBER)):
                        alt3 = 1
                    elif ((FIRST <= LA3_0 <= THIRD) or LA3_0 == QUARTER):
                        alt3 = 2
                    else:
                        nvae = NoViableAltException("", 3, 0, self.input)

                        raise nvae

                    if alt3 == 1:

                        pass
                        self._state.following.append(
                            self.FOLLOW_monthspec_in_specifictime83)
                        self.monthspec()

                        self._state.following.pop()

                    elif alt3 == 2:

                        pass
                        self._state.following.append(
                            self.FOLLOW_quarterspec_in_specifictime85)
                        self.quarterspec()

                        self._state.following.pop()

                elif alt4 == 2:

                    pass

                    pass
                    self._state.following.append(
                        self.FOLLOW_ordinals_in_specifictime101)
                    self.ordinals()

                    self._state.following.pop()
                    self._state.following.append(
                        self.FOLLOW_weekdays_in_specifictime103)
                    self.weekdays()

                    self._state.following.pop()

                    self.month_set = set(range(1, 13))

                TIME1 = self.match(self.input, TIME,
                                   self.FOLLOW_TIME_in_specifictime117)

                self.time_string = TIME1.text

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #32
0
    def weekdays(self, ):

        try:
            try:
                # borg/borgcron/py/Groc.g:143:3: ( ( DAY | ( weekday ( COMMA weekday )* ) ) )
                # borg/borgcron/py/Groc.g:143:5: ( DAY | ( weekday ( COMMA weekday )* ) )
                pass
                # borg/borgcron/py/Groc.g:143:5: ( DAY | ( weekday ( COMMA weekday )* ) )
                alt10 = 2
                LA10_0 = self.input.LA(1)

                if (LA10_0 == DAY):
                    alt10 = 1
                elif ((MONDAY <= LA10_0 <= SUNDAY)):
                    alt10 = 2
                else:
                    nvae = NoViableAltException("", 10, 0, self.input)

                    raise nvae

                if alt10 == 1:
                    # borg/borgcron/py/Groc.g:143:7: DAY
                    pass
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays365)
                    #action start

                    if self.ordinal_set:
                        # <ordinal> day means <ordinal> day of the month,
                        # not every day of the <ordinal> week.
                        self.monthday_set = self.ordinal_set
                        self.ordinal_set = set()
                    else:
                        self.ordinal_set = self.ordinal_set.union(allOrdinals)
                        self.weekday_set = set([
                            self.ValueOf(SUNDAY),
                            self.ValueOf(MONDAY),
                            self.ValueOf(TUESDAY),
                            self.ValueOf(WEDNESDAY),
                            self.ValueOf(THURSDAY),
                            self.ValueOf(FRIDAY),
                            self.ValueOf(SATURDAY),
                            self.ValueOf(SUNDAY)
                        ])

                    #action end

                elif alt10 == 2:
                    # borg/borgcron/py/Groc.g:155:11: ( weekday ( COMMA weekday )* )
                    pass
                    # borg/borgcron/py/Groc.g:155:11: ( weekday ( COMMA weekday )* )
                    # borg/borgcron/py/Groc.g:155:13: weekday ( COMMA weekday )*
                    pass
                    self._state.following.append(
                        self.FOLLOW_weekday_in_weekdays373)
                    self.weekday()

                    self._state.following.pop()
                    # borg/borgcron/py/Groc.g:155:21: ( COMMA weekday )*
                    while True:  #loop9
                        alt9 = 2
                        LA9_0 = self.input.LA(1)

                        if (LA9_0 == COMMA):
                            alt9 = 1

                        if alt9 == 1:
                            # borg/borgcron/py/Groc.g:155:22: COMMA weekday
                            pass
                            self.match(self.input, COMMA,
                                       self.FOLLOW_COMMA_in_weekdays376)
                            self._state.following.append(
                                self.FOLLOW_weekday_in_weekdays378)
                            self.weekday()

                            self._state.following.pop()

                        else:
                            break  #loop9

                    #action start

                    if not self.ordinal_set:
                        self.ordinal_set = self.ordinal_set.union(allOrdinals)

                    #action end

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
Example #33
0
    def weekdays(self, ):

        try:
            try:
                # borg/borgcron/py/Groc.g:143:3: ( ( DAY | ( weekday ( COMMA weekday )* ) ) )
                # borg/borgcron/py/Groc.g:143:5: ( DAY | ( weekday ( COMMA weekday )* ) )
                pass 
                # borg/borgcron/py/Groc.g:143:5: ( DAY | ( weekday ( COMMA weekday )* ) )
                alt10 = 2
                LA10_0 = self.input.LA(1)

                if (LA10_0 == DAY) :
                    alt10 = 1
                elif ((MONDAY <= LA10_0 <= SUNDAY)) :
                    alt10 = 2
                else:
                    nvae = NoViableAltException("", 10, 0, self.input)

                    raise nvae

                if alt10 == 1:
                    # borg/borgcron/py/Groc.g:143:7: DAY
                    pass 
                    self.match(self.input, DAY, self.FOLLOW_DAY_in_weekdays365)
                    #action start
                               
                    if self.ordinal_set:
                      # <ordinal> day means <ordinal> day of the month,
                      # not every day of the <ordinal> week.
                      self.monthday_set = self.ordinal_set
                      self.ordinal_set = set()
                    else:
                      self.ordinal_set = self.ordinal_set.union(allOrdinals)
                      self.weekday_set = set([self.ValueOf(SUNDAY), self.ValueOf(MONDAY),
                              self.ValueOf(TUESDAY), self.ValueOf(WEDNESDAY),
                              self.ValueOf(THURSDAY), self.ValueOf(FRIDAY),
                              self.ValueOf(SATURDAY), self.ValueOf(SUNDAY)])
                          
                    #action end


                elif alt10 == 2:
                    # borg/borgcron/py/Groc.g:155:11: ( weekday ( COMMA weekday )* )
                    pass 
                    # borg/borgcron/py/Groc.g:155:11: ( weekday ( COMMA weekday )* )
                    # borg/borgcron/py/Groc.g:155:13: weekday ( COMMA weekday )*
                    pass 
                    self._state.following.append(self.FOLLOW_weekday_in_weekdays373)
                    self.weekday()

                    self._state.following.pop()
                    # borg/borgcron/py/Groc.g:155:21: ( COMMA weekday )*
                    while True: #loop9
                        alt9 = 2
                        LA9_0 = self.input.LA(1)

                        if (LA9_0 == COMMA) :
                            alt9 = 1


                        if alt9 == 1:
                            # borg/borgcron/py/Groc.g:155:22: COMMA weekday
                            pass 
                            self.match(self.input, COMMA, self.FOLLOW_COMMA_in_weekdays376)
                            self._state.following.append(self.FOLLOW_weekday_in_weekdays378)
                            self.weekday()

                            self._state.following.pop()


                        else:
                            break #loop9


                    #action start
                                                          
                    if not self.ordinal_set:
                      self.ordinal_set = self.ordinal_set.union(allOrdinals)
                          
                    #action end










            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 
Example #34
0
    def quarterspec(self, ):

        try:
            try:
                # borg/borgcron/py/Groc.g:191:3: ( ( QUARTER | ( quarter_ordinals MONTH OF QUARTER ) ) )
                # borg/borgcron/py/Groc.g:191:5: ( QUARTER | ( quarter_ordinals MONTH OF QUARTER ) )
                pass
                # borg/borgcron/py/Groc.g:191:5: ( QUARTER | ( quarter_ordinals MONTH OF QUARTER ) )
                alt13 = 2
                LA13_0 = self.input.LA(1)

                if (LA13_0 == QUARTER):
                    alt13 = 1
                elif ((FIRST <= LA13_0 <= THIRD)):
                    alt13 = 2
                else:
                    nvae = NoViableAltException("", 13, 0, self.input)

                    raise nvae

                if alt13 == 1:
                    # borg/borgcron/py/Groc.g:191:7: QUARTER
                    pass
                    self.match(self.input, QUARTER,
                               self.FOLLOW_QUARTER_in_quarterspec583)
                    #action start

                    self.month_set = self.month_set.union(
                        set([
                            self.ValueOf(JANUARY),
                            self.ValueOf(APRIL),
                            self.ValueOf(JULY),
                            self.ValueOf(OCTOBER)
                        ]))
                    #action end

                elif alt13 == 2:
                    # borg/borgcron/py/Groc.g:195:7: ( quarter_ordinals MONTH OF QUARTER )
                    pass
                    # borg/borgcron/py/Groc.g:195:7: ( quarter_ordinals MONTH OF QUARTER )
                    # borg/borgcron/py/Groc.g:195:9: quarter_ordinals MONTH OF QUARTER
                    pass
                    self._state.following.append(
                        self.FOLLOW_quarter_ordinals_in_quarterspec595)
                    self.quarter_ordinals()

                    self._state.following.pop()
                    self.match(self.input, MONTH,
                               self.FOLLOW_MONTH_in_quarterspec597)
                    self.match(self.input, OF,
                               self.FOLLOW_OF_in_quarterspec599)
                    self.match(self.input, QUARTER,
                               self.FOLLOW_QUARTER_in_quarterspec601)

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return
    def specifictime(self,):

        TIME1 = None

        try:
            try:

                pass

                pass

                alt4 = 2
                alt4 = self.dfa4.predict(self.input)
                if alt4 == 1:

                    pass

                    pass

                    alt2 = 2
                    LA2_0 = self.input.LA(1)

                    if LA2_0 == EVERY or (FIRST <= LA2_0 <= FOURTH_OR_FIFTH):
                        alt2 = 1
                    elif DIGIT <= LA2_0 <= DIGITS:
                        alt2 = 2
                    else:
                        nvae = NoViableAltException("", 2, 0, self.input)

                        raise nvae

                    if alt2 == 1:

                        pass

                        pass
                        self._state.following.append(self.FOLLOW_ordinals_in_specifictime72)
                        self.ordinals()

                        self._state.following.pop()
                        self._state.following.append(self.FOLLOW_weekdays_in_specifictime74)
                        self.weekdays()

                        self._state.following.pop()

                    elif alt2 == 2:

                        pass
                        self._state.following.append(self.FOLLOW_monthdays_in_specifictime77)
                        self.monthdays()

                        self._state.following.pop()

                    self.match(self.input, OF, self.FOLLOW_OF_in_specifictime80)

                    alt3 = 2
                    LA3_0 = self.input.LA(1)

                    if MONTH <= LA3_0 <= DECEMBER:
                        alt3 = 1
                    elif (FIRST <= LA3_0 <= THIRD) or LA3_0 == QUARTER:
                        alt3 = 2
                    else:
                        nvae = NoViableAltException("", 3, 0, self.input)

                        raise nvae

                    if alt3 == 1:

                        pass
                        self._state.following.append(self.FOLLOW_monthspec_in_specifictime83)
                        self.monthspec()

                        self._state.following.pop()

                    elif alt3 == 2:

                        pass
                        self._state.following.append(self.FOLLOW_quarterspec_in_specifictime85)
                        self.quarterspec()

                        self._state.following.pop()

                elif alt4 == 2:

                    pass

                    pass
                    self._state.following.append(self.FOLLOW_ordinals_in_specifictime101)
                    self.ordinals()

                    self._state.following.pop()
                    self._state.following.append(self.FOLLOW_weekdays_in_specifictime103)
                    self.weekdays()

                    self._state.following.pop()

                    self.month_set = set(range(1, 13))

                TIME1 = self.match(self.input, TIME, self.FOLLOW_TIME_in_specifictime117)

                self.time_string = TIME1.text

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return