nkuprins opened a new pull request, #1003:
URL: https://github.com/apache/fesod/pull/1003
Related: #1000
Should be reviewed only once #1001 gets merged
## Purpose of the pull request
The second of the two PRs. This one does the refactor/cleanup. No behaviour
change.
## What's changed?
- **The match loop is written once instead of twice.** The scan used to live
in two methods: `escapeHex` located the
first valid pattern, then `processWithPatterns` located every later one.
Both carried the same match-handling code - bounds check, closing-`_` test, hex
validation, append, so any change to the rule had to be made in two places. It
is now a single loop.
- **The no-match path allocates nothing.** The `StringBuilder` is created on
the first match rather than up front, so a cell containing no `_xHHHH_` -
costs one `indexOf` scan and no allocation.
- **The offsets have names.** Each iteration derives `hexStart`,
`suffixIndex` and `patternEnd` from `PREFIX_LENGTH` and `HEX_DIGIT_COUNT`.
- **`isValidHexFast` is now `isHexDigits`**, and the lookup table has a note
on why it is not `Character.digit(c, 16)` - that method also accepts non-ASCII
digits such as `U+0663`, which OOXML never encodes.
## Checklist
- [x] I have read the [Contributor
Guide](https://fesod.apache.org/community/contribution/).
- [x] I have written the necessary doc or comment.
- [x] I have added the necessary unit tests and all cases have passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]