diff options
author | Karl Williamson <khw@cpan.org> | 2016-01-20 16:15:38 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-02-03 10:34:23 -0700 |
commit | 7e54b87f95738233dec6d22ca103db816747c518 (patch) | |
tree | f456d3661b44ca87b463ed023d1ba0383ff78198 /charclass_invlists.h | |
parent | f39ff1f37d442c1701859527bbfca27427551179 (diff) | |
download | perl-7e54b87f95738233dec6d22ca103db816747c518.tar.gz |
Use table lookup for qr/\b{wb}/
This follows the recent commits for lb and gcb, and generates a table at
regen time for Word Breaking. The result may run faster, depending on
the compiler optimization capabilities, than before, and is easier to
maintain, as it's easier to smack a new rule into the regen perl script
than it is to change the C code.
Diffstat (limited to 'charclass_invlists.h')
-rw-r--r-- | charclass_invlists.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/charclass_invlists.h b/charclass_invlists.h index 11511116e8..d533154801 100644 --- a/charclass_invlists.h +++ b/charclass_invlists.h @@ -87805,6 +87805,42 @@ static const U8 LB_table[36][36] = { /* ed */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; +#define WB_NOBREAK 0 +#define WB_BREAKABLE 1 +#define WB_hs_then_hs 2 +#define WB_Ex_or_FO_then_foo 3 +#define WB_DQ_then_HL 4 +#define WB_HL_then_DQ 6 +#define WB_LE_or_HL_then_MB_or_ML_or_SQ 8 +#define WB_MB_or_ML_or_SQ_then_LE_or_HL 10 +#define WB_MB_or_MN_or_SQ_then_NU 12 +#define WB_NU_then_MB_or_MN_or_SQ 14 + +static const U8 WB_table[19][19] = { + +/* 'Ex' stands for 'Extend'; 'hs' for 'Perl_Tailored_HSpace'; 'ed' for 'edge' */ +/* XX LE CR DQ Ex EX FO HL KA LF ML MN MB NL NU hs RI SQ ed */ +/* XX */ { 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1,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, 1, 1 }, +/* RI */ { 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1 }, +/* SQ */ { 1, 11, 1, 1, 0, 1, 0, 11, 1, 1, 1, 1, 1, 1, 13, 1, 1, 1, 1 }, +/* ed */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 } +}; + #endif /* defined(PERL_IN_REGEXEC_C) */ /* Generated from: @@ -87854,5 +87890,5 @@ static const U8 LB_table[36][36] = { * b99d791e3e9edab7a3e2016943081585b069aa9c18447b3cdf3137b97f453f7c lib/unicore/mktables * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl - * c514d55570fb9a75b62d88fed49c0bbccf1e01b83eb528b26b338734d9bcf318 regen/mk_invlists.pl + * 5774f77d07a81945b6a679ecce07ad90cdb334f3fb402ff63bdbecd2ec67da05 regen/mk_invlists.pl * ex: set ro: */ |