def __core(SuperPattern, SubPattern): print("super = " + SuperPattern).replace("\n", "\\n").replace("\t", "\\t") print("sub = " + SubPattern).replace("\n", "\\n").replace("\t", "\\t") super_p = regex.do(SuperPattern, {}).extract_sm() sub_p = regex.do(SubPattern, {}).extract_sm() result = difference.do(super_p, sub_p) print "result = ", beautifier.do(difference.do( super_p, sub_p)) # .get_string(NormalizeF=False)
def snap_difference(stream, PatternDict): sm_list = snap_curly_bracketed_expression(stream, PatternDict, "difference operator", "Intersection", MinN=2, MaxN=2) return difference.do(sm_list[0], sm_list[1])
def __core(SuperPattern, SubPattern): print("super = " + SuperPattern).replace("\n", "\\n").replace("\t", "\\t") print("sub = " + SubPattern).replace("\n", "\\n").replace("\t", "\\t") super_p = regex.do(SuperPattern, {}).sm sub_p = regex.do(SubPattern, {}).sm print "result = ", difference.do(super_p, sub_p).get_string(NormalizeF=True)
def do(SM_List): """Result: A state machine that matches what is matched by one of the state machines but by no other. Formula: difference(union(All), intersection(All)) """ # Difference: It only remains in A what is not in A and B. tmp0 = union.do(SM_List) tmp1 = intersection.do(SM_List) return difference.do(tmp0, tmp1)
def do(SM_List): """Result: A state machine that matches what is matched by one of the state machines but by no other. Formula: difference(union(All), intersection(All)) """ # Difference: It only remains in A what is not in A and B. tmp0 = union.do(SM_List) tmp1 = intersection.do(SM_List) return difference.do(tmp0, tmp1)
def snap_difference(stream, PatternDict): sm_list = snap_curly_bracketed_expression(stream, PatternDict, "difference operator", "Intersection", MinN=2, MaxN=2) return difference.do(sm_list[0], sm_list[1])
def diff(A, B): return difference.do(A, B)
def not_end(P, Q): return beautifier.do(difference.do(P, anything_ending_with(Q)))
def not_begin(P, Q): return beautifier.do(difference.do(P, anything_beginning_with(Q)))
def not_in(P, Q): return beautifier.do(difference.do(P, anything_containing(Q)))
def __core(SuperPattern, SubPattern): print ("super = " + SuperPattern).replace("\n", "\\n").replace("\t", "\\t") print ("sub = " + SubPattern).replace("\n", "\\n").replace("\t", "\\t") super_p = regex.do(SuperPattern, {}).sm sub_p = regex.do(SubPattern, {}).sm print "result = ", difference.do(super_p, sub_p).get_string(NormalizeF=True)
def diff(A, B): return difference.do(A, B) def symdiff(A, B): return symmetric_difference.do([A, B])