1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-FileCopyrightText: Provenant contributors
// SPDX-License-Identifier: Apache-2.0
//! Grammar rules for copyright parse tree construction.
//!
//! Rules are applied bottom-up to a sequence of POS-tagged tokens.
//! Each rule matches a pattern of tags/labels and replaces the matched
//! span with a new tree node.
//!
//! Ported from the Python `GRAMMAR` string in
//! `reference/scancode-toolkit/src/cluecode/copyrights.py` lines 2367–3530.
//! Includes all rule categories: YEAR, ALL RIGHTS RESERVED, EMAIL, CC, NAME,
//! COMPANY, ANDCO, DASHCAPS, NAME-EMAIL, NAME-YEAR, URL, INITIALDEV,
//! COPYRIGHT, COPYRIGHT2, NAME-COPY, NAME-CAPS, AUTHOR, and ANDAUTH.
//!
//! Quantifier expansion strategy:
//! - `<X>+` (one or more) → rules for 1, 2, and sometimes 3 instances.
//! The parser applies rules iteratively so longer sequences build up.
//! - `<X>?` (optional) → two rules: one with X and one without.
//! - `<X>*` (zero or more) → rules without X, and with 1 instance.
//! - `<X>{3}` (exactly 3) → one rule with exactly 3 instances.
use crate;
/// A matcher for a single position in a grammar rule pattern.
pub
/// A grammar rule: matches a pattern and produces a tree node with the given label.
pub