* lib/unigbrk/u-grapheme-breaks.h: Comment tweaks.
* lib/uniwbrk/u-wordbreaks.h: Coding style and comment tweaks.
* lib/uniwbrk/wbrktable.c: Comment tweaks.
+2021-12-28 Bruno Haible <bruno@clisp.org>
+
+ unigbrk, uniwbrk: No-op tweaks.
+ * lib/unigbrk/u-grapheme-breaks.h: Comment tweaks.
+ * lib/uniwbrk/u-wordbreaks.h: Coding style and comment tweaks.
+ * lib/uniwbrk/wbrktable.c: Comment tweaks.
+
2021-12-28 Paul Eggert <eggert@cs.ucla.edu>
perl: let caller see whether perl was found
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* This file implements section 3 "Grapheme Cluster Boundaries"
+ of Unicode Standard Annex #29 <https://www.unicode.org/reports/tr29/>. */
+
void
FUNC (const UNIT *s, size_t n, char *p)
{
-1 at the very beginning of the string. */
int last_compchar_prop = -1;
+ /* Number of consecutive regional indicator (RI) characters seen
+ immediately before the current point. */
size_t ri_count = 0;
/* Don't break inside multibyte characters. */
*p = 1;
/* else *p = 0; */
}
- /* Break everywhere (GBP999). */
+ /* Break everywhere (GB999). */
else
*p = 1;
}
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* This file implements section 4 "Word Boundaries"
+ of Unicode Standard Annex #29 <https://www.unicode.org/reports/tr29/>. */
+
void
FUNC (const UNIT *s, size_t n, char *p)
{
-1 at the very beginning of the string. */
int secondlast_compchar_prop = -1;
+ /* Number of consecutive regional indicator (RI) characters seen
+ immediately before the current point. */
size_t ri_count = 0;
/* Don't break inside multibyte characters. */
|| prop == WBP_NEWLINE))
*p = 1;
/* No break within emoji zwj sequence (WB3c). */
- else if (last_char_prop == WBP_ZWJ &&
- (prop == WBP_GAZ || prop == WBP_EBG))
+ else if (last_char_prop == WBP_ZWJ
+ && (prop == WBP_GAZ || prop == WBP_EBG))
+ /* *p = 0 */;
+ /* Ignore Format and Extend characters (WB4). */
+ else if (prop == WBP_EXTEND
+ || prop == WBP_FORMAT
+ || prop == WBP_ZWJ)
/* *p = 0 */;
- /* Ignore Format and Extend characters. */
- else if (!(prop == WBP_EXTEND || prop == WBP_FORMAT || prop == WBP_ZWJ))
+ else
{
/* No break in these situations (see UAX #29):
last_char_prop = prop;
/* Ignore Format and Extend characters, except at the
- start of the line. */
+ start of the line (WB4). */
if (last_compchar_prop < 0
|| last_compchar_prop == WBP_CR
|| last_compchar_prop == WBP_LF
last current
- (ALetter | HL) × (ALetter | HL) (WB5)
- (ALetter | HL) × Numeric (WB9)
- HL × SQ (WB7a)
- Numeric × (ALetter | HL) (WB10)
- Numeric × Numeric (WB8)
- Katakana × Katakana (WB13)
-(ALetter | HL | Numeric | Katakana) × ExtendNumLet (WB13a)
- ExtendNumLet × ExtendNumLet (WB13a)
- ExtendNumLet × (ALetter | HL | Numeric | Katakana) (WB13b)
- (E_Base | EBG) × E_Modifier (WB14)
+ (ALetter | HL) × (ALetter | HL) (WB5)
+ (ALetter | HL) × Numeric (WB9)
+ HL × SQ (WB7a)
+ Numeric × (ALetter | HL) (WB10)
+ Numeric × Numeric (WB8)
+ Katakana × Katakana (WB13)
+(ALetter | HL | Numeric | Katakana) × ExtendNumLet (WB13a)
+ ExtendNumLet × ExtendNumLet (WB13a)
+ ExtendNumLet × (ALetter | HL | Numeric | Katakana) (WB13b)
+ (E_Base | EBG) × E_Modifier (WB14)
Note that the following rules are not handled here but in the loop in u-wordbreaks.h:
- The rules need to look back or look ahead the second character (WB6, WB7, WB7b, WB7c, WB11, WB12)