Lines Matching +full:block +full:- +full:fixup
1 # -*- coding: utf-8 -*-
7 # Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
91 code[skip] = _len(code) - skip
101 def fixup(literal, flags=flags): function
105 fixup = None
107 _compile_charset(av, flags, code, fixup, fixes)
108 code[skip] = _len(code) - skip
123 code[skip] = _len(code) - skip
134 code[skip] = _len(code) - skip
141 code[skip] = _len(code) - skip
149 emit((av[0]-1)*2)
154 emit((av[0]-1)*2+1)
165 raise error, "look-behind requires fixed-width pattern"
169 code[skip] = _len(code) - skip
175 code[skip] = _len(code) - skip
195 code[skip] = _len(code) - skip
198 code[tail] = _len(code) - tail
211 emit(av-1)
214 emit(av[0]-1)
220 code[skipyes] = _len(code) - skipyes + 1
222 code[skipno] = _len(code) - skipno
224 code[skipyes] = _len(code) - skipyes + 1
228 def _compile_charset(charset, flags, code, fixup=None, fixes=None): argument
231 for op, av in _optimize_charset(charset, fixup, fixes,
256 def _optimize_charset(charset, fixup, fixes, isunicode): argument
265 if fixup:
266 i = fixup(av)
275 if fixup:
276 r = map(fixup, r)
277 if fixup and fixes:
292 # character set contains non-UCS1 character codes
295 # character set contains non-BMP character codes
296 if fixup and isunicode and op is RANGE:
300 # 10400-1044F (Deseret) and 118A0-118DF (Warang Citi).
302 ranges, fixup)
330 if q - p == 1:
333 out.append((RANGE, (p, q - 1)))
336 if fixup or len(out) < len(charset):
352 # represented by a 32-bit word sequence, consisting of one word for
355 # sequence of 256-bit chunks (8 words each).
361 # chunks of all one-bits or all zero-bits.
368 # In UCS-4 mode, the BIGCHARSET opcode still supports only subsets
375 block = 0
382 mapping[i // 256] = comps[chunk] = block
383 block += 1
386 data[0:0] = [block] + _bytes_to_codes(mapping)
391 def _fixup_range(lo, hi, ranges, fixup): argument
392 for i in map(fixup, range(lo, hi+1)):
395 if l == lo - 1:
412 s = bytes(bits).translate(_BITS_TRANS)[::-1]
413 return [_int(s[i - _CODEBITS: i], 2)
414 for i in range(len(s), 0, -_CODEBITS)]
417 # Convert block indices to word array
434 # internal: compile an info block. in the current version,
500 # add an info block
529 table = [-1] + ([0]*len(prefix))
532 while table[i+1] > 0 and prefix[i] != prefix[table[i+1]-1]:
533 table[i+1] = table[table[i+1]-1]+1
537 code[skip] = len(code) - skip
557 # compile info block
594 p.pattern.groups-1,