| @@ -261,62 +261,99 @@ test "UTF-8 encoding" { |
| 261 | 261 | /// Unicode property names for \p{Property} matching |
| 262 | 262 | pub const UnicodeProperty = enum { |
| 263 | 263 | // General categories (short & long forms) |
| 264 | | - Letter, L, |
| 265 | | - Lowercase_Letter, Ll, |
| 266 | | - Uppercase_Letter, Lu, |
| 267 | | - Titlecase_Letter, Lt, |
| 268 | | - Modifier_Letter, Lm, |
| 269 | | - Other_Letter, Lo, |
| 270 | | - |
| 271 | | - Mark, M, |
| 272 | | - Nonspacing_Mark, Mn, |
| 273 | | - Spacing_Mark, Mc, |
| 274 | | - Enclosing_Mark, Me, |
| 275 | | - |
| 276 | | - Number, N, |
| 277 | | - Decimal_Number, Nd, |
| 278 | | - Letter_Number, Nl, |
| 279 | | - Other_Number, No, |
| 280 | | - |
| 281 | | - Punctuation, P, |
| 282 | | - Connector_Punctuation, Pc, |
| 283 | | - Dash_Punctuation, Pd, |
| 284 | | - Open_Punctuation, Ps, |
| 285 | | - Close_Punctuation, Pe, |
| 286 | | - Initial_Punctuation, Pi, |
| 287 | | - Final_Punctuation, Pf, |
| 288 | | - Other_Punctuation, Po, |
| 289 | | - |
| 290 | | - Symbol, S, |
| 291 | | - Math_Symbol, Sm, |
| 292 | | - Currency_Symbol, Sc, |
| 293 | | - Modifier_Symbol, Sk, |
| 294 | | - Other_Symbol, So, |
| 295 | | - |
| 296 | | - Separator, Z, |
| 297 | | - Space_Separator, Zs, |
| 298 | | - Line_Separator, Zl, |
| 299 | | - Paragraph_Separator, Zp, |
| 300 | | - |
| 301 | | - Other, C, |
| 302 | | - Control, Cc, |
| 303 | | - Format, Cf, |
| 304 | | - Surrogate, Cs, |
| 305 | | - Private_Use, Co, |
| 306 | | - Not_Assigned, Cn, |
| 264 | + Letter, |
| 265 | + L, |
| 266 | + Lowercase_Letter, |
| 267 | + Ll, |
| 268 | + Uppercase_Letter, |
| 269 | + Lu, |
| 270 | + Titlecase_Letter, |
| 271 | + Lt, |
| 272 | + Modifier_Letter, |
| 273 | + Lm, |
| 274 | + Other_Letter, |
| 275 | + Lo, |
| 276 | + |
| 277 | + Mark, |
| 278 | + M, |
| 279 | + Nonspacing_Mark, |
| 280 | + Mn, |
| 281 | + Spacing_Mark, |
| 282 | + Mc, |
| 283 | + Enclosing_Mark, |
| 284 | + Me, |
| 285 | + |
| 286 | + Number, |
| 287 | + N, |
| 288 | + Decimal_Number, |
| 289 | + Nd, |
| 290 | + Letter_Number, |
| 291 | + Nl, |
| 292 | + Other_Number, |
| 293 | + No, |
| 294 | + |
| 295 | + Punctuation, |
| 296 | + P, |
| 297 | + Connector_Punctuation, |
| 298 | + Pc, |
| 299 | + Dash_Punctuation, |
| 300 | + Pd, |
| 301 | + Open_Punctuation, |
| 302 | + Ps, |
| 303 | + Close_Punctuation, |
| 304 | + Pe, |
| 305 | + Initial_Punctuation, |
| 306 | + Pi, |
| 307 | + Final_Punctuation, |
| 308 | + Pf, |
| 309 | + Other_Punctuation, |
| 310 | + Po, |
| 311 | + |
| 312 | + Symbol, |
| 313 | + S, |
| 314 | + Math_Symbol, |
| 315 | + Sm, |
| 316 | + Currency_Symbol, |
| 317 | + Sc, |
| 318 | + Modifier_Symbol, |
| 319 | + Sk, |
| 320 | + Other_Symbol, |
| 321 | + So, |
| 322 | + |
| 323 | + Separator, |
| 324 | + Z, |
| 325 | + Space_Separator, |
| 326 | + Zs, |
| 327 | + Line_Separator, |
| 328 | + Zl, |
| 329 | + Paragraph_Separator, |
| 330 | + Zp, |
| 331 | + |
| 332 | + Other, |
| 333 | + C, |
| 334 | + Control, |
| 335 | + Cc, |
| 336 | + Format, |
| 337 | + Cf, |
| 338 | + Surrogate, |
| 339 | + Cs, |
| 340 | + Private_Use, |
| 341 | + Co, |
| 342 | + Not_Assigned, |
| 343 | + Cn, |
| 307 | 344 | |
| 308 | 345 | pub fn fromString(s: []const u8) ?UnicodeProperty { |
| 309 | 346 | const map = std.StaticStringMap(UnicodeProperty).initComptime(.{ |
| 310 | | - .{ "Letter", .Letter }, .{ "L", .L }, |
| 347 | + .{ "Letter", .Letter }, .{ "L", .L }, |
| 311 | 348 | .{ "Lowercase_Letter", .Lowercase_Letter }, .{ "Ll", .Ll }, |
| 312 | 349 | .{ "Uppercase_Letter", .Uppercase_Letter }, .{ "Lu", .Lu }, |
| 313 | | - .{ "Number", .Number }, .{ "N", .N }, |
| 314 | | - .{ "Decimal_Number", .Decimal_Number }, .{ "Nd", .Nd }, |
| 315 | | - .{ "Punctuation", .Punctuation }, .{ "P", .P }, |
| 316 | | - .{ "Symbol", .Symbol }, .{ "S", .S }, |
| 317 | | - .{ "Separator", .Separator }, .{ "Z", .Z }, |
| 318 | | - .{ "Space_Separator", .Space_Separator }, .{ "Zs", .Zs }, |
| 319 | | - .{ "Control", .Control }, .{ "Cc", .Cc }, |
| 350 | + .{ "Number", .Number }, .{ "N", .N }, |
| 351 | + .{ "Decimal_Number", .Decimal_Number }, .{ "Nd", .Nd }, |
| 352 | + .{ "Punctuation", .Punctuation }, .{ "P", .P }, |
| 353 | + .{ "Symbol", .Symbol }, .{ "S", .S }, |
| 354 | + .{ "Separator", .Separator }, .{ "Z", .Z }, |
| 355 | + .{ "Space_Separator", .Space_Separator }, .{ "Zs", .Zs }, |
| 356 | + .{ "Control", .Control }, .{ "Cc", .Cc }, |
| 320 | 357 | }); |
| 321 | 358 | return map.get(s); |
| 322 | 359 | } |