Lines Matching refs:code_point
78 def fill_attribute(code_point, fields): argument
85 UNICODE_ATTRIBUTES[code_point] = {
144 for code_point in range(
147 fill_attribute(code_point, fields)
180 for code_point in range(int(start, 16), int(end, 16)+1):
182 if code_point in DERIVED_CORE_PROPERTIES:
183 DERIVED_CORE_PROPERTIES[code_point].append(prop)
185 DERIVED_CORE_PROPERTIES[code_point] = [prop]
213 for code_point in range(int(start, 16), int(end, 16)+1):
214 EAST_ASIAN_WIDTHS[code_point] = match.group('property')
216 def to_upper(code_point): argument
219 if (UNICODE_ATTRIBUTES[code_point]['name']
220 and UNICODE_ATTRIBUTES[code_point]['upper']):
221 return UNICODE_ATTRIBUTES[code_point]['upper']
223 return code_point
225 def to_lower(code_point): argument
228 if (UNICODE_ATTRIBUTES[code_point]['name']
229 and UNICODE_ATTRIBUTES[code_point]['lower']):
230 return UNICODE_ATTRIBUTES[code_point]['lower']
232 return code_point
234 def to_upper_turkish(code_point): argument
237 if code_point == 0x0069:
239 return to_upper(code_point)
241 def to_lower_turkish(code_point): argument
244 if code_point == 0x0049:
246 return to_lower(code_point)
248 def to_title(code_point): argument
251 if (UNICODE_ATTRIBUTES[code_point]['name']
252 and UNICODE_ATTRIBUTES[code_point]['title']):
253 return UNICODE_ATTRIBUTES[code_point]['title']
255 return code_point
257 def is_upper(code_point): argument
259 return (to_lower(code_point) != code_point
260 or (code_point in DERIVED_CORE_PROPERTIES
261 and 'Uppercase' in DERIVED_CORE_PROPERTIES[code_point]))
263 def is_lower(code_point): argument
269 return (to_upper(code_point) != code_point
271 or code_point == 0x00DF
272 or (code_point in DERIVED_CORE_PROPERTIES
273 and 'Lowercase' in DERIVED_CORE_PROPERTIES[code_point]))
275 def is_alpha(code_point): argument
277 return ((code_point in DERIVED_CORE_PROPERTIES
279 'Alphabetic' in DERIVED_CORE_PROPERTIES[code_point])
284 (UNICODE_ATTRIBUTES[code_point]['category'] == 'Nd'
285 and not (code_point >= 0x0030 and code_point <= 0x0039)))
287 def is_digit(code_point): argument
290 return (UNICODE_ATTRIBUTES[code_point]['name']
291 and UNICODE_ATTRIBUTES[code_point]['category'] == 'Nd')
302 return (code_point >= 0x0030 and code_point <= 0x0039)
304 def is_outdigit(code_point): argument
306 return (code_point >= 0x0030 and code_point <= 0x0039)
308 def is_blank(code_point): argument
310 return (code_point == 0x0009 # '\t'
312 or (UNICODE_ATTRIBUTES[code_point]['name']
313 and UNICODE_ATTRIBUTES[code_point]['category'] == 'Zs'
315 UNICODE_ATTRIBUTES[code_point]['decomposition']))
317 def is_space(code_point): argument
321 return (code_point == 0x0020 # ' '
322 or code_point == 0x000C # '\f'
323 or code_point == 0x000A # '\n'
324 or code_point == 0x000D # '\r'
325 or code_point == 0x0009 # '\t'
326 or code_point == 0x000B # '\v'
328 or (UNICODE_ATTRIBUTES[code_point]['name']
330 (UNICODE_ATTRIBUTES[code_point]['category'] in ['Zl', 'Zp']
332 (UNICODE_ATTRIBUTES[code_point]['category'] in ['Zs']
335 UNICODE_ATTRIBUTES[code_point]['decomposition']))))
337 def is_cntrl(code_point): argument
340 return (UNICODE_ATTRIBUTES[code_point]['name']
341 and (UNICODE_ATTRIBUTES[code_point]['name'] == '<control>'
343 UNICODE_ATTRIBUTES[code_point]['category'] in ['Zl', 'Zp']))
345 def is_xdigit(code_point): argument
349 return (is_digit(code_point)
350 or (code_point >= 0x0041 and code_point <= 0x0046)
351 or (code_point >= 0x0061 and code_point <= 0x0066))
362 return ((code_point >= 0x0030 and code_point <= 0x0039)
363 or (code_point >= 0x0041 and code_point <= 0x0046)
364 or (code_point >= 0x0061 and code_point <= 0x0066))
366 def is_graph(code_point): argument
369 return (UNICODE_ATTRIBUTES[code_point]['name']
370 and UNICODE_ATTRIBUTES[code_point]['name'] != '<control>'
371 and not is_space(code_point))
373 def is_print(code_point): argument
375 return (UNICODE_ATTRIBUTES[code_point]['name']
376 and UNICODE_ATTRIBUTES[code_point]['name'] != '<control>'
377 and UNICODE_ATTRIBUTES[code_point]['category'] not in ['Zl', 'Zp'])
379 def is_punct(code_point): argument
382 return (UNICODE_ATTRIBUTES[code_point]['name']
383 and UNICODE_ATTRIBUTES[code_point]['category'].startswith('P'))
387 return (is_graph(code_point)
388 and not is_alpha(code_point)
389 and not is_digit(code_point))
391 def is_combining(code_point): argument
398 return (UNICODE_ATTRIBUTES[code_point]['name']
400 UNICODE_ATTRIBUTES[code_point]['category'] in ['Mn', 'Mc', 'Me'])
402 def is_combining_level3(code_point): argument
405 return (is_combining(code_point)
407 int(UNICODE_ATTRIBUTES[code_point]['combining']) in range(0, 200))
409 def ucs_symbol(code_point): argument
411 if code_point < 0x10000:
412 return '<U{:04X}>'.format(code_point)
414 return '<U{:08X}>'.format(code_point)
427 for code_point in sorted(UNICODE_ATTRIBUTES):
430 if (to_upper(code_point) != code_point
431 and not (is_lower(code_point) or is_upper(code_point))):
435 'sym': ucs_symbol(code_point),
436 'c': code_point,
437 'uc': to_upper(code_point)})
440 if (to_lower(code_point) != code_point
441 and not (is_lower(code_point) or is_upper(code_point))):
445 'sym': ucs_symbol(code_point),
446 'c': code_point,
447 'uc': to_lower(code_point)})
450 if ((is_lower(code_point) or is_upper(code_point))
451 and not is_alpha(code_point)):
453 'sym': ucs_symbol(code_point)})
456 if (is_alpha(code_point) and is_cntrl(code_point)):
458 'sym': ucs_symbol(code_point)})
459 if (is_alpha(code_point) and is_digit(code_point)):
461 'sym': ucs_symbol(code_point)})
462 if (is_alpha(code_point) and is_punct(code_point)):
464 'sym': ucs_symbol(code_point)})
465 if (is_alpha(code_point) and is_space(code_point)):
467 'sym': ucs_symbol(code_point)})
471 if (is_space(code_point) and is_digit(code_point)):
473 'sym': ucs_symbol(code_point)})
474 if (is_space(code_point) and is_graph(code_point)):
476 'sym': ucs_symbol(code_point)})
477 if (is_space(code_point) and is_xdigit(code_point)):
479 'sym': ucs_symbol(code_point)})
483 if (is_cntrl(code_point) and is_digit(code_point)):
485 'sym': ucs_symbol(code_point)})
486 if (is_cntrl(code_point) and is_punct(code_point)):
488 'sym': ucs_symbol(code_point)})
489 if (is_cntrl(code_point) and is_graph(code_point)):
491 'sym': ucs_symbol(code_point)})
492 if (is_cntrl(code_point) and is_print(code_point)):
494 'sym': ucs_symbol(code_point)})
495 if (is_cntrl(code_point) and is_xdigit(code_point)):
497 'sym': ucs_symbol(code_point)})
501 if (is_punct(code_point) and is_digit(code_point)):
503 'sym': ucs_symbol(code_point)})
504 if (is_punct(code_point) and is_xdigit(code_point)):
506 'sym': ucs_symbol(code_point)})
507 if (is_punct(code_point) and code_point == 0x0020):
509 'sym': ucs_symbol(code_point)})
520 if (is_print(code_point)
521 and not (is_graph(code_point) or is_space(code_point))):
523 'sym': unicode_utils.ucs_symbol(code_point)})
524 if (not is_print(code_point)
525 and (is_graph(code_point) or code_point == 0x0020)):
527 'sym': unicode_utils.ucs_symbol(code_point)})