-
Notifications
You must be signed in to change notification settings - Fork 0
Regional indicators in the trie instead of if's #12
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
Conversation
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.
Pull request overview
This PR refactors the handling of Regional Indicator characters by encoding them into the trie data structure instead of using runtime if-statement checks. It also simplifies ASCII width calculation by replacing lookup tables with a conditional function.
Key changes:
- Adds a new
_Regional_Indicatorproperty type to the trie - Removes the
isRIPrefix()helper and associated runtime checks - Replaces
asciiWidthsandasciiPropertieslookup tables with anasciiWidth()function
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| width.go | Removes isRIPrefix() function and regional indicator byte-checking logic; adds property-based regional indicator handling in lookupProperties(); replaces asciiWidths table lookups with asciiWidth() function calls |
| tables.go | Replaces asciiWidths and asciiProperties lookup tables with a simple asciiWidth() function; extends propertyWidths array to include _Regional_Indicator |
| trie.go | Adds _Regional_Indicator constant; updates generated trie data to encode regional indicators as property value 0x0005 |
| width_test.go | Adds test case for single Regional Indicator character |
| tables_test.go | Adds new test file with comprehensive tests for asciiWidth() function |
| internal/gen/unicode.go | Updates Unicode data parser to identify and encode Regional Indicator characters in the trie |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5cc03af to
db31e3f
Compare
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.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9143bd0 to
cdf3b26
Compare
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.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cdf3b26 to
2748a1a
Compare
|
See e4aab45 |
Encode regional indicators into the trie instead of if’s.
Also, asciiWidth tables are too much complication, just make that a conditional.