Changeset 3557
 Timestamp:
 Nov 13, 2013, 2:33:36 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

proto/xmlschema/parabix2_validation.py
r3220 r3557 74 74 Hex = 0 75 75 WS = 0 76 tag_closing = 0 77 cc0 = 0 78 Caret = 0 79 Dot = 0 80 P_H_sign = 0 81 E_and_e = 0 82 content_end = 0 83 Neg = 0 84 cc1 = 0 85 cc2 = 0 86 cc3 = 0 87 cc4 = 0 88 cc5 = 0 89 cc6 = 0 90 cc7 = 0 91 cc8 = 0 92 cc9 = 0 93 cc10 = 0 94 cc11 = 0 95 76 96 77 97 class Scope1 (): … … 138 158 EndTag_marks = 0 139 159 160 Content_starts = 0 140 161 Tag_closing = 0 141 162 … … 177 198 USPrice =0 178 199 shipDate =0 200 201 class Output(): 202 matches = 0 203 tem = 0 179 204 180 205 def Classify_bytes_Validate_utf8(basis_bits, lex, u8): … … 340 365 if u8_error: 341 366 error_tracker.NoteError("UTF8 error found", (u8_error)) 342 367 368 temp1 = (basis_bits.bit_0  basis_bits.bit_1) 369 temp2 = (basis_bits.bit_2 & basis_bits.bit_3) 370 temp3 = (temp2 &~ temp1) 371 temp4 = (basis_bits.bit_5  basis_bits.bit_6) 372 temp5 = (~temp4) 373 temp6 = (basis_bits.bit_6  basis_bits.bit_7) 374 temp7 = (basis_bits.bit_5  temp6) 375 temp8 = ((basis_bits.bit_4 & temp5)(~(basis_bits.bit_4) & temp7)) 376 lex.Digit = (temp3 & temp8) 377 temp9 = (basis_bits.bit_2  basis_bits.bit_3) 378 temp10 = (temp1  temp9) 379 temp11 = (basis_bits.bit_4 & temp4) 380 temp12 = (temp10  temp11) 381 temp13 = (basis_bits.bit_6 & basis_bits.bit_7) 382 temp14 = (basis_bits.bit_5  temp13) 383 temp15 = (basis_bits.bit_4 & temp14) 384 temp16 = (temp9  temp15) 385 temp17 = (basis_bits.bit_1  temp16) 386 temp18 = (basis_bits.bit_0  temp17) 387 temp19 = (temp12 &~ temp18) 388 lex.Caret = (~temp19) 389 temp20 = (basis_bits.bit_2 &~ basis_bits.bit_3) 390 temp21 = (temp20 &~ temp1) 391 temp22 = (basis_bits.bit_4 & basis_bits.bit_5) 392 temp23 = (basis_bits.bit_7 &~ basis_bits.bit_6) 393 temp24 = (temp22 & temp23) 394 lex.Neg = (temp21 & temp24) 395 temp25 = (basis_bits.bit_4  basis_bits.bit_5) 396 temp26 = (temp13 &~ temp25) 397 lex.content_end = (temp21 & temp26) 398 temp27 = (basis_bits.bit_4 &~ basis_bits.bit_5) 399 temp28 = (basis_bits.bit_6 &~ basis_bits.bit_7) 400 temp29 = (temp27 & temp28) 401 402 343 403 344 404 def Add_scope_streams(lex, scope1): … … 548 608 tag_Callouts.AttVal_spans = pablo.SpanUpTo(tag_Callouts.AttVal_starts, tag_Callouts.AttVal_ends) 549 609 610 tag_Callouts.Content_starts = STagEnds 550 611 tag_Callouts.Tag_closing = tag_Callouts.EmptyTag_marks  tag_Callouts.EndTag_marks 551 612 … … 614 675 615 676 616 def Form_Length_Group_Bitstreams(tag_Callouts): 617 618 remaining_starts = tag_Callouts.ElemName_starts 619 remaining_ends = tag_Callouts.ElemName_ends 620 temp = tag_Callouts.ElemName_starts 621 622 # Group symbols of length 1 623 temp = pablo.Advance(temp) 624 tag_Callouts.ElemName_ends_1 = temp & remaining_ends 625 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_1 626 627 # Group symbols of length 2 628 temp = pablo.Advance(temp) 629 tag_Callouts.ElemName_ends_2 = temp & remaining_ends 630 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_2 631 632 # Group symbols of length 3 633 temp = pablo.Advance(temp) 634 tag_Callouts.ElemName_ends_3 = temp & remaining_ends 635 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_3 636 637 # Group symbols of length 4 638 temp = pablo.Advance(temp) 639 tag_Callouts.ElemName_ends_4 = temp & remaining_ends 640 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_4 641 642 # Group symbols of length 5 643 temp = pablo.Advance(temp) 644 tag_Callouts.ElemName_ends_5 = temp & remaining_ends 645 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_5 646 647 # Group symbols of length 6 648 temp = pablo.Advance(temp) 649 tag_Callouts.ElemName_ends_6 = temp & remaining_ends 650 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_6 651 652 # Group symbols of length 7 653 temp = pablo.Advance(temp) 654 tag_Callouts.ElemName_ends_7 = temp & remaining_ends 655 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_7 656 657 # Group symbols of length 8 658 temp = pablo.Advance(temp) 659 tag_Callouts.ElemName_ends_8 = temp & remaining_ends 660 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_8 661 662 # Group symbols of length 9 663 temp = pablo.Advance(temp) 664 tag_Callouts.ElemName_ends_9 = temp & remaining_ends 665 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_9 666 667 # Group symbols of length 10 668 temp = pablo.Advance(temp) 669 tag_Callouts.ElemName_ends_10 = temp & remaining_ends 670 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_10 671 672 # Group symbols of length 11 673 temp = pablo.Advance(temp) 674 tag_Callouts.ElemName_ends_11 = temp & remaining_ends 675 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_11 676 677 # Group symbols of length 12 678 temp = pablo.Advance(temp) 679 tag_Callouts.ElemName_ends_12 = temp & remaining_ends 680 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_12 681 682 # Group symbols of length 13 683 temp = pablo.Advance(temp) 684 tag_Callouts.ElemName_ends_13 = temp & remaining_ends 685 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_13 686 687 # Group symbols of length 14 688 temp = pablo.Advance(temp) 689 tag_Callouts.ElemName_ends_14 = temp & remaining_ends 690 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_14 691 692 # Group symbols of length 15 693 temp = pablo.Advance(temp) 694 tag_Callouts.ElemName_ends_15 = temp & remaining_ends 695 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_15 696 697 # Group symbols of length 16 698 temp = pablo.Advance(temp) 699 tag_Callouts.ElemName_ends_16 = temp & remaining_ends 700 remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_16 701 702 # Group symbols of length 17 and longer 703 tag_Callouts.ElemName_ends_17_and_longer = remaining_ends 704 705 706 def Compute_Hash_Value_Bitstream(hash_data, basis_bits): 707 hash_data.Hash_value = basis_bits.bit_2 ^ basis_bits.bit_4 ^ basis_bits.bit_6 708 #hash_data.Hash_value = basis_bits.bit_3 ^ basis_bits.bit_5 ^ basis_bits.bit_7 709 710 def Validate_Elem_Vec(elem,basis_bits): 677 def Classify_bytes(basis_bits,lex): 711 678 temp1 = (basis_bits.bit_0  basis_bits.bit_1) 712 679 temp2 = (basis_bits.bit_2  basis_bits.bit_3) … … 715 682 temp5 = (basis_bits.bit_7 &~ basis_bits.bit_6) 716 683 temp6 = (temp5 &~ temp4) 717 elem.purchaseOrder= (temp6 &~ temp3)684 lex.cc1 = (temp6 &~ temp3) 718 685 temp7 = (basis_bits.bit_6 &~ basis_bits.bit_7) 719 686 temp8 = (temp7 &~ temp4) 720 elem.shipTo= (temp8 &~ temp3)687 lex.cc2 = (temp8 &~ temp3) 721 688 temp9 = (basis_bits.bit_6 & basis_bits.bit_7) 722 689 temp10 = (temp9 &~ temp4) 723 elem.name= (temp10 &~ temp3)690 lex.cc3 = (temp10 &~ temp3) 724 691 temp11 = (basis_bits.bit_5 &~ basis_bits.bit_4) 725 692 temp12 = (basis_bits.bit_6  basis_bits.bit_7) 726 693 temp13 = (temp11 &~ temp12) 727 elem.street= (temp13 &~ temp3)694 lex.cc4 = (temp13 &~ temp3) 728 695 temp14 = (temp11 & temp5) 729 elem.city= (temp14 &~ temp3)696 lex.cc5 = (temp14 &~ temp3) 730 697 temp15 = (temp11 & temp7) 731 elem.state= (temp15 &~ temp3)698 lex.cc6 = (temp15 &~ temp3) 732 699 temp16 = (temp11 & temp9) 733 elem.zip= (temp16 &~ temp3)700 lex.cc7 = (temp16 &~ temp3) 734 701 temp17 = (basis_bits.bit_4 &~ basis_bits.bit_5) 735 702 temp18 = (temp17 &~ temp12) 736 elem.billTo= (temp18 &~ temp3)703 lex.cc8 = (temp18 &~ temp3) 737 704 temp19 = (temp17 & temp5) 738 elem.comment= (temp19 &~ temp3)705 lex.cc9 = (temp19 &~ temp3) 739 706 temp20 = (temp17 & temp7) 740 elem.items= (temp20 &~ temp3)707 lex.cc10 = (temp20 &~ temp3) 741 708 temp21 = (temp17 & temp9) 742 elem.item = (temp21 &~ temp3) 743 temp22 = (basis_bits.bit_4 & basis_bits.bit_5) 744 temp23 = (temp22 &~ temp12) 745 elem.productName = (temp23 &~ temp3) 746 temp24 = (temp22 & temp5) 747 elem.quantity = (temp24 &~ temp3) 748 temp25 = (temp22 & temp7) 749 elem.USPrice = (temp25 &~ temp3) 750 temp26 = (temp22 & temp9) 751 elem.shipDate = (temp26 &~ temp3) 752 709 lex.cc11 = (temp21 &~ temp3) 710 temp22 = (temp4  temp12) 711 temp23 = (temp3  temp22) 712 lex.tag_closing = (~temp23) 713 714 715 def Validation_2(lex, output): 716 m0=0 717 m1=0 718 m2=0 719 m3=0 720 m4=0 721 m0=~0 722 m0 = pablo.Advance((m0 & lex.cc2)) 723 m0 = pablo.Advance((m0 & lex.cc3)) 724 m0 = pablo.Advance((m0 & lex.tag_closing)) 725 m0 = pablo.Advance((m0 & lex.cc4)) 726 m0 = (lex.tag_closing & m0) 727 if (lex.tag_closing & m0): 728 m0 = pablo.Advance((m0 & lex.tag_closing)) 729 m0 = pablo.Advance((m0 & lex.cc5)) 730 m0 = pablo.Advance((m0 & lex.tag_closing)) 731 m1 = m0 732 m1 = pablo.Advance((m1 & lex.cc6)) 733 m1 = pablo.Advance((m1 & lex.tag_closing)) 734 m0 = m1 735 m1 = m0 736 m1 = pablo.Advance((m1 & lex.cc6)) 737 m1 = pablo.Advance((m1 & lex.tag_closing)) 738 while (~m0 & m1): 739 m0 = (m0  m1) 740 m1 = pablo.Advance((m1 & lex.cc6)) 741 m1 = pablo.Advance((m1 & lex.tag_closing)) 742 m3 = m0 743 m3 = pablo.Advance((m3 & lex.cc7)) 744 m3 = pablo.Advance((m3 & lex.tag_closing)) 745 m0 = m3 746 m3 = m0 747 m3 = pablo.Advance((m3 & lex.cc7)) 748 m3 = pablo.Advance((m3 & lex.tag_closing)) 749 while (~m0 & m3): 750 m0 = (m0  m3) 751 m3 = pablo.Advance((m3 & lex.cc7)) 752 m3 = pablo.Advance((m3 & lex.tag_closing)) 753 m0 = pablo.Advance((m0 & lex.tag_closing)) 754 output.matches = m0 755 756 def Validation_8(lex, output): 757 m0=0 758 m1=0 759 m0=~0 760 m0 = pablo.Advance((m0 & lex.cc8)) 761 m1 = m0 762 m0 = pablo.Advance((m0 & lex.cc9)) 763 m0 = pablo.Advance((m0 & lex.tag_closing)) 764 m1 = pablo.Advance((m1 & lex.cc10)) 765 m1 = pablo.Advance((m1 & lex.tag_closing)) 766 m0 = (m0  m1) 767 m0 = pablo.Advance((m0 & lex.tag_closing)) 768 output.matches = m0 ^ lex.cc8 769 770 def Validation_11(lex, output): 771 m0=0 772 m0=~0 773 m0 = pablo.Advance((m0 & lex.cc11)) 774 m0 = pablo.Advance((m0 & lex.cc2)) 775 m0 = pablo.Advance((m0 & lex.tag_closing)) 776 m0 = pablo.Advance((m0 & lex.cc8)) 777 m0 = pablo.Advance((m0 & lex.tag_closing)) 778 m0 = pablo.Advance((m0 & lex.tag_closing)) 779 output.matches = m0 ^ lex.cc11 780 781 def Validate_content_6(lex, output): 782 m0=0 783 m1=0 784 m2=0 785 m3=0 786 m4=0 787 m5=0 788 m6=0 789 m7=0 790 m0=~0 791 m1 = m0 792 m0 = (m0 & ~pablo.Advance(lex.Caret)) 793 m1 = pablo.Advance((m1 & lex.content_end)) 794 m0 = (m0  m1) 795 m2 = m0 796 m2 = pablo.Advance((m2 & lex.Digit)) 797 m2 = pablo.Advance((m2 & lex.Digit)) 798 m2 = pablo.Advance((m2 & lex.Digit)) 799 m0 = m2 800 m0 = pablo.Advance((m0 & lex.Neg)) 801 m4 = m0 802 m4 = pablo.Advance((m4 & lex.Digit)) 803 m4 = pablo.Advance((m4 & lex.Digit)) 804 m4 = pablo.Advance((m4 & lex.Digit)) 805 m0 = m4 806 m0 = pablo.Advance((m0 & lex.Neg)) 807 m6 = m0 808 m6 = pablo.Advance((m6 & lex.Digit)) 809 m6 = pablo.Advance((m6 & lex.Digit)) 810 m6 = pablo.Advance((m6 & lex.Digit)) 811 m6 = pablo.Advance((m6 & lex.Digit)) 812 m0 = m6 813 m0 = pablo.Advance((m0 & lex.content_end)) 814 output.matches = m0 ^ lex.content_end 815 816 def Validate_content_9(lex, output): 817 m0=0 818 m1=0 819 m2=0 820 m3=0 821 m0=~0 822 m1 = m0 823 m0 = (m0 & ~pablo.Advance(lex.Caret)) 824 m1 = pablo.Advance((m1 & lex.content_end)) 825 m0 = (m0  m1) 826 t1 = lex.Digit 827 t2 = (pablo.Advance(t1,1) & t1) 828 t4 = (pablo.Advance(t2,2) & t2) 829 t8 = (pablo.Advance(t4,4) & t4) 830 t16 = (pablo.Advance(t8,8) & t8) 831 m0 = pablo.Advance((pablo.Advance(m0,15) & t16)) 832 m0 = pablo.Advance((m0 & lex.content_end)) 833 output.matches = m0 ^ lex.content_end 834 835 def Validate_content_10(lex, output): 836 m0=0 837 m1=0 838 m2=0 839 m3=0 840 m0=~0 841 m1 = m0 842 m0 = (m0 & ~pablo.Advance(lex.Caret)) 843 m1 = pablo.Advance((m1 & lex.content_end)) 844 m0 = (m0  m1) 845 t1 = lex.Digit 846 t2 = (pablo.Advance(t1,1) & t1) 847 t4 = (pablo.Advance(t2,2) & t2) 848 t8 = (pablo.Advance(t4,4) & t4) 849 t13 = (pablo.Advance(t8,5) & t8) 850 m0 = pablo.Advance((pablo.Advance(m0,12) & t13)) 851 m0 = pablo.Advance((m0 & lex.content_end)) 852 output.matches = m0 ^ lex.content_end 853 854 def Validate_content_7(lex, output): 855 m0=0 856 m1=0 857 m2=0 858 m3=0 859 m4=0 860 m5=0 861 m6=0 862 m7=0 863 m8=0 864 m9=0 865 m10=0 866 m11=0 867 m12=0 868 m13=0 869 m14=0 870 m15=0 871 m16=0 872 m17=0 873 m0=~0 874 m1 = m0 875 m0 = (m0 & ~pablo.Advance(lex.Caret)) 876 m1 = pablo.Advance((m1 & lex.content_end)) 877 m0 = (m0  m1) 878 m2 = m0 879 m2 = pablo.Advance((m2 & lex.P_H_sign)) 880 m0 = (m0  m2) 881 m0 = pablo.MatchStar(m0, lex.Digit) 882 m7 = m0 883 m7 = pablo.Advance((m7 & lex.Dot)) 884 m0 = (m0  m7) 885 m9 = m0 886 m9 = pablo.Advance((m9 & lex.Digit)) 887 m0 = m9 888 m0 = pablo.MatchStar(m0, lex.Digit) 889 output.tem = m9 890 temp = m0 891 m11 = m0 892 m11 = pablo.Advance((m11 & lex.E_and_e)) 893 m13 = m11 894 m13 = pablo.Advance((m13 & lex.P_H_sign)) 895 m11 = (m11  m13) 896 m16 = m11 897 m16 = pablo.Advance((m16 & lex.Digit)) 898 m11 = m16 899 m11 = pablo.MatchStar(m11, lex.Digit) 900 m0 = (m0  m11) 901 m0 = pablo.Advance((m0 & lex.content_end)) 902 output.matches = m0 903 904 def Validation_3(lex, output): 905 m0=0 906 m0=~0 907 m0 = pablo.Advance((m0 & lex.cc3)) 908 m0 = pablo.Advance((m0 & lex.tag_closing)) 909 output.matches = m0 910 911 def Validation_4(lex, output): 912 m0=0 913 m0=~0 914 m0 = pablo.Advance((m0 & lex.cc4)) 915 m0 = pablo.Advance((m0 & lex.tag_closing)) 916 output.matches = m0 917 918 def Validation_5(lex, output): 919 m0=0 920 m0=~0 921 m0 = pablo.Advance((m0 & lex.cc5)) 922 m0 = pablo.Advance((m0 & lex.tag_closing)) 923 output.matches = m0 924 925 def Validation_6(lex, output): 926 m0=0 927 m0=~0 928 m0 = pablo.Advance((m0 & lex.cc6)) 929 m0 = pablo.Advance((m0 & lex.tag_closing)) 930 output.matches = m0 931 932 def Validation_7(lex, output): 933 m0=0 934 m0=~0 935 m0 = pablo.Advance((m0 & lex.cc7)) 936 m0 = pablo.Advance((m0 & lex.tag_closing)) 937 output.matches = m0 938 939 def Validation_9(lex, output): 940 m0=0 941 m0=~0 942 m0 = pablo.Advance((m0 & lex.cc9)) 943 m0 = pablo.Advance((m0 & lex.tag_closing)) 944 output.matches = m0 945 946 def Validation_10(lex, output): 947 m0=0 948 m0=~0 949 m0 = pablo.Advance((m0 & lex.cc10)) 950 m0 = pablo.Advance((m0 & lex.tag_closing)) 951 output.matches = m0 952 953 753 954 754 955 def Main(basis_bits, lex, u8, xml_char, scope1, ctCDPI_Callouts, ref_Callouts, tag_Callouts, masks, xml_names, check_streams, hash_data): … … 779 980 Do_check_streams(marker, tag_Callouts, check_streams) 780 981 # These methods are needed to do Paralel Bitstream Based Length Sorting 781 Form_Length_Group_Bitstreams(tag_Callouts)782 783 Compute_Hash_Value_Bitstream(hash_data, basis_bits);982 # Form_Length_Group_Bitstreams(tag_Callouts) 983 984 # Compute_Hash_Value_Bitstream(hash_data, basis_bits); 784 985 785 986
Note: See TracChangeset
for help on using the changeset viewer.