This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add qr/\b{lb}/
authorKarl Williamson <khw@cpan.org>
Mon, 18 Jan 2016 21:25:02 +0000 (14:25 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 19 Jan 2016 22:08:59 +0000 (15:08 -0700)
commit6b659339f976d014a1a53731d86cedd01f5921ec
tree852b02830e8b19bf700af95791214485d1f4e2e8
parentca8226cfa2cc0ddcc50f60505c42078df8e3b766
Add qr/\b{lb}/

This adds the final Unicode boundary type previously missing from core
Perl: the LineBreak one.  This feature is already available in the
Unicode::LineBreak module, but I've been told that there are portability
and some other issues with that module.  What's added here is a
light-weight version that is lacking the customizable features of the
module.

This implements the default Line Breaking algorithm, but with the
customizations that Unicode is expecting everybody to add, as their
test file tests for them.  In other words, this passes Unicode's fairly
extensive furnished tests, but wouldn't if it didn't include certain
customizations specified by Unicode beyond the basic algorithm.

The implementation uses a look-up table of the characters surrounding a
boundary to see if it is a suitable place to break a line.  In a few
cases, context needs to be taken into account, so there is code in
addition to the lookup table to handle those.

This should meet the needs for line breaking of many applications,
without having to load the module.

The algorithm is somewhat independent of the Unicode version, just like
the other boundary types.  Only if new rules are added, or existing ones
modified is there need to go in and change this code.  Otherwise,
running regen/mk_invlists.pl should be sufficient when a new Unicode
release is done to keep it up-to-date, again like the other Unicode
boundary types.
19 files changed:
MANIFEST
charclass_invlists.h
embed.fnc
embed.h
embedvar.h
intrpvar.h
lib/unicore/auxiliary/LBTest.txt [new file with mode: 0644]
lib/unicore/mktables
perl.c
pod/perldelta.pod
pod/perlrebackslash.pod
pod/perlunicode.pod
proto.h
regcharclass.h
regcomp.c
regcomp.h
regen/mk_invlists.pl
regexec.c
t/re/re_tests