1fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius# Copyright (c) 2002-2014, International Business Machines Corporation and
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# others. All Rights Reserved.
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  Title Casing Break Rules
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
7fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$CaseIgnorable   = [[:Mn:][:Me:][:Cf:][:Lm:][:Sk:] \u0027 \u00AD \u2019];
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru$Cased           = [[:Upper_Case:][:Lower_Case:][:Lt:]  - $CaseIgnorable];
10fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius$NotCased        = [[^ $Cased] - $CaseIgnorable];
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
12fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius!!forward;
13fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
14fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  If the iterator begins on a CaseIgnorable, advance it past it/them.
15fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  This can occur at the start-of-text, or after application of the
16fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  safe-reverse rule.
17fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
18fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius($CaseIgnorable | $NotCased)*;
19fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
20fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#   Normal exact forward rule: beginning at the start of a word
21fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#         (at a cased character), advance through the word and through
22fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#         the uncased characters following the word.
23fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
24fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius$Cased ($Cased | $CaseIgnorable)* ($NotCased | $CaseIgnorable)*;
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#  Reverse Rules
28fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius!!reverse;
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
30fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  Normal Rule, will work nearly universally, so long as there is a
31fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#    start-of-word preceding the current iteration position.
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
33fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius($NotCased | $CaseIgnorable)* ($Cased | $CaseIgnorable)* $Cased;
34fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
35fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  Short rule, will be effective only when moving to the start of text,
36fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#    with no word (cased character) preceding the current iteration position.
37fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
38fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius($NotCased | $CaseIgnorable)*;
39fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
40fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius!!safe_reverse;
41fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
42fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius# Safe Reverse: the exact forward rule must not start in the middle
43fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  of a word, so the safe reverse skips over any Cased characters,
44fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#  leaving it just before the start of a word.
45fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
46fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius($Cased | $CaseIgnorable)*;
47fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
48fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius!!safe_forward;
49fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
50fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius# Safe Forward, nothing needs to be done, the exact Reverse rules will
51fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#   always find valid boundaries from any starting position.
52fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#   Still, some rule is needed, so '.', a one character movement.
53fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius.;
54