Skip to content

Conversation

rogpeppe
Copy link
Contributor

Currently parseOffsets uses a regexp-based parser which is considerably
more permissive than it probably should be. It will parse almost
any string without error, even such "obviously wrong" specifications
such as bogus and ::::.

We specify the grammar somewhat more formally and rewrite
the parser so that it's not regexp-based, which allows us to give
better error messages, is arguably more understandable and will
catch user errors before we actually try to talk to Kafka.

This change is a prelude to a change that is intended to add timestamp-based
search to kt. By using a more precise grammar specification, that change
should become easier.

We also add some missing TestParseOffsets test cases to cover errors
and some other corners of the grammar.

rogpeppe and others added 2 commits August 29, 2019 16:40
Currently parseOffsets uses a regexp-based parser which is considerably
more permissive than it probably should be. It will parse almost
any string without error, even such "obviously wrong" specifications
such as `bogus` and `::::`.

We specify the grammar somewhat more formally and rewrite
the parser so that it's not regexp-based, which allows us to give
better error messages, is arguably more understandable and will
catch user errors before we actually try to talk to Kafka.

This change is a prelude to a change that is intended to add timestamp-based
search to kt. By using a more precise grammar specification, that change
should become easier.

We also add some missing `TestParseOffsets` test cases to cover errors
and some other corners of the grammar.
@fgeller
Copy link
Owner

fgeller commented Mar 11, 2020

Hi @rogpeppe - what a beautiful PR, thank you very much! I updated the tiny merge conflict and will pull the changes in! Reading through the changes, the only thoughts on changes that I had were on naming - so we could maybe try to use names that match those identifiers in the grammar. Would you be interested in reviewing tiny changes like that? I understand the delay on feedback was enormous, sorry for that! I've been a full time dad for the past 2.5 years and only resumed work on my Github projects a few days ago. Let me know if you'd be interested, especially as you mention possibly more work regarding timestamps?

@fgeller fgeller merged commit 5f5c402 into fgeller:master Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants