// ===== GENERATED FILE — DO NOT EDIT(生成物禁手写,const.md §7)=====
// 源表:moonxml/src/xml_name_tables.toml(schema 1.0)
// 再生:moon run skelgen/xmlnameregen(仓根起跑;改表 → 再生 → 黄金门对拍)
// 绑定器:skelschema/xmlname_toml_gen.mbt(parse/validate/emit 三件套)
// 目标包:moonxml/src。面:XML 名字产生式区间表 + 谓词。拼装语义(Name/Letter/版本键控)手写于消费包 namecheck.mbt。

///|
/// 区间表二分查找(各 production 谓词共用;表序由 validate 断言)。
fn xmlname_range_contains(
  table : Array[(Int32, Int32)],
  code_point : Int32,
) -> Bool {
  let mut low = 0
  let mut high = table.length() - 1
  while low <= high {
    let mid = (low + high) / 2
    let (lo, hi) = table[mid]
    if code_point < lo {
      high = mid - 1
    } else if code_point > hi {
      low = mid + 1
    } else {
      return true
    }
  }
  false
}

///|
/// base_char_10 — XML 1.0 4e production [85](机械直发;DO NOT EDIT)。
let base_char_10_ranges : Array[(Int32, Int32)] = [
  (65, 90),
  (97, 122),
  (192, 214),
  (216, 246),
  (248, 255),
  (256, 305),
  (308, 318),
  (321, 328),
  (330, 382),
  (384, 451),
  (461, 496),
  (500, 501),
  (506, 535),
  (592, 680),
  (699, 705),
  (902, 902),
  (904, 906),
  (908, 908),
  (910, 929),
  (931, 974),
  (976, 982),
  (986, 986),
  (988, 988),
  (990, 990),
  (992, 992),
  (994, 1011),
  (1025, 1036),
  (1038, 1103),
  (1105, 1116),
  (1118, 1153),
  (1168, 1220),
  (1223, 1224),
  (1227, 1228),
  (1232, 1259),
  (1262, 1269),
  (1272, 1273),
  (1329, 1366),
  (1369, 1369),
  (1377, 1414),
  (1488, 1514),
  (1520, 1522),
  (1569, 1594),
  (1601, 1610),
  (1649, 1719),
  (1722, 1726),
  (1728, 1742),
  (1744, 1747),
  (1749, 1749),
  (1765, 1766),
  (2309, 2361),
  (2365, 2365),
  (2392, 2401),
  (2437, 2444),
  (2447, 2448),
  (2451, 2472),
  (2474, 2480),
  (2482, 2482),
  (2486, 2489),
  (2524, 2525),
  (2527, 2529),
  (2544, 2545),
  (2565, 2570),
  (2575, 2576),
  (2579, 2600),
  (2602, 2608),
  (2610, 2611),
  (2613, 2614),
  (2616, 2617),
  (2649, 2652),
  (2654, 2654),
  (2674, 2676),
  (2693, 2699),
  (2701, 2701),
  (2703, 2705),
  (2707, 2728),
  (2730, 2736),
  (2738, 2739),
  (2741, 2745),
  (2749, 2749),
  (2784, 2784),
  (2821, 2828),
  (2831, 2832),
  (2835, 2856),
  (2858, 2864),
  (2866, 2867),
  (2870, 2873),
  (2877, 2877),
  (2908, 2909),
  (2911, 2913),
  (2949, 2954),
  (2958, 2960),
  (2962, 2965),
  (2969, 2970),
  (2972, 2972),
  (2974, 2975),
  (2979, 2980),
  (2984, 2986),
  (2990, 2997),
  (2999, 3001),
  (3077, 3084),
  (3086, 3088),
  (3090, 3112),
  (3114, 3123),
  (3125, 3129),
  (3168, 3169),
  (3205, 3212),
  (3214, 3216),
  (3218, 3240),
  (3242, 3251),
  (3253, 3257),
  (3294, 3294),
  (3296, 3297),
  (3333, 3340),
  (3342, 3344),
  (3346, 3368),
  (3370, 3385),
  (3424, 3425),
  (3585, 3630),
  (3632, 3632),
  (3634, 3635),
  (3648, 3653),
  (3713, 3714),
  (3716, 3716),
  (3719, 3720),
  (3722, 3722),
  (3725, 3725),
  (3732, 3735),
  (3737, 3743),
  (3745, 3747),
  (3749, 3749),
  (3751, 3751),
  (3754, 3755),
  (3757, 3758),
  (3760, 3760),
  (3762, 3763),
  (3773, 3773),
  (3776, 3780),
  (3904, 3911),
  (3913, 3945),
  (4256, 4293),
  (4304, 4342),
  (4352, 4352),
  (4354, 4355),
  (4357, 4359),
  (4361, 4361),
  (4363, 4364),
  (4366, 4370),
  (4412, 4412),
  (4414, 4414),
  (4416, 4416),
  (4428, 4428),
  (4430, 4430),
  (4432, 4432),
  (4436, 4437),
  (4441, 4441),
  (4447, 4449),
  (4451, 4451),
  (4453, 4453),
  (4455, 4455),
  (4457, 4457),
  (4461, 4462),
  (4466, 4467),
  (4469, 4469),
  (4510, 4510),
  (4520, 4520),
  (4523, 4523),
  (4526, 4527),
  (4535, 4536),
  (4538, 4538),
  (4540, 4546),
  (4587, 4587),
  (4592, 4592),
  (4601, 4601),
  (7680, 7835),
  (7840, 7929),
  (7936, 7957),
  (7960, 7965),
  (7968, 8005),
  (8008, 8013),
  (8016, 8023),
  (8025, 8025),
  (8027, 8027),
  (8029, 8029),
  (8031, 8061),
  (8064, 8116),
  (8118, 8124),
  (8126, 8126),
  (8130, 8132),
  (8134, 8140),
  (8144, 8147),
  (8150, 8155),
  (8160, 8172),
  (8178, 8180),
  (8182, 8188),
  (8486, 8486),
  (8490, 8491),
  (8494, 8494),
  (8576, 8578),
  (12353, 12436),
  (12449, 12538),
  (12549, 12588),
  (44032, 55203),
]

