Sha256: a5565d262ee7e24ea127dda8e47e3dbe9d953e9a734b22ee59471a4560958f02

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 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 / space )* <Body>
  end

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

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

  rule with
    "WITH" space license_exception <WithOperator>
  end

  rule license
    [a-zA-Z0-9\-\+:\.]+ &{|seq| Spdx.license_exists?(seq.first.text_value) }  <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.5 lib/spdx_parser.treetop