Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inline.h: Macroize DFA for isFOO_UTF8_CHAR()
There are currently three functions for variants of finding if the next few bytes of a string form a proper UTF-8 encoded character of some ilk. The main code for each is identical to the others, except for the table that drives it. This commit makes that code a macro that takes arguments to customize its behavior sufficiently for current and forseeable needs. This makes it easier to keep the varieties in sync with each other with future changes. The macro has three exit points: 1) successful parsing 2) unsuccessful parsing 3) succesful parsing as far as it went, but the input was exhausted before reaching a full character. What to do for each of these eventualities is passed to the macro. This is a change in behavior in which 2) and 3) were not distinguished from each other. This actually leads to fewer tests in some situations, and future commits using this DFA for other purposes will take advantage of it.
- Loading branch information
1 parent
5e6bbd5
commit fb3a1b5
Showing
1 changed file
with
114 additions
and
60 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