#
# Copyright (c) 2016, International Business Machines Corporation and others. All Rights Reserved.

# file: word.txt
#
# Reference Word Break rules for intltest rbbi/RBBIMonkeyTest
#
# Note: Rule syntax and the monkey test itself are still a work in progress.
#       They are expected to change with review and the addition of support for rule tailoring.


type = word;      # one of grapheme | word | line | sentence
locale = en;

E_Base = [\u261D\u26F9\u270A-\u270D\U0001F385\U0001F3C3-\U0001F3C4\U0001F3CA-\U0001F3CB\U0001F442-\U0001F443\U0001F446-\U0001F450\U0001F466-\U0001F469\U0001F46E\U0001F470-\U0001F478\U0001F47C\U0001F481-\U0001F483\U0001F485-\U0001F487\U0001F4AA\U0001F575\U0001F590\U0001F595-\U0001F596\U0001F645-\U0001F647\U0001F64B-\U0001F64F\U0001F6A3\U0001F6B4-\U0001F6B6\U0001F6C0\U0001F918];
E_Modifier = [\U0001F3FB-\U0001F3FF];
ZWJ = [\u200D];
GAZ = [\U0001F466-\U0001F469\U0001F48B\U0001F5E8\u2764];

CR                 = [\p{Word_Break = CR}];
LF                 = [\p{Word_Break = LF}];
Newline            = [\p{Word_Break = Newline}];
Extend             = [[[\p{Word_Break = Extend}][:Block=Tags:]]-ZWJ];
Regional_Indicator = [\p{Word_Break = Regional_Indicator}];
Format             = [[\p{Word_Break = Format}]-[:Block=Tags:]];
Katakana           = [\p{Word_Break = Katakana}];
Hebrew_Letter      = [\p{Word_Break = Hebrew_Letter}];
ALetter            = [\p{Word_Break = ALetter}];
Single_Quote       = [\p{Word_Break = Single_Quote}];
Double_Quote       = [\p{Word_Break = Double_Quote}];
MidNumLet          = [\p{Word_Break = MidNumLet}];
MidLetter          = [\p{Word_Break = MidLetter}];
MidNum             = [\p{Word_Break = MidNum}];
Numeric            = [\p{Word_Break = Numeric}];
ExtendNumLet       = [\p{Word_Break = ExtendNumLet}];

#define dicitionary, with the effect being that those characters don't appear in test data.

Han            = [:Han:];
Hiragana       = [:Hiragana:];

Control        = [\p{Grapheme_Cluster_Break = Control}];
HangulSyllable = [\uac00-\ud7a3];
ComplexContext = [:LineBreak = Complex_Context:];
KanaKanji      = [Han Hiragana Katakana];
dictionaryCJK  = [KanaKanji HangulSyllable];
dictionary     = [ComplexContext dictionaryCJK];

# leave CJK scripts out of ALetterPlus
#   Tricky. Redfine a set.
#   For tailorings, if it modifies itself, do at end of sets ????
#   Tweak redefine to mean replace existing definition at its original location.
#   Insert defs without redefine just after last pre-existing def of that name.
#   Maybe drop redefine, add warning for sets defined and not used, should catch typos.

ALetter        = [ALetter - dictionary];

AHLetter       = [ALetter  Hebrew_Letter];
MidNumLetQ     = [MidNumLet  Single_Quote];
ExtFmt         = [Extend Format ZWJ];

WB3:   CR LF;
WB3a:  (Newline | CR | LF) ÷;
WB3b:  . ÷ (Newline | CR | LF);   # actually redundant? No other rule combines.
                                  # (but needed with UAX treat-as scheme.)
WB3c:   ZWJ GAZ;

WB5:    AHLetter ExtFmt* AHLetter;

# includes both WB6 and WB7
WB6:    AHLetter ExtFmt* (MidLetter | MidNumLetQ) ExtFmt*  AHLetter;

WB7a:   Hebrew_Letter ExtFmt* Single_Quote;
WB7b:   Hebrew_Letter ExtFmt* Double_Quote ExtFmt* Hebrew_Letter;   # Include WB7c

WB8:    Numeric ExtFmt* Numeric;
WB9:    AHLetter ExtFmt* Numeric;
WB10:   Numeric ExtFmt* AHLetter;

WB11:   Numeric ExtFmt* (MidNum | MidNumLetQ) ExtFmt* Numeric;    # includes WB12
WB13:   Katakana ExtFmt* Katakana;

WB13a:  (AHLetter | Numeric | Katakana | ExtendNumLet) ExtFmt* ExtendNumLet;
WB13b:  ExtendNumLet ExtFmt* (AHLetter | Numeric | Katakana);

# WB rule 13c, pairs of Regional Indicators stay unbroken.
#              Interacts with WB3c.
WB13c.1:  Regional_Indicator ExtFmt* Regional_Indicator ExtFmt* ZWJ GAZ;
WB13c.2:  Regional_Indicator ExtFmt* Regional_Indicator ExtFmt* ÷;

WB13d:  (E_Base | GAZ) ExtFmt* E_Modifier;

# Rule WB 14   Any ÷ Any
#    Interacts with WB3c, do not break between ZWJ and GAZ.
WB14.1: . ExtFmt* ZWJ GAZ;
WB14.2: . ExtFmt* ÷;

