#64 New pyparsing-based query parser

Об'єднано
carlos.garcia злито 1 комітів з stefan.schmidt/pyparsing до SPIN/master 6 роки тому
Stefan Schmidt відкоментовано 6 роки тому

This replaces the manual parser with a new parser constructed with pyparsing. The parser returns a ParseResults object, which is then recursively executed by _execute_query_list. In combination with a change in named_query_parameterized, this also allows to run encapsulated queries, like this one:

macaddress(ipaddress=most_used(ipaddress));

The parser isn't fully documented yet and currently allows some constructs that aren't supposed to be accepted. Also, nested queries where the inner query produces multiple results also produce unexpected results for now.

However, our tests show no regressions, and I plan to address the remaining flaws in an upcoming pull request. We were already running late to implement this, so I decided to get this pull request out as quickly as possible.

P.S.: Error reporting for queries will also get further improvements. Currently, query mode only reports at which character an error did occur (you can test that by issuing an invalid query in query mode), but not the exact problem the parser detected. Internally issued named queries (i.e. not going through query mode) currently produce hard to read exceptions when containing errors.

This replaces the manual parser with a new parser constructed with pyparsing. The parser returns a ParseResults object, which is then recursively executed by _execute_query_list. In combination with a change in named_query_parameterized, this also allows to run encapsulated queries, like this one: macaddress(ipaddress=most_used(ipaddress)); The parser isn't fully documented yet and currently allows some constructs that aren't supposed to be accepted. Also, nested queries where the inner query produces multiple results also produce unexpected results for now. However, our tests show no regressions, and I plan to address the remaining flaws in an upcoming pull request. We were already running late to implement this, so I decided to get this pull request out as quickly as possible. P.S.: Error reporting for queries will also get further improvements. Currently, query mode only reports at which character an error did occur (you can test that by issuing an invalid query in query mode), but not the exact problem the parser detected. Internally issued named queries (i.e. not going through query mode) currently produce hard to read exceptions when containing errors.
Carlos Garcia відкоментовано 6 роки тому
Власник

This is a welcomed change. I will merge this PL and wait for improvements in another PL.

This is a welcomed change. I will merge this PL and wait for improvements in another PL.
Цей запрос було успішно влито!
Підпишіться щоб приєднатися до обговорення.
Без Мітки
Bug
Етап відсутній
Немає відповідального
2 учасників
Завантажується...
Скасувати
Зберегти
Тут ще немає жодного вмісту.