Skip to content

Commit

Permalink
[issue-788] fix tag-value parser to allow NONE and NOASSERTION for pa…
Browse files Browse the repository at this point in the history
…ckage source info as they are valid strings

Signed-off-by: Meret Behrens <[email protected]>
  • Loading branch information
meretp authored and armintaenzertng committed Aug 23, 2024
1 parent f6fcf20 commit 279f271
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/spdx_tools/spdx/parser/tagvalue/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def p_current_element_error(self, p):
"file_comment : FILE_COMMENT text_or_line\n "
"file_license_concluded : FILE_LICENSE_CONCLUDED license_or_no_assertion_or_none\n "
"package_name : PKG_NAME LINE\n description : PKG_DESCRIPTION text_or_line\n "
"summary : PKG_SUMMARY text_or_line\n source_info : PKG_SOURCE_INFO text_or_line_including_no_assertion\n "
"summary : PKG_SUMMARY text_or_line\n source_info : PKG_SOURCE_INFO text_or_line\n "
"homepage : PKG_HOMEPAGE line_or_no_assertion_or_none\n "
"download_location : PKG_DOWNLOAD_LOCATION line_or_no_assertion_or_none\n "
"originator : PKG_ORIGINATOR actor_or_no_assertion\n supplier : PKG_SUPPLIER actor_or_no_assertion\n "
Expand Down Expand Up @@ -212,14 +212,13 @@ def p_generic_value(self, p):
def p_unknown_tag(self, p):
self.logger.append(f"Unknown tag provided in line {p.lineno(1)}")

@grammar_rule("text_or_line : TEXT")
@grammar_rule("text_or_line : TEXT\n line_or_no_assertion_or_none : TEXT")
def p_text(self, p):
p[0] = str_from_text(p[1])

@grammar_rule(
"text_or_line : LINE\n line_or_no_assertion : LINE\nline_or_no_assertion_or_none : text_or_line\n"
"text_or_line_including_no_assertion : text_or_line\ntext_or_line_including_no_assertion : NO_ASSERTION\n"
"text_or_line_including_no_assertion : NONE"
"text_or_line : LINE\n line_or_no_assertion : LINE\nline_or_no_assertion_or_none : LINE\n"
"text_or_line : NO_ASSERTION\n text_or_line : NONE"
)
def p_line(self, p):
p[0] = p[1]
Expand Down

0 comments on commit 279f271

Please sign in to comment.