@@ -323,7 +323,7 @@ impl Hir {
323
323
if rep. min == 0 && rep. max == Some ( 0 ) {
324
324
return Hir :: empty ( ) ;
325
325
} else if rep. min == 1 && rep. max == Some ( 1 ) {
326
- return * rep. hir ;
326
+ return * rep. sub ;
327
327
}
328
328
let props = Properties :: repetition ( & rep) ;
329
329
Hir { kind : HirKind :: Repetition ( rep) , props }
@@ -1437,7 +1437,7 @@ pub struct Capture {
1437
1437
/// The name of the capture, if it exists.
1438
1438
pub name : Option < Box < str > > ,
1439
1439
/// The expression inside the capturing group, which may be empty.
1440
- pub hir : Box < Hir > ,
1440
+ pub sub : Box < Hir > ,
1441
1441
}
1442
1442
1443
1443
/// The high-level intermediate representation of a repetition operator.
@@ -1467,7 +1467,7 @@ pub struct Repetition {
1467
1467
/// not. However, this can be inverted via the `U` "ungreedy" flag.
1468
1468
pub greedy : bool ,
1469
1469
/// The expression being repeated.
1470
- pub hir : Box < Hir > ,
1470
+ pub sub : Box < Hir > ,
1471
1471
}
1472
1472
1473
1473
impl Repetition {
@@ -1523,8 +1523,8 @@ impl Drop for Hir {
1523
1523
| HirKind :: Literal ( _)
1524
1524
| HirKind :: Class ( _)
1525
1525
| HirKind :: Look ( _) => return ,
1526
- HirKind :: Capture ( ref x) if !x. hir . kind . has_subexprs ( ) => return ,
1527
- HirKind :: Repetition ( ref x) if !x. hir . kind . has_subexprs ( ) => return ,
1526
+ HirKind :: Capture ( ref x) if !x. sub . kind . has_subexprs ( ) => return ,
1527
+ HirKind :: Repetition ( ref x) if !x. sub . kind . has_subexprs ( ) => return ,
1528
1528
HirKind :: Concat ( ref x) if x. is_empty ( ) => return ,
1529
1529
HirKind :: Alternation ( ref x) if x. is_empty ( ) => return ,
1530
1530
_ => { }
@@ -1538,10 +1538,10 @@ impl Drop for Hir {
1538
1538
| HirKind :: Class ( _)
1539
1539
| HirKind :: Look ( _) => { }
1540
1540
HirKind :: Capture ( ref mut x) => {
1541
- stack. push ( mem:: replace ( & mut x. hir , Hir :: empty ( ) ) ) ;
1541
+ stack. push ( mem:: replace ( & mut x. sub , Hir :: empty ( ) ) ) ;
1542
1542
}
1543
1543
HirKind :: Repetition ( ref mut x) => {
1544
- stack. push ( mem:: replace ( & mut x. hir , Hir :: empty ( ) ) ) ;
1544
+ stack. push ( mem:: replace ( & mut x. sub , Hir :: empty ( ) ) ) ;
1545
1545
}
1546
1546
HirKind :: Concat ( ref mut x) => {
1547
1547
stack. extend ( x. drain ( ..) ) ;
@@ -1926,7 +1926,7 @@ impl Properties {
1926
1926
1927
1927
/// Create a new set of HIR properties for a repetition.
1928
1928
fn repetition ( rep : & Repetition ) -> Properties {
1929
- let p = rep. hir . properties ( ) ;
1929
+ let p = rep. sub . properties ( ) ;
1930
1930
let minimum_len = p. minimum_len ( ) . map ( |child_min| {
1931
1931
let rep_min = usize:: try_from ( rep. min ) . unwrap_or ( usize:: MAX ) ;
1932
1932
child_min. saturating_mul ( rep_min)
@@ -1957,7 +1957,7 @@ impl Properties {
1957
1957
1958
1958
/// Create a new set of HIR properties for a capture.
1959
1959
fn capture ( capture : & Capture ) -> Properties {
1960
- let p = capture. hir . properties ( ) ;
1960
+ let p = capture. sub . properties ( ) ;
1961
1961
Properties ( Box :: new ( PropertiesI {
1962
1962
captures_len : p. captures_len ( ) . saturating_add ( 1 ) ,
1963
1963
literal : false ,
@@ -3054,13 +3054,13 @@ mod tests {
3054
3054
expr = Hir :: capture ( Capture {
3055
3055
index : 1 ,
3056
3056
name : None ,
3057
- hir : Box :: new ( expr) ,
3057
+ sub : Box :: new ( expr) ,
3058
3058
} ) ;
3059
3059
expr = Hir :: repetition ( Repetition {
3060
3060
min : 0 ,
3061
3061
max : Some ( 1 ) ,
3062
3062
greedy : true ,
3063
- hir : Box :: new ( expr) ,
3063
+ sub : Box :: new ( expr) ,
3064
3064
} ) ;
3065
3065
3066
3066
expr = Hir {
0 commit comments