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
use cratePath;
/// Tracks recursive substitutions during HOCON value resolution.
///
/// This structure serves as a recursion guard to detect and prevent
/// infinite loops or excessive nesting depth when resolving substitution
/// expressions (e.g. `${a.b.c}`).
///
/// During value expansion, each visited `Path` is pushed into `tracker`.
/// Before resolving a new substitution, the parser checks whether the same
/// path already exists in the tracker.
/// If it does, it indicates a **cyclic reference** such as:
///
/// ```hocon
/// a = ${b}
/// b = ${a}
/// ```
///
/// Additionally, the `substitution_counter` tracks the total number of
/// performed substitutions to prevent stack overflow in deeply nested
/// structures, for example:
///
/// ```hocon
/// a = { b = [{ c = "hello" }] }
/// ```
///
/// In this case, the traversal path would be represented as `a.b.0.c`.
///
/// # Fields
/// - `tracker`: A stack of paths representing the current substitution
/// resolution chain. Used to detect recursion.
/// - `substitution_counter`: Counts the total number of performed
/// substitutions, used for recursion depth control.
pub