Skip to content

Commit cff77ec

Browse files
committed
Adjust some docs
1 parent 85c555c commit cff77ec

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

regex-automata/src/nfa/thompson/backtrack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ impl BoundedBacktracker {
14531453
/// Execute a "step" in the backtracing algorithm.
14541454
///
14551455
/// A "step" is somewhat of a misnomer, because this routine keeps going
1456-
/// until it either runs out of things to try or fins a match. In the
1456+
/// until it either runs out of things to try or finds a match. In the
14571457
/// former case, it may have pushed some things on to the backtracking
14581458
/// stack, in which case, those will be tried next as part of the
14591459
/// 'backtrack' routine above.

regex-automata/src/nfa/thompson/builder.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ enum State {
9292
next: StateID,
9393
},
9494
/// An empty state that behaves analogously to a `Match` state but for
95-
/// the look-around sub-expression with the given index.
95+
/// the look-around sub-expression with the given look-around index.
9696
WriteLookAround { lookaround_index: SmallIndex },
9797
/// A conditional epsilon transition that will only be taken if the
9898
/// look-around sub-expression with the given index evaluates to `positive`
@@ -484,17 +484,16 @@ impl Builder {
484484
remap[sid] = nfa.add(nfa::State::Look { look, next });
485485
}
486486
State::WriteLookAround { lookaround_index } => {
487-
remap[sid] = nfa.add(nfa::State::WriteLookAround {
488-
lookaround_idx: lookaround_index,
489-
});
487+
remap[sid] = nfa
488+
.add(nfa::State::WriteLookAround { lookaround_index });
490489
}
491490
State::CheckLookAround {
492491
lookaround_index,
493492
positive,
494493
next,
495494
} => {
496495
remap[sid] = nfa.add(nfa::State::CheckLookAround {
497-
lookaround_idx: lookaround_index,
496+
lookaround_index,
498497
positive,
499498
next,
500499
});
@@ -722,7 +721,7 @@ impl Builder {
722721
self.add(State::Empty { next: StateID::ZERO })
723722
}
724723

725-
/// Add a state which will record that the lookaround with the given index
724+
/// Add a state which will record that the look-around with the given index
726725
/// is satisfied at the current position.
727726
pub fn add_write_lookaround(
728727
&mut self,
@@ -731,7 +730,7 @@ impl Builder {
731730
self.add(State::WriteLookAround { lookaround_index: index })
732731
}
733732

734-
/// Add a state which will check whether the lookaround with the given
733+
/// Add a state which will check whether the look-around with the given
735734
/// index is satisfied at the current position.
736735
pub fn add_check_lookaround(
737736
&mut self,

regex-automata/src/nfa/thompson/compiler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,14 +2036,14 @@ mod tests {
20362036

20372037
fn s_write_lookaround(id: usize) -> State {
20382038
State::WriteLookAround {
2039-
lookaround_idx: SmallIndex::new(id)
2039+
lookaround_index: SmallIndex::new(id)
20402040
.expect("look-around index too large"),
20412041
}
20422042
}
20432043

20442044
fn s_check_lookaround(id: usize, positive: bool, next: usize) -> State {
20452045
State::CheckLookAround {
2046-
lookaround_idx: SmallIndex::new(id)
2046+
lookaround_index: SmallIndex::new(id)
20472047
.expect("look-around index too large"),
20482048
positive,
20492049
next: sid(next),

regex-automata/src/nfa/thompson/nfa.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ impl NFA {
11001100
self.0.look_set_prefix_any
11011101
}
11021102

1103-
/// Returns how many look-around sub-expressions this nfa contains
1103+
/// Returns how many look-around sub-expressions this nfa contains.
11041104
#[inline]
11051105
pub fn lookaround_count(&self) -> usize {
11061106
self.0.lookaround_count
@@ -1268,7 +1268,7 @@ pub(super) struct Inner {
12681268
*/
12691269
/// How many look-around expression this NFA contains.
12701270
/// This is needed to initialize the table for storing the result of
1271-
/// look-around evaluation
1271+
/// look-around evaluation.
12721272
lookaround_count: usize,
12731273
/// Heap memory used indirectly by NFA states and other things (like the
12741274
/// various capturing group representations above). Since each state
@@ -1385,8 +1385,8 @@ impl Inner {
13851385
State::Capture { .. } => {
13861386
self.has_capture = true;
13871387
}
1388-
State::CheckLookAround { lookaround_idx: look_idx, .. }
1389-
| State::WriteLookAround { lookaround_idx: look_idx } => {
1388+
State::CheckLookAround { lookaround_index: look_idx, .. }
1389+
| State::WriteLookAround { lookaround_index: look_idx } => {
13901390
self.lookaround_count =
13911391
self.lookaround_count.max(look_idx.as_usize() + 1);
13921392
}
@@ -1566,19 +1566,19 @@ pub enum State {
15661566
},
15671567
/// This is like a match state but for a look-around expression.
15681568
/// Executing this state will write the current haystack offset into the
1569-
/// look-around oracle at index `lookaround_idx`.
1569+
/// look-around oracle at index `lookaround_index`.
15701570
WriteLookAround {
15711571
/// The index of the look-around expression that matches.
1572-
lookaround_idx: SmallIndex,
1572+
lookaround_index: SmallIndex,
15731573
},
1574-
/// This indicates that we need to check whether lookaround expression with
1575-
/// index `lookaround_idx` holds at the current position in the haystack
1576-
/// If `positive` is false, then the lookaround expression is negative and
1574+
/// This indicates that we need to check whether look-around expression with
1575+
/// index `lookaround_index` holds at the current position in the haystack.
1576+
/// If `positive` is false, then the look-around expression is negative and
15771577
/// hence must NOT hold.
15781578
CheckLookAround {
15791579
/// The index of the look-around expression that must be satisfied.
1580-
lookaround_idx: SmallIndex,
1581-
/// Whether this is a positive lookaround expression.
1580+
lookaround_index: SmallIndex,
1581+
/// Whether this is a positive look-around expression.
15821582
positive: bool,
15831583
/// The next state to transition if the look-around assertion is
15841584
/// satisfied.
@@ -1795,11 +1795,11 @@ impl fmt::Debug for State {
17951795
State::Look { ref look, next } => {
17961796
write!(f, "{:?} => {:?}", look, next.as_usize())
17971797
}
1798-
State::WriteLookAround { lookaround_idx: look_idx } => {
1798+
State::WriteLookAround { lookaround_index: look_idx } => {
17991799
write!(f, "write-look-around({})", look_idx.as_u32())
18001800
}
18011801
State::CheckLookAround {
1802-
lookaround_idx: look_idx,
1802+
lookaround_index: look_idx,
18031803
positive,
18041804
next,
18051805
} => {

regex-automata/src/nfa/thompson/pikevm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,13 +1772,13 @@ impl PikeVM {
17721772
}
17731773
sid = next;
17741774
}
1775-
State::WriteLookAround { lookaround_idx: look_idx } => {
1775+
State::WriteLookAround { lookaround_index: look_idx } => {
17761776
// This is ok since `at` is always less than `usize::MAX`.
17771777
lookarounds[look_idx] = NonMaxUsize::new(at);
17781778
return;
17791779
}
17801780
State::CheckLookAround {
1781-
lookaround_idx: look_idx,
1781+
lookaround_index: look_idx,
17821782
positive,
17831783
next,
17841784
} => {
@@ -1973,8 +1973,8 @@ pub struct Cache {
19731973
/// next byte in the haystack.
19741974
next: ActiveStates,
19751975
/// This answers the question: "What is the maximum position in the
1976-
/// haystack at which lookaround assertion x holds and which is <= to the
1977-
/// current position"
1976+
/// haystack at which look-around indexed x holds and which is <= to the
1977+
/// current position".
19781978
lookaround: Vec<Option<NonMaxUsize>>,
19791979
}
19801980

regex-syntax/src/hir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ impl LookAround {
18191819
}
18201820
}
18211821

1822-
/// Returns a mutable reference to the inner expression
1822+
/// Returns a mutable reference to the inner expression.
18231823
pub fn sub_mut(&mut self) -> &mut Hir {
18241824
match self {
18251825
Self::PositiveLookBehind(sub) | Self::NegativeLookBehind(sub) => {
@@ -2556,7 +2556,7 @@ impl Properties {
25562556
look_set_prefix_any: LookSet::singleton(look),
25572557
look_set_suffix_any: LookSet::singleton(look),
25582558
// Note, this field represents _general_ lookarounds (ones using
2559-
// LookAround) and not simple ones (using Look).
2559+
// LookAround) and not assertions (using Look).
25602560
contains_lookaround_expr: false,
25612561
// This requires a little explanation. Basically, we don't consider
25622562
// matching an empty string to be equivalent to matching invalid

0 commit comments

Comments
 (0)