///|
pub fn is_base_char_10(code_point : Int32) -> Bool {
  xmlname_range_contains(base_char_10_ranges, code_point)
}

///|
/// ideographic_10 — XML 1.0 4e production [86](机械直发;DO NOT EDIT)。
let ideographic_10_ranges : Array[(Int32, Int32)] = [
  (12295, 12295),
  (12321, 12329),
  (19968, 40869),
]

///|
pub fn is_ideographic_10(code_point : Int32) -> Bool {
  xmlname_range_contains(ideographic_10_ranges, code_point)
}

///|
/// combining_char_10 — XML 1.0 4e production [87](机械直发;DO NOT EDIT)。
let combining_char_10_ranges : Array[(Int32, Int32)] = [
  (768, 837),
  (864, 865),
  (1155, 1158),
  (1425, 1441),
  (1443, 1465),
  (1467, 1469),
  (1471, 1471),
  (1473, 1474),
  (1476, 1476),
  (1611, 1618),
  (1648, 1648),
  (1750, 1756),
  (1757, 1759),
  (1760, 1764),
  (1767, 1768),
  (1770, 1773),
  (2305, 2307),
  (2364, 2364),
  (2366, 2380),
  (2381, 2381),
  (2385, 2388),
  (2402, 2403),
  (2433, 2435),
  (2492, 2492),
  (2494, 2494),
  (2495, 2495),
  (2496, 2500),
  (2503, 2504),
  (2507, 2509),
  (2519, 2519),
  (2530, 2531),
  (2562, 2562),
  (2620, 2620),
  (2622, 2622),
  (2623, 2623),
  (2624, 2626),
  (2631, 2632),
  (2635, 2637),
  (2672, 2673),
  (2689, 2691),
  (2748, 2748),
  (2750, 2757),
  (2759, 2761),
  (2763, 2765),
  (2817, 2819),
  (2876, 2876),
  (2878, 2883),
  (2887, 2888),
  (2891, 2893),
  (2902, 2903),
  (2946, 2947),
  (3006, 3010),
  (3014, 3016),
  (3018, 3021),
  (3031, 3031),
  (3073, 3075),
  (3134, 3140),
  (3142, 3144),
  (3146, 3149),
  (3157, 3158),
  (3202, 3203),
  (3262, 3268),
  (3270, 3272),
  (3274, 3277),
  (3285, 3286),
  (3330, 3331),
  (3390, 3395),
  (3398, 3400),
  (3402, 3405),
  (3415, 3415),
  (3633, 3633),
  (3636, 3642),
  (3655, 3662),
  (3761, 3761),
  (3764, 3769),
  (3771, 3772),
  (3784, 3789),
  (3864, 3865),
  (3893, 3893),
  (3895, 3895),
  (3897, 3897),
  (3902, 3902),
  (3903, 3903),
  (3953, 3972),
  (3974, 3979),
  (3984, 3989),
  (3991, 3991),
  (3993, 4013),
  (4017, 4023),
  (4025, 4025),
  (8400, 8412),
  (8417, 8417),
  (12330, 12335),
  (12441, 12441),
  (12442, 12442),
]

///|
pub fn is_combining_char_10(code_point : Int32) -> Bool {
  xmlname_range_contains(combining_char_10_ranges, code_point)
}

///|
/// digit_10 — XML 1.0 4e production [88](机械直发;DO NOT EDIT)。
let digit_10_ranges : Array[(Int32, Int32)] = [
  (48, 57),
  (1632, 1641),
  (1776, 1785),
  (2406, 2415),
  (2534, 2543),
  (2662, 2671),
  (2790, 2799),
  (2918, 2927),
  (3047, 3055),
  (3174, 3183),
  (3302, 3311),
  (3430, 3439),
  (3664, 3673),
  (3792, 3801),
  (3872, 3881),
]

///|
pub fn is_digit_10(code_point : Int32) -> Bool {
  xmlname_range_contains(digit_10_ranges, code_point)
}

///|
/// extender_10 — XML 1.0 4e production [89](机械直发;DO NOT EDIT)。
let extender_10_ranges : Array[(Int32, Int32)] = [
  (183, 183),
  (720, 720),
  (721, 721),
  (903, 903),
  (1600, 1600),
  (3654, 3654),
  (3782, 3782),
  (12293, 12293),
  (12337, 12341),
  (12445, 12446),
  (12540, 12542),
]

///|
pub fn is_extender_10(code_point : Int32) -> Bool {
  xmlname_range_contains(extender_10_ranges, code_point)
}

///|
/// name_start_char_11 — XML 1.1 2e production [4](机械直发;DO NOT EDIT)。
let name_start_char_11_ranges : Array[(Int32, Int32)] = [
  (58, 58),
  (65, 90),
  (95, 95),
  (97, 122),
  (192, 214),
  (216, 246),
  (248, 767),
  (880, 893),
  (895, 8191),
  (8204, 8205),
  (8304, 8591),
  (11264, 12271),
  (12289, 55295),
  (63744, 64975),
  (65008, 65533),
  (65536, 983039),
]

///|
pub fn is_name_start_char_11(code_point : Int32) -> Bool {
  xmlname_range_contains(name_start_char_11_ranges, code_point)
}

///|
/// name_char_11 — XML 1.1 2e production [5](机械直发;DO NOT EDIT)。
let name_char_11_ranges : Array[(Int32, Int32)] = [
  (45, 45),
  (46, 46),
  (48, 57),
  (183, 183),
  (768, 879),
  (8255, 8256),
]

///|
pub fn is_name_char_11(code_point : Int32) -> Bool {
  xmlname_range_contains(name_char_11_ranges, code_point) ||
  is_name_start_char_11(code_point)
}