Improve main class and category assignment in Lua (#4242)
This introduces hooks for determining the main tag and categories in the
Lua scripts. Right now the functions behind the hooks are hard-coded but
will be made configurable in a follow-up PR.
The function for determining the main tag now takes semantic priorities
into account instead of going simply by alphabetic order. As a result we
can go back to determining the place ranks directly from the main tag
instead of doing heuristics over the categories. The latter caused quite
a few odd misclassifications.
Categories are still simply derived from the candidates for the main tag
with a few tag combinations blacklisted.
This also resurrects the ability to create more than one place object
for a single OSM object. This is to cater for bridges and tunnels. I had
considered just giving bridges and tunnels the priority and ignoring the
underlying highways/railways but there are [bridges that form part of an
address](https://www.openstreetmap.org/way/
122237921). The highway
entries are required for those.
Also fixes a bug in the recently introduced `is_area()` function and
reworks some of the osm2pgsql BDD tests.
First part of #4180.