Skip to content

ParseError when symbol contained in exception string that is not in the Licensing #29

Description

@tdruez
>>> from license_expression import Licensing
>>> l = Licensing(['lgpl-3.0-plus'])
>>> license_expression = 'lgpl-3.0-plus WITH openssl-exception-lgpl-3.0-plus'
>>> l.parse(license_expression)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "lib/python3.6/site-packages/license_expression/__init__.py", line 386, in parse
    expression = super(Licensing, self).parse(tokens)
  File "lib/python3.6/site-packages/boolean/boolean.py", line 216, in parse
    raise ParseError(token, tokstr, position, PARSE_INVALID_SYMBOL_SEQUENCE)
boolean.boolean.ParseError: Invalid symbols sequence such as (A B) for token: "lgpl-3.0-plus" at position: 37

>>> l = Licensing(['lgpl-3.0-plus'])
>>> license_expression = 'lgpl-3.0-plus AND openssl-exception-lgpl-3.0-plus'
>>> l.parse(license_expression)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "lib/python3.6/site-packages/license_expression/__init__.py", line 386, in parse
    expression = super(Licensing, self).parse(tokens)
  File "lib/python3.6/site-packages/boolean/boolean.py", line 216, in parse
    raise ParseError(token, tokstr, position, PARSE_INVALID_SYMBOL_SEQUENCE)
boolean.boolean.ParseError: Invalid symbols sequence such as (A B) for token: "lgpl-3.0-plus" at position: 36

>>> l = Licensing(['lgpl-3.0-plus', 'openssl-exception-lgpl-3.0-plus'])
>>> l.parse(license_expression)
LicenseWithExceptionSymbol(license_symbol=LicenseSymbol('lgpl-3.0-plus', is_exception=False), exception_symbol=LicenseSymbol('openssl-exception-lgpl-3.0-plus', is_exception=False))

>>> l = Licensing(['lgpl-3.0-plus'])
>>> license_expression = 'lgpl-3.0-plus WITH openssl-exception-lgpl-2.0-plus'
>>> l.parse(license_expression)
LicenseWithExceptionSymbol(license_symbol=LicenseSymbol('lgpl-3.0-plus', is_exception=False), exception_symbol=LicenseSymbol('openssl-exception-lgpl-2.0-plus', is_exception=False))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions