Ignore:
Timestamp:
Nov 29, 2010, 11:06:07 PM (9 years ago)
Author:
ksherdy
Message:

Remove '& EOF_mask' on parallel_prefix_parity method calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/JSON/json_prototype.py

    r718 r739  
    1919# - Conditionally validate JSON Unicode \u4HEXDIG and \u4HEXDIG\u4HEXDIG character escape sequences, (if \u escape sequence).
    2020#
    21 #
    22 #
    2321
    2422import bitutil
     
    9088        Translate to library function.
    9189       
    92         x y x XOR y
     90        x y | x XOR y
    9391        ------------
    94         0 0   0
    95         0 1   1
    96         1 0   1
    97         0 0   0
     92        0 0 | 0
     93        0 1 | 1
     94        1 0 | 1
     95        0 0 | 0
    9896
    9997        Let n = length(bitstream).
    10098
    101         Define Pk,i as the parity of the bit range [k-(k+2^i),k] for bit positions n >= k >= 1.
    102        
    103         Base Case: Pk,0 = bitstream at position k, for all k, n >= k >= 0.
     99        Define Pk,i as the parity of the bit range [k,(k+(2^i))-1] for each bit position k, 1 <= k <= n.
     100       
     101        Base Case: Pk,0 = bitstream at position k, for all k, n >= k >= 1.
    104102        Inductive Step: Pk,i+1 = (Pk,i << 2^i) XOR Pk,i.
    105103       
    106         Pk,ceil(log(n) denotes the parity of the bit position k, n >= k >= 0.
    107        
    108         bitstream[k] = 1 --> odd parity
    109         bitstream[k] = 0 --> even parity
     104        Pk,ceil(log(n) denotes the parity of the bit position k, n >= k >= 1.
     105       
     106        bitstream[k] = 1 => odd parity
     107        bitstream[k] = 0 => even parity
    110108        """
    111109        global lgth
     
    188186        UnescapedDQuotes = (Lex.DQuote &~ EscapeChars)
    189187       
    190         ParityMask = parallel_prefix_parity(UnescapedDQuotes) & EOF_mask # TODO - Solve EOF_mask problem
     188        ParityMask = parallel_prefix_parity(UnescapedDQuotes) # TODO - Solve EOF_mask problem, if final position is 1 then the final DQUOTE is not matched.
    191189        StringMask = ParityMask & bitutil.Advance(ParityMask)   
    192190        StringSpans = StringMask | UnescapedDQuotes
     
    413411        UnescapedDQuotes = (Lex.DQuote &~ EscapeChars)
    414412       
    415         ParityMask = parallel_prefix_parity(UnescapedDQuotes) & EOF_mask
     413        ParityMask = parallel_prefix_parity(UnescapedDQuotes)
    416414        StringMask = ParityMask & bitutil.Advance(ParityMask)   
    417415        StringSpans = StringMask | UnescapedDQuotes
     
    533531
    534532        # (3) Construct string interiors mask
    535         ParityMask = parallel_prefix_parity(UnescapedDQuotes) & EOF_mask # TODO - Solve parity EOF_mask problem
     533        ParityMask = parallel_prefix_parity(UnescapedDQuotes)
    536534        StringMask = ParityMask & bitutil.Advance(ParityMask)
    537535        StringSpans = StringMask | UnescapedDQuotes
     
    563561        EscapeChars = parse_escape(Lex, EOF_mask)
    564562        UnescapedDQuotes = (Lex.DQuote &~ EscapeChars)
    565         ParityMask = parallel_prefix_parity(UnescapedDQuotes) & EOF_mask # TODO - Solve parity EOF_mask problem
     563        ParityMask = parallel_prefix_parity(UnescapedDQuotes)
    566564        StringMask = ParityMask & bitutil.Advance(ParityMask)   
    567565        StringSpans = StringMask | UnescapedDQuotes
     
    625623
    626624#       demo_parse_escape(u8data)
    627 #       demo_parallel_prefix_parity(u8data)
     625        demo_parallel_prefix_parity(u8data)
    628626#       demo_atom_starts(u8data)
    629         demo_validate_number(u8data)
     627#       demo_validate_number(u8data)
    630628#       demo_validate_string(u8data)
    631629#       demo_validate_json_atoms(u8data)
Note: See TracChangeset for help on using the changeset viewer.