@@ -1100,7 +1100,7 @@ impl NFA {
11001100 self . 0 . look_set_prefix_any
11011101 }
11021102
1103- /// Returns how many lookaround sub-expressions this nfa contains
1103+ /// Returns how many look-around sub-expressions this nfa contains
11041104 #[ inline]
11051105 pub fn lookaround_count ( & self ) -> SmallIndex {
11061106 self . 0 . lookaround_count
@@ -1299,8 +1299,8 @@ impl Inner {
12991299 State :: ByteRange { .. }
13001300 | State :: Dense { .. }
13011301 | State :: Fail
1302- | State :: WriteLookaround { .. } => continue ,
1303- State :: CheckLookaround { next, .. } => {
1302+ | State :: WriteLookAround { .. } => continue ,
1303+ State :: CheckLookAround { next, .. } => {
13041304 stack. push ( next) ;
13051305 }
13061306 State :: Sparse ( _) => {
@@ -1385,8 +1385,8 @@ impl Inner {
13851385 State :: Capture { .. } => {
13861386 self . has_capture = true ;
13871387 }
1388- State :: CheckLookaround { look_idx, .. }
1389- | State :: WriteLookaround { look_idx } => {
1388+ State :: CheckLookAround { lookaround_idx : look_idx, .. }
1389+ | State :: WriteLookAround { lookaround_idx : look_idx } => {
13901390 self . lookaround_count = self . lookaround_count . max ( look_idx) ;
13911391 }
13921392 State :: Union { .. }
@@ -1563,23 +1563,24 @@ pub enum State {
15631563 /// satisfied.
15641564 next : StateID ,
15651565 } ,
1566- /// This is like a match state but for a lookaround expression
1567- /// executing this state will write a `true` into the lookaround oracle at
1568- /// index `look_idx`
1569- WriteLookaround {
1570- /// The index of the lookaround expression that matches
1571- look_idx : SmallIndex ,
1566+ /// This is like a match state but for a look-around expression.
1567+ /// Executing this state will write the current haystack offset into the
1568+ /// look-around oracle at index `lookaround_idx`.
1569+ WriteLookAround {
1570+ /// The index of the look-around expression that matches.
1571+ lookaround_idx : SmallIndex ,
15721572 } ,
15731573 /// This indicates that we need to check whether lookaround expression with
1574- /// index `look_idx ` holds at the current position in the haystack
1574+ /// index `lookaround_idx ` holds at the current position in the haystack
15751575 /// If `positive` is false, then the lookaround expression is negative and
15761576 /// hence must NOT hold.
1577- CheckLookaround {
1578- /// The index of the lookaround expression that must be satisfied
1579- look_idx : SmallIndex ,
1580- /// Whether this is a positive lookaround expression
1577+ CheckLookAround {
1578+ /// The index of the look-around expression that must be satisfied.
1579+ lookaround_idx : SmallIndex ,
1580+ /// Whether this is a positive lookaround expression.
15811581 positive : bool ,
1582- /// The next state to transition if the lookaround assertion is satisfied
1582+ /// The next state to transition if the look-around assertion is
1583+ /// satisfied.
15831584 next : StateID ,
15841585 } ,
15851586 /// An alternation such that there exists an epsilon transition to all
@@ -1696,12 +1697,12 @@ impl State {
16961697 | State :: Dense { .. }
16971698 | State :: Fail
16981699 | State :: Match { .. }
1699- | State :: WriteLookaround { .. } => false ,
1700+ | State :: WriteLookAround { .. } => false ,
17001701 State :: Look { .. }
17011702 | State :: Union { .. }
17021703 | State :: BinaryUnion { .. }
17031704 | State :: Capture { .. }
1704- | State :: CheckLookaround { .. } => true ,
1705+ | State :: CheckLookAround { .. } => true ,
17051706 }
17061707 }
17071708
@@ -1714,8 +1715,8 @@ impl State {
17141715 | State :: Capture { .. }
17151716 | State :: Match { .. }
17161717 | State :: Fail
1717- | State :: WriteLookaround { .. }
1718- | State :: CheckLookaround { .. } => 0 ,
1718+ | State :: WriteLookAround { .. }
1719+ | State :: CheckLookAround { .. } => 0 ,
17191720 State :: Sparse ( SparseTransitions { ref transitions } ) => {
17201721 transitions. len ( ) * mem:: size_of :: < Transition > ( )
17211722 }
@@ -1748,7 +1749,7 @@ impl State {
17481749 }
17491750 }
17501751 State :: Look { ref mut next, .. } => * next = remap[ * next] ,
1751- State :: CheckLookaround { ref mut next, .. } => {
1752+ State :: CheckLookAround { ref mut next, .. } => {
17521753 * next = remap[ * next]
17531754 }
17541755 State :: Union { ref mut alternates } => {
@@ -1763,7 +1764,7 @@ impl State {
17631764 State :: Capture { ref mut next, .. } => * next = remap[ * next] ,
17641765 State :: Fail
17651766 | State :: Match { .. }
1766- | State :: WriteLookaround { .. } => { }
1767+ | State :: WriteLookAround { .. } => { }
17671768 }
17681769 }
17691770}
@@ -1793,15 +1794,19 @@ impl fmt::Debug for State {
17931794 State :: Look { ref look, next } => {
17941795 write ! ( f, "{:?} => {:?}" , look, next. as_usize( ) )
17951796 }
1796- State :: WriteLookaround { look_idx } => {
1797- write ! ( f, "Write Lookaround: {} " , look_idx. as_u32( ) )
1797+ State :: WriteLookAround { lookaround_idx : look_idx } => {
1798+ write ! ( f, "write-look-around({}) " , look_idx. as_u32( ) )
17981799 }
1799- State :: CheckLookaround { look_idx, positive, next } => {
1800+ State :: CheckLookAround {
1801+ lookaround_idx : look_idx,
1802+ positive,
1803+ next,
1804+ } => {
18001805 write ! (
18011806 f,
1802- "Check Lookaround {} is {} => {}" ,
1807+ "check-look-around( {} is {}) => {}" ,
18031808 look_idx. as_u32( ) ,
1804- positive,
1809+ if positive { "matched" } else { "not matched" } ,
18051810 next. as_usize( )
18061811 )
18071812 }
0 commit comments