Skip to main content

Module expression

Module expression 

Source
Expand description

License expression parsing and manipulation.

This module provides a parser for ScanCode license expressions, supporting:

  • ScanCode license keys (e.g., mit, gpl-2.0-plus, apache-2.0)
  • SPDX operators: AND, OR, WITH (case-insensitive)
  • Parenthetical grouping
  • The LicenseRef-scancode-* format for non-SPDX licenses

The parser converts license expression strings into an AST (Abstract Syntax Tree) and provides functions for validation and simplification.

Enums§

LicenseExpression
A parsed license expression represented as an AST.
ParseError
Error type for license expression parsing.

Functions§

combine_expressions_and
Combine multiple license expressions with AND.
expression_to_string
Returns
licensing_contains
parse_expression
Parse a license expression string into a structured expression.
simplify_expression
Simplify a license expression by deduplicating license keys.