-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 382 tag value parser #502
Issue 382 tag value parser #502
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job on yet another monumental undertaking! :)
The overall structure looks very good, but I've got a few suggestions that might enhance the code even further.
Due to the non-standard nature of the library, I even suggest including some inline comments here and there to improve readability.
@grammar_rule("pkg_comment : PKG_COMMENT text_or_line") | ||
def p_pkg_comment(self, p): | ||
self.check_that_current_element_matches_class_for_value(Package, p.lineno(1)) | ||
set_value(p, self.current_element, argument_name="comment") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these rules are only separate from each other because the argument_name
has to be set differently.
So here is a major refactoring suggestion: Put all those into p_generic_package_value
and do the determination of argument_name
there. Then, these last two lines above need only appear once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
5bdde3d
to
dcae948
Compare
t.value = t.value[1:].strip() | ||
return t | ||
|
||
@TOKEN(r"\s*((ht|f)tps?:\/\/\S*)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably go with the latter: Just read in whatever "URI" is provided, and let validation handle the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this starts to look really good now, probably I spent too much time with it already :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!
I think this calls for a celebration! :D
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
The code is taken from the current implementation, I added a decorator function to use instead of docstrings and adapted the code according to the new data model. Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
…d for construction Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
[review] assert that only one relationship exists [review] improve tests for package parser [review] don't use assertCountEqual if list contains only one element [review] add newline to <text> field [review] delete default values in datetime [fix] soften comparison of error messages to also support older python versions Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
[review] add comments to parser to improve code readability [review] merge parsing methods for byte_range and line_range [review] delete superfluous except block [review] delete superfluous call to setdefault [review] delete superfluous case distinction [review] rename parameter [review] get rid of docstrings [review] rename Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
[review] use strings instead of p.slice [review] merge generic parsing methods [review] parse value only if the current_element matches [review] merge parsing methods [review] merge error methods for current elements [review] delete tokens for enum values and let the parser take care of correct values Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
[review] use double quotes [review] change file structure of tag value parser [review] rename Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
[review] fix parsing of external document ref [review] use only one dictionary [review] return if multiple values for snippet range found Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
aa1ded4
to
97a8de4
Compare
fixes #382