forked from lddubeau/saxes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle column computation over characters in the astral plane
The column numbers were reported as JavaScript string indexes. This is wrong if any astral plane character is present in the line. This commit fixes the issue. BREAKING CHANGE: The fix to column number reporting changes the meaning of the ``column`` field. If you need the old behavior of ``column`` you can use the new ``columnIndex`` field which behaves like the old ``column`` and may be useful in some contexts. Ultimately you should decide whether your application needs to know column numbers by Unicode character count or by JavaScript index. (And you need to know the difference between the two. You can see [this page](https://mathiasbynens.be/notes/javascript-unicode) for a detailed discussion of the Unicode problem in JavaScript. Note that the numbers put in the error messages that ``fail`` produce are still based on the ``column`` field and thus use the new meaning of ``column``. If you want error message that use ``columnIndex`` you may override the ``fail`` method.
- Loading branch information
Showing
4 changed files
with
74 additions
and
14 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