Quentin Young 7136ee463c core: allow separators ,; after degree-style coord
Tweak the Lat/Long coordinate parser to allow coordinates of the form:

12.1049° N, 68.2296° W

The coordinate parser works by tokenizing coordinates one at a time.
Consequently it is invoked twice on user input to get latitude and then
longitude. Normally, after parsing the first coordinate, intervening
characters such as , or ; and any whitespace would be discarded from the
input before parsing the second coordinate. Prior to this patch, if the
coordinate format was in degrees followed by a sign (N is a sign in this
example), the parser would skip the bit of code that fast forwards past
any intervening separators and whitespace (, in this example). This
resulted in coordinates of this form not being accepted, because the
second parse would start with , 68.2296° W and reject this as an invalid
coordinate.

To rectify this, the bit of code that fast forwards past separators and
whitespace has been broken out from the tokenization loop and performed
as a final step after a single coordinate has been completely parsed and
validated. Doing it this way makes it independent of the state of the
tokenizer, so that the fast-forward code will always execute once a
coordinate has been successfully parsed.

I've also centralized the list of allowed separators into its own static
string; this is necessary as part of the patch but should also make
allowing additional separator characters between coordinates trivial in
the future, if needed.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2022-03-27 16:37:10 -07:00
..
2022-03-12 08:28:32 -08:00
2022-03-13 15:07:33 -07:00
2022-03-12 08:28:32 -08:00
2021-10-30 20:22:52 -07:00
2020-10-24 09:51:37 -07:00
2021-07-23 11:22:43 -07:00
2020-09-29 16:13:03 -07:00
2021-10-01 08:50:36 -07:00
2021-10-01 08:50:36 -07:00
2022-01-02 13:51:07 -08:00
2021-07-23 11:22:43 -07:00
2021-07-23 11:22:43 -07:00
2018-10-21 19:55:09 +03:00
2022-03-13 15:07:33 -07:00
2022-03-12 08:28:32 -08:00
2021-07-23 11:16:00 -07:00
2019-12-13 07:04:00 -05:00
2020-12-29 08:34:09 -08:00
2020-03-10 17:42:54 -07:00
2020-03-10 17:42:54 -07:00
2020-05-03 15:02:21 -07:00
2022-01-02 13:51:07 -08:00