Esempio n. 1
0
File: mode.py Progetto: xxyzzzq/quex
 def check_low_priority_outruns_high_priority_pattern(self):
     """Warn when low priority patterns may outrun high priority patterns.
     Assume that the pattern list is sorted by priority!
     """
     for high, low in self.unique_pattern_pair_iterable():
         if outrun_checker.do(high.sm, low.sm):
             c_error_message(low, high, ExitF=False, ThisComment="may outrun")
Esempio n. 2
0
 def check_low_priority_outruns_high_priority_pattern(self):
     """Warn when low priority patterns may outrun high priority patterns.
     Assume that the pattern list is sorted by priority!
     """
     for high, low in self.unique_pattern_pair_iterable():
         if outrun_checker.do(high.sm, low.sm):
             c_error_message(low, high, ExitF=False, ThisComment="may outrun")
Esempio n. 3
0
 def __core(Pattern0, Pattern1):
     print("Pattern A = " + Pattern0).replace("\n",
                                              "\\n").replace("\t", "\\t")
     print("Pattern B = " + Pattern1).replace("\n",
                                              "\\n").replace("\t", "\\t")
     sm0 = regex.do(Pattern0, {}).extract_sm()
     sm1 = regex.do(Pattern1, {}).extract_sm()
     print "claim     = ", outrun_check.do(sm0, sm1)
Esempio n. 4
0
 def check_special_incidence_outrun(self, ErrorCode):
     for high, low in self.unique_pattern_pair_iterable():
         if     high.pattern_string() not in Mode.focus \
            and low.pattern_string()  not in Mode.focus: continue
         
         elif not outrun_checker.do(high.sm, low.sm):                  
             continue
         c_error_message(high, low, ExitF=True, 
                         ThisComment  = "has lower priority but",
                         ThatComment  = "may outrun",
                         SuppressCode = ErrorCode)
Esempio n. 5
0
File: mode.py Progetto: xxyzzzq/quex
 def check_special_incidence_outrun(self, ErrorCode):
     for high, low in self.unique_pattern_pair_iterable():
         if     high.pattern_string() not in Mode.focus \
            and low.pattern_string()  not in Mode.focus: continue
         
         elif not outrun_checker.do(high.sm, low.sm):                  
             continue
         c_error_message(high, low, ExitF=True, 
                         ThisComment  = "has lower priority but",
                         ThatComment  = "may outrun",
                         SuppressCode = ErrorCode)
Esempio n. 6
0
def __outrun_check(mode, PAP):
    ReferenceSM = PAP.pattern().sm 

    for other_pap in mode.get_pattern_action_pair_list():
        sm = other_pap.pattern().sm
        # No 'commonalities' between self and self shall be checked
        if ReferenceSM.get_id() >= sm.get_id(): continue

        if outrun_checker.do(ReferenceSM, sm):
            __error_message(other_pap, PAP, ExitF=True, 
                            ThisComment="has lower priority but",
                            ThatComment="may outrun")
Esempio n. 7
0
def __outrun_investigation(mode):
    pattern_action_pair_list = mode.get_pattern_action_pair_list()
    # Sort by pattern_id
    pattern_action_pair_list.sort(key=lambda x: x.pattern().sm.get_id())
    for i, pap_i in enumerate(pattern_action_pair_list):
        sm_high = pap_i.pattern().sm
        for pap_k in islice(pattern_action_pair_list, i+1, None):
            # 'pap_k' has a higher id than 'pap_i'. Thus, it has a lower
            # priority. Check for outrun.
            sm_low = pap_k.pattern().sm
            if outrun_checker.do(sm_high, sm_low):
                file_name, line_n = pap_i.get_action_location()
                __error_message(pap_k, pap_i, ExitF=False, ThisComment="may outrun")
Esempio n. 8
0
def __outrun_check(mode, PAP):
    ReferenceSM = PAP.pattern().sm

    for other_pap in mode.get_pattern_action_pair_list():
        sm = other_pap.pattern().sm
        # No 'commonalities' between self and self shall be checked
        if ReferenceSM.get_id() >= sm.get_id(): continue

        if outrun_checker.do(ReferenceSM, sm):
            __error_message(other_pap,
                            PAP,
                            ExitF=True,
                            ThisComment="has lower priority but",
                            ThatComment="may outrun")
Esempio n. 9
0
def __outrun_investigation(mode):
    pattern_action_pair_list = mode.get_pattern_action_pair_list()
    # Sort by pattern_id
    pattern_action_pair_list.sort(key=lambda x: x.pattern().sm.get_id())
    for i, pap_i in enumerate(pattern_action_pair_list):
        sm_high = pap_i.pattern().sm
        for pap_k in islice(pattern_action_pair_list, i + 1, None):
            # 'pap_k' has a higher id than 'pap_i'. Thus, it has a lower
            # priority. Check for outrun.
            sm_low = pap_k.pattern().sm
            if outrun_checker.do(sm_high, sm_low):
                file_name, line_n = pap_i.get_action_location()
                __error_message(pap_k,
                                pap_i,
                                ExitF=False,
                                ThisComment="may outrun")
Esempio n. 10
0
 def __core(Pattern0, Pattern1):
     print ("Pattern A = " + Pattern0).replace("\n", "\\n").replace("\t", "\\t")
     print ("Pattern B = " + Pattern1).replace("\n", "\\n").replace("\t", "\\t")
     sm0 = regex.do(Pattern0, {}).sm
     sm1 = regex.do(Pattern1, {}).sm
     print "claim     = ", outrun_check.do(sm0, sm1)