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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! <https://en.wikipedia.org/wiki/Process_calculus>
//! <https://en.wikipedia.org/wiki/Communicating_sequential_processes>
//! <https://en.wikipedia.org/wiki/Calculus_of_communicating_systems>
use unconst::unconst;
use crate::context::Context;
use crate::partition::Partition;
use crate::repr::Repr::{self, *};
use crate::traits::Integral;
#[unconst]
#[derive(Debug)]
pub struct Process<'c, 'm, I: ~const Integral> {
repr: Repr<I>,
context: &'c Context<I>,
matches: &'m mut [bool],
}
#[unconst]
pub const fn next<I>(
repr: &Repr<I>, mut slice: &[I], partition: &mut Partition<I>)
where I: ~const Integral
{
match repr {
// True => {
// return Some(index);
// }
// Zero(zero) => {
// if zero.yes(slice) {
// return Some(0);
// } else {
// return None;
// }
// }
One(seq) => {
let slice = &slice[..seq.len()];
if seq.as_slice() == slice {
slice = &slice[seq.len()..];
}
}
Interval(interval) => {
if interval.has(slice[1]) {
slice = &slice[1..];
}
}
Mul(lhs, rhs) => {
next(lhs, slice, partition);
next(rhs, slice, partition);
}
Or(lhs, rhs) => {
next(lhs, slice, &mut partition.clone());
next(rhs, slice, &mut partition)
}
Inf(repr) => {
}
// Add(lhs, rhs) => {
// }
_ => unimplemented!()
}
}