Sha256: 7643b910c3645710e87631bd43f5dfb5b2ad0add9e18434e4193ba9c231a9f7f

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

grammar SpdxGrammar

  rule spdx_expression
    compound_expression / none / no_assertion
  end

  rule compound_expression
    '(' body ')' <CompoundExpression>
  end

  rule body
    ( compound_expression / and / or / with / license )* <Body>
  end

  rule and
    space "AND" space !reserve_words <LogicalAnd>
  end

  rule or
    space "OR" space !reserve_words <LogicalOr>
  end

  rule with
    space "WITH" space license_exception <With>
  end

  rule license
    [a-zA-Z0-9\-\+:\.]+ &{|seq| Spdx.license_exists?(seq.first.text_value) || Spdx.license_exists?(seq.first.text_value.delete_suffix('+')) }  <License>
  end

  rule license_exception
    [a-zA-Z0-9\-\+:\.]+ &{|seq| Spdx.exception_exists?(seq.first.text_value) } <LicenseException>
  end

  rule reserve_words
    "AND" / "OR" / "WITH"
  end

  rule none
    "NONE" <None>
  end

  rule no_assertion
    "NOASSERTION" <NoAssertion>
  end

  rule space
    [\s]+
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spdx-2.0.12 lib/spdx_parser.treetop