| 1 | // Copyright 2015 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build ignore |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | // Class is the Unicode BiDi class. Each rune has a single class. |
| 10 | type Class uint |
| 11 | |
| 12 | const ( |
| 13 | L Class = iota // LeftToRight |
| 14 | R // RightToLeft |
| 15 | EN // EuropeanNumber |
| 16 | ES // EuropeanSeparator |
| 17 | ET // EuropeanTerminator |
| 18 | AN // ArabicNumber |
| 19 | CS // CommonSeparator |
| 20 | B // ParagraphSeparator |
| 21 | S // SegmentSeparator |
| 22 | WS // WhiteSpace |
| 23 | ON // OtherNeutral |
| 24 | BN // BoundaryNeutral |
| 25 | NSM // NonspacingMark |
| 26 | AL // ArabicLetter |
| 27 | Control // Control LRO - PDI |
| 28 | |
| 29 | numClass |
| 30 | |
| 31 | LRO // LeftToRightOverride |
| 32 | RLO // RightToLeftOverride |
| 33 | LRE // LeftToRightEmbedding |
| 34 | RLE // RightToLeftEmbedding |
| 35 | PDF // PopDirectionalFormat |
| 36 | LRI // LeftToRightIsolate |
| 37 | RLI // RightToLeftIsolate |
| 38 | FSI // FirstStrongIsolate |
| 39 | PDI // PopDirectionalIsolate |
| 40 | |
| 41 | unknownClass = ^Class(0) |
| 42 | ) |
| 43 | |
| 44 | // A trie entry has the following bits: |
| 45 | // 7..5 XOR mask for brackets |
| 46 | // 4 1: Bracket open, 0: Bracket close |
| 47 | // 3..0 Class type |
| 48 | |
| 49 | const ( |
| 50 | openMask = 0x10 |
| 51 | xorMaskShift = 5 |
| 52 | ) |