-
-
Notifications
You must be signed in to change notification settings - Fork 4
Implementation of Unicode Bidi Algo #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| namespace Karm::Icu { | ||
|
|
||
| usize const PLANE_SIZE = 65536; // 2^16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
| import requests | ||
|
|
||
| UNICODE_MAX = 0x10FFFF | ||
| BLOCK_SIZE = 128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better naming
| @@ -0,0 +1,128 @@ | |||
| BRACKET(0x0028,0x0029,'o') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add script that generated this file
| namespace Karm::Icu { | ||
|
|
||
| test$("bidi") { | ||
| Slice<char> strip(Slice<char> row) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to somewhere else?
| testCount++; | ||
| } | ||
|
|
||
| if(testCount != 91707) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
91707 = EXPECTED_TEST_COUNT
| return isIsolateInitiator(type) or type == BidiType::PDI or type == BidiType::B or type == BidiType::S or type == BidiType::WS or type == BidiType::ON; | ||
| } | ||
|
|
||
| Rune getPairedBracket(Rune r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to ucd.cpp
| return level + 2; | ||
| }; | ||
|
|
||
| auto incrementOverflowEmbeddingCountIfOverFlowIsolateCountZero = [&]() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overkill to have this as a separate lambda?
| return levels; | ||
| } | ||
|
|
||
| inline bool removeDueToX9(BidiType c) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not super consistent with the implementation notes
| // https://unicode.org/reports/tr9/#BD13 | ||
| struct IsolatingRunSequence { | ||
| Vec<urange> levelRuns; | ||
| BidiType sos = BidiType::L; //< Start-of-sequence type (L or R) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment, spec should be enough
| // https://unicode.org/reports/tr9/#Resolving_Weak_Types | ||
| void resolveWeakTypes(MutSlice<BidiType> paragraph, IsolatingRunSequence const& isolatingRunSequence) { | ||
| // W1. Examine each nonspacing mark (NSM) in the isolating run sequence, ... | ||
| // could be an OPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
|
|
||
| BidiType applyNeutralTypesScopeChanges(BidiType type) { | ||
| // Within this scope, bidirectional types EN and AN are treated as R. | ||
| if (type == BidiType::R or type == BidiType::AN or type == BidiType::EN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to check for R
No description provided.