-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trie values should be stored with the trie to avoid possible naming conflicts, and this makes them easier to import - soon the grapheme breaker will have to import 3 of them
- Loading branch information
Showing
8 changed files
with
147 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import wasm from './wasm.js'; | ||
import UnicodeTrie from './text-unicode-trie.js'; | ||
|
||
export const Emoji = 1; | ||
export const Emoji_Presentation = 2; | ||
export const Emoji_Modifier = 3; | ||
export const Emoji_Modifier_Base = 4; | ||
|
||
// I don't know why the pointer value is stored directly in the .value here. | ||
// It must be an emscripten weirdness, so watch out in the future | ||
export const trie = new UnicodeTrie(wasm.instance.exports.emoji_trie.value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// All code based on foliojs/grapheme-breaker at time of writing | ||
import UnicodeTrie from './text-unicode-trie.js'; | ||
import wasm from './wasm.js'; | ||
|
||
// I don't know why the pointer value is stored directly in the .value here. | ||
// It must be an emscripten weirdness, so watch out in the future | ||
export const trie = new UnicodeTrie(wasm.instance.exports.grapheme_break_trie.value); | ||
|
||
export const Other = 0; | ||
export const CR = 1; | ||
export const LF = 2; | ||
export const Control = 3; | ||
export const Extend = 4; | ||
export const Regional_Indicator = 5; | ||
export const SpacingMark = 6; | ||
export const L = 7; | ||
export const V = 8; | ||
export const T = 9; | ||
export const LV = 10; | ||
export const LVT = 11; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import UnicodeTrie from './text-unicode-trie.js'; | ||
import wasm from './wasm.js'; | ||
|
||
// The following break classes are handled by the pair table | ||
// (do not delete them, they are checked during trie building) | ||
export const OP = 0; // Opening punctuation | ||
export const CL = 1; // Closing punctuation | ||
export const CP = 2; // Closing parenthesis | ||
export const QU = 3; // Ambiguous quotation | ||
export const GL = 4; // Glue | ||
export const NS = 5; // Non-starters | ||
export const EX = 6; // Exclamation/Interrogation | ||
export const SY = 7; // Symbols allowing break after | ||
export const IS = 8; // Infix separator | ||
export const PR = 9; // Prefix | ||
export const PO = 10; // Postfix | ||
export const NU = 11; // Numeric | ||
export const AL = 12; // Alphabetic | ||
export const HL = 13; // Hebrew Letter | ||
export const ID = 14; // Ideographic | ||
export const IN = 15; // Inseparable characters | ||
export const HY = 16; // Hyphen | ||
export const BA = 17; // Break after | ||
export const BB = 18; // Break before | ||
export const B2 = 19; // Break on either side (but not pair) | ||
export const ZW = 20; // Zero-width space | ||
export const CM = 21; // Combining marks | ||
export const WJ = 22; // Word joiner | ||
export const H2 = 23; // Hangul LV | ||
export const H3 = 24; // Hangul LVT | ||
export const JL = 25; // Hangul L Jamo | ||
export const JV = 26; // Hangul V Jamo | ||
export const JT = 27; // Hangul T Jamo | ||
export const RI = 28; // Regional Indicator | ||
export const EB = 29; // Emoji Base | ||
export const EM = 30; // Emoji Modifier | ||
export const ZWJ = 31; // Zero Width Joiner | ||
export const CB = 32; // Contingent break | ||
|
||
// The following break classes are not handled by the pair table | ||
export const AI = 33; // Ambiguous (Alphabetic or Ideograph) | ||
export const BK = 34; // Break (mandatory) | ||
export const CJ = 35; // Conditional Japanese Starter | ||
export const CR = 36; // Carriage return | ||
export const LF = 37; // Line feed | ||
export const NL = 38; // Next line | ||
export const SA = 39; // South-East Asian | ||
export const SG = 40; // Surrogates | ||
export const SP = 41; // Space | ||
export const XX = 42; // Unknown | ||
|
||
// I don't know why the pointer value is stored directly in the .value here. | ||
// It must be an emscripten weirdness, so watch out in the future | ||
export const trie = new UnicodeTrie(wasm.instance.exports.line_break_trie.value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import wasm from './wasm.js'; | ||
import UnicodeTrie from './text-unicode-trie.js'; | ||
|
||
export const trie = new UnicodeTrie(wasm.instance.exports.script_trie.value); |