Skip to content

Commit

Permalink
doc: fix typos
Browse files Browse the repository at this point in the history
This commit fixes an amazing number of new typos that I introduced in
the regex 1.9 release.

The typos were found and fixed by the typos-cli tool.[1]

[1]: https://crates.io/crates/typos-cli

PR #1026
  • Loading branch information
jqnatividad committed Jul 6, 2023
1 parent 7c3463d commit 54690c2
Show file tree
Hide file tree
Showing 48 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -187,7 +187,7 @@ More specifically, any ASCII character except for `[0-9A-Za-z<>]` can now be
escaped. Also, a new routine, `is_escapeable_character`, has been added to
`regex-syntax` to query whether a character is escapeable or not.
* [FEATURE #547](https://github.com/rust-lang/regex/issues/547):
Add `Regex::captures_at`. This filles a hole in the API, but doesn't otherwise
Add `Regex::captures_at`. This fills a hole in the API, but doesn't otherwise
introduce any new expressive power.
* [FEATURE #595](https://github.com/rust-lang/regex/issues/595):
Capture group names are now Unicode-aware. They can now begin with either a `_`
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/dfa/automaton.rs
Expand Up @@ -1074,7 +1074,7 @@ pub unsafe trait Automaton {
/// // encoding of any Unicode scalar value except for 'a', 'b' or 'c'.
/// // That translates to a much more complicated DFA, and also
/// // inhibits the 'accelerator' optimization that we are trying to
/// // demostrate in this example.
/// // demonstrate in this example.
/// .syntax(syntax::Config::new().unicode(false).utf8(false))
/// .build("[^abc]+a")?;
///
Expand Down
6 changes: 3 additions & 3 deletions regex-automata/src/dfa/dense.rs
Expand Up @@ -2109,7 +2109,7 @@ impl<T: AsRef<[u32]>> DFA<T> {
/// let mut buf = vec![0; original_dfa.write_to_len()];
/// // This is guaranteed to succeed, because the only serialization error
/// // that can occur is when the provided buffer is too small. But
/// // write_to_len guarantees a correct sie.
/// // write_to_len guarantees a correct size.
/// let written = original_dfa.write_to_native_endian(&mut buf).unwrap();
/// // But this is not guaranteed to succeed! In particular,
/// // deserialization requires proper alignment for &[u32], but our buffer
Expand Down Expand Up @@ -3336,7 +3336,7 @@ impl<'a> TransitionTable<&'a [u32]> {
///
/// # Safety
///
/// This routine is not safe because it does not check the valdity of the
/// This routine is not safe because it does not check the validity of the
/// transition table itself. In particular, the transition table can be
/// quite large, so checking its validity can be somewhat expensive. An
/// invalid transition table is not safe because other code may rely on the
Expand Down Expand Up @@ -3929,7 +3929,7 @@ impl<'a> StartTable<&'a [u32]> {
///
/// # Safety
///
/// This routine is not safe because it does not check the valdity of the
/// This routine is not safe because it does not check the validity of the
/// starting state IDs themselves. In particular, the number of starting
/// IDs can be of variable length, so it's possible that checking their
/// validity cannot be done in constant time. An invalid starting state
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/dfa/determinize.rs
Expand Up @@ -539,7 +539,7 @@ impl<'a> Runner<'a> {
}
let state = builder.to_state();
// States use reference counting internally, so we only need to count
// their memroy usage once.
// their memory usage once.
self.memory_usage_state += state.memory_usage();
self.builder_states.push(state.clone());
self.cache.insert(state, id);
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/dfa/minimize.rs
Expand Up @@ -152,7 +152,7 @@ impl<'a> Minimizer<'a> {

// At this point, we now have a minimal partitioning of states, where
// each partition is an equivalence class of DFA states. Now we need to
// use this partioning to update the DFA to only contain one state for
// use this partitioning to update the DFA to only contain one state for
// each partition.

// Create a map from DFA state ID to the representative ID of the
Expand Down
4 changes: 2 additions & 2 deletions regex-automata/src/dfa/mod.rs
@@ -1,5 +1,5 @@
/*!
A module for building and searching with determinstic finite automata (DFAs).
A module for building and searching with deterministic finite automata (DFAs).
Like other modules in this crate, DFAs support a rich regex syntax with Unicode
features. DFAs also have extensive options for configuring the best space vs
Expand Down Expand Up @@ -267,7 +267,7 @@ the regexes in this module are almost universally slow to compile, especially
when they contain large Unicode character classes. For example, on my system,
compiling `\w{50}` takes about 1 second and almost 15MB of memory! (Compiling
a sparse regex takes about the same time but only uses about 1.2MB of
memory.) Conversly, compiling the same regex without Unicode support, e.g.,
memory.) Conversely, compiling the same regex without Unicode support, e.g.,
`(?-u)\w{50}`, takes under 1 millisecond and about 15KB of memory. For this
reason, you should only use Unicode character classes if you absolutely need
them! (They are enabled by default though.)
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/dfa/regex.rs
Expand Up @@ -590,7 +590,7 @@ impl<A: Automaton> Regex<A> {
///
/// The type parameters are as follows:
///
/// * `A` represents the type of the underyling DFA that implements the
/// * `A` represents the type of the underlying DFA that implements the
/// [`Automaton`] trait.
///
/// The lifetime parameters are as follows:
Expand Down
8 changes: 4 additions & 4 deletions regex-automata/src/hybrid/dfa.rs
Expand Up @@ -32,7 +32,7 @@ use crate::{
},
};

/// The mininum number of states that a lazy DFA's cache size must support.
/// The minimum number of states that a lazy DFA's cache size must support.
///
/// This is checked at time of construction to ensure that at least some small
/// number of states can fit in the given capacity allotment. If we can't fit
Expand Down Expand Up @@ -2332,7 +2332,7 @@ impl<'i, 'c> Lazy<'i, 'c> {
"lazy DFA cache has been cleared {} times, \
which exceeds the limit of {}, \
AND its bytes searched per state is less \
than the configured mininum of {}, \
than the configured minimum of {}, \
therefore lazy DFA is giving up \
(bytes searched since cache clear = {}, \
number of states = {})",
Expand All @@ -2348,7 +2348,7 @@ impl<'i, 'c> Lazy<'i, 'c> {
"lazy DFA cache has been cleared {} times, \
which exceeds the limit of {}, \
AND its bytes searched per state is greater \
than the configured mininum of {}, \
than the configured minimum of {}, \
therefore lazy DFA is continuing! \
(bytes searched since cache clear = {}, \
number of states = {})",
Expand Down Expand Up @@ -2771,7 +2771,7 @@ enum StateSaver {
/// is stored in 'Saved' since it may have changed.
ToSave { id: LazyStateID, state: State },
/// An ID that of a state that has been persisted through a lazy DFA
/// cache clearing. The ID recorded here corresonds to an ID that was
/// cache clearing. The ID recorded here corresponds to an ID that was
/// once marked as ToSave. The IDs are likely not equivalent even though
/// the states they point to are.
Saved(LazyStateID),
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/hybrid/mod.rs
@@ -1,5 +1,5 @@
/*!
A module for building and searching with lazy determinstic finite automata
A module for building and searching with lazy deterministic finite automata
(DFAs).
Like other modules in this crate, lazy DFAs support a rich regex syntax with
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/hybrid/search.rs
Expand Up @@ -188,7 +188,7 @@ fn find_fwd_imp(
// mentioned above was a pretty big pessimization in some other
// cases. Namely, it resulted in too much ping-ponging into and out
// of the loop, which resulted in nearly ~2x regressions in search
// time when compared to the originaly lazy DFA in the regex crate.
// time when compared to the originally lazy DFA in the regex crate.
// So I've removed the second loop unrolling that targets the
// self-transition case.
let mut prev_sid = sid;
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/lib.rs
Expand Up @@ -330,7 +330,7 @@ at search time and it requires the caller to opt into this.
There are other ways for regex engines to fail in this crate, but the above
two should represent the general theme of failures one can find. Dealing
with these failures is, in part, one the reaponsibilities of the [meta regex
with these failures is, in part, one the responsibilities of the [meta regex
engine](meta). Notice, for example, that the meta regex engine exposes an API
that never returns an error nor panics. It carefully manages all of the ways
in which the regex engines can fail and either avoids the predictable ones
Expand Down
4 changes: 2 additions & 2 deletions regex-automata/src/meta/error.rs
Expand Up @@ -120,7 +120,7 @@ impl core::fmt::Display for BuildError {
///
/// The first is one where potential quadratic behavior has been detected.
/// In this case, whatever optimization that led to this behavior should be
/// stopped, and the next best strategy shouldbe used.
/// stopped, and the next best strategy should be used.
///
/// The second indicates that the underlying regex engine has failed for some
/// reason. This usually occurs because either a lazy DFA's cache has become
Expand Down Expand Up @@ -194,7 +194,7 @@ impl From<RetryQuadraticError> for RetryError {
/// Note that this has convenient `From` impls that will automatically
/// convert a `MatchError` into this error. This works because the meta
/// regex engine internals guarantee that errors like `HaystackTooLong` and
/// `UnsupportAnchored` will never occur. The only errors left are `Quit` and
/// `UnsupportedAnchored` will never occur. The only errors left are `Quit` and
/// `GaveUp`, which both correspond to this "failure" error.
#[derive(Debug)]
pub(crate) struct RetryFailError {
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/meta/regex.rs
Expand Up @@ -2277,7 +2277,7 @@ impl<'r, 'h> core::iter::FusedIterator for SplitN<'r, 'h> {}
/// explicitly separated from the the core regex object (such as a
/// [`thompson::NFA`](crate::nfa::thompson::NFA)) so that the read-only regex
/// object can be shared across multiple threads simultaneously without any
/// synchronization. Conversly, a `Cache` must either be duplicated if using
/// synchronization. Conversely, a `Cache` must either be duplicated if using
/// the same `Regex` from multiple threads, or else there must be some kind of
/// synchronization that guarantees exclusive access while it's in use by one
/// thread.
Expand Down
4 changes: 2 additions & 2 deletions regex-automata/src/nfa/thompson/backtrack.rs
Expand Up @@ -825,7 +825,7 @@ impl BoundedBacktracker {
#[inline]
pub fn max_haystack_len(&self) -> usize {
// The capacity given in the config is "bytes of heap memory," but the
// capacity we use here is "number of bits." So conver the capacity in
// capacity we use here is "number of bits." So convert the capacity in
// bytes to the capacity in bits.
let capacity = 8 * self.get_config().get_visited_capacity();
let blocks = div_ceil(capacity, Visited::BLOCK_SIZE);
Expand Down Expand Up @@ -1845,7 +1845,7 @@ impl Visited {
/// Reset this visited set to work with the given bounded backtracker.
fn reset(&mut self, re: &BoundedBacktracker) {
// The capacity given in the config is "bytes of heap memory," but the
// capacity we use here is "number of bits." So conver the capacity in
// capacity we use here is "number of bits." So convert the capacity in
// bytes to the capacity in bits.
let capacity = 8 * re.get_config().get_visited_capacity();
let blocks = div_ceil(capacity, Visited::BLOCK_SIZE);
Expand Down
6 changes: 3 additions & 3 deletions regex-automata/src/nfa/thompson/compiler.rs
Expand Up @@ -1008,7 +1008,7 @@ impl Compiler {
/// but no more than `max` times.
///
/// When `greedy` is true, then the preference is for the expression to
/// match as much as possible. Otheriwse, it will match as little as
/// match as much as possible. Otherwise, it will match as little as
/// possible.
fn c_bounded(
&self,
Expand Down Expand Up @@ -1074,7 +1074,7 @@ impl Compiler {
/// integer is likely to run afoul of any configured size limits.)
///
/// When `greedy` is true, then the preference is for the expression to
/// match as much as possible. Otheriwse, it will match as little as
/// match as much as possible. Otherwise, it will match as little as
/// possible.
fn c_at_least(
&self,
Expand Down Expand Up @@ -1155,7 +1155,7 @@ impl Compiler {
/// times.
///
/// When `greedy` is true, then the preference is for the expression to
/// match as much as possible. Otheriwse, it will match as little as
/// match as much as possible. Otherwise, it will match as little as
/// possible.
fn c_zero_or_one(
&self,
Expand Down
6 changes: 3 additions & 3 deletions regex-automata/src/nfa/thompson/error.rs
Expand Up @@ -3,7 +3,7 @@ use crate::util::{
primitives::{PatternID, StateID},
};

/// An error that can occured during the construction of a thompson NFA.
/// An error that can occurred during the construction of a thompson NFA.
///
/// This error does not provide many introspection capabilities. There are
/// generally only two things you can do with it:
Expand Down Expand Up @@ -161,13 +161,13 @@ impl core::fmt::Display for BuildError {
}
BuildErrorKind::TooManyPatterns { given, limit } => write!(
f,
"attemped to compile {} patterns, \
"attempted to compile {} patterns, \
which exceeds the limit of {}",
given, limit,
),
BuildErrorKind::TooManyStates { given, limit } => write!(
f,
"attemped to compile {} NFA states, \
"attempted to compile {} NFA states, \
which exceeds the limit of {}",
given, limit,
),
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/nfa/thompson/nfa.rs
Expand Up @@ -1587,7 +1587,7 @@ pub enum State {
/// in case they are useful. But mostly, all you'll need is `next` and
/// `slot`.
Capture {
/// The state to transtition to, unconditionally.
/// The state to transition to, unconditionally.
next: StateID,
/// The pattern ID that this capture belongs to.
pattern_id: PatternID,
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/nfa/thompson/pikevm.rs
Expand Up @@ -2297,7 +2297,7 @@ impl Counters {
trace!("===== START PikeVM Instrumentation Output =====");
// We take the top-K most occurring state sets. Otherwise the output
// is likely to be overwhelming. And we probably only care about the
// most frequently occuring ones anyway.
// most frequently occurring ones anyway.
const LIMIT: usize = 20;
let mut set_counts =
self.state_sets.iter().collect::<Vec<(&Vec<StateID>, &u64)>>();
Expand Down
6 changes: 3 additions & 3 deletions regex-automata/src/nfa/thompson/range_trie.rs
Expand Up @@ -131,7 +131,7 @@ sequences of ranges are sorted, and any corresponding ranges are either
exactly equivalent or non-overlapping.
In effect, a range trie is building a DFA from a sequence of arbitrary byte
ranges. But it uses an algoritm custom tailored to its input, so it is not as
ranges. But it uses an algorithm custom tailored to its input, so it is not as
costly as traditional DFA construction. While it is still quite a bit more
costly than the forward case (which only needs Daciuk's algorithm), it winds
up saving a substantial amount of time if one is doing a full DFA powerset
Expand Down Expand Up @@ -188,7 +188,7 @@ pub struct RangeTrie {
/// A stack for traversing this trie to yield sequences of byte ranges in
/// lexicographic order.
iter_stack: RefCell<Vec<NextIter>>,
/// A bufer that stores the current sequence during iteration.
/// A buffer that stores the current sequence during iteration.
iter_ranges: RefCell<Vec<Utf8Range>>,
/// A stack used for traversing the trie in order to (deeply) duplicate
/// a state. States are recursively duplicated when ranges are split.
Expand Down Expand Up @@ -622,7 +622,7 @@ struct NextIter {
}

/// The next state to process during insertion and any remaining ranges that we
/// want to add for a partcular sequence of ranges. The first such instance
/// want to add for a particular sequence of ranges. The first such instance
/// is always the root state along with all ranges given.
#[derive(Clone, Debug)]
struct NextInsert {
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/util/alphabet.rs
Expand Up @@ -132,7 +132,7 @@ impl Unit {
}
}

/// If this unit is an "end of input" sentinel, then return the underyling
/// If this unit is an "end of input" sentinel, then return the underlying
/// sentinel value that was given to [`Unit::eoi`]. Otherwise return
/// `None`.
pub fn as_eoi(self) -> Option<u16> {
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/util/captures.rs
Expand Up @@ -1453,7 +1453,7 @@ impl GroupInfo {
/// sequence of patterns yields a sequence of possible group names. The
/// index of each pattern in the sequence corresponds to its `PatternID`,
/// and the index of each group in each pattern's sequence corresponds to
/// its coresponding group index.
/// its corresponding group index.
///
/// While this constructor is very generic and therefore perhaps hard to
/// chew on, an example of a valid concrete type that can be passed to
Expand Down
4 changes: 2 additions & 2 deletions regex-automata/src/util/determinize/mod.rs
Expand Up @@ -205,7 +205,7 @@ pub(crate) fn next(
&& unit.is_byte(lookm.get_line_terminator())
{
// Why only handle StartLF here and not Start? That's because Start
// can only impact the starting state, which is speical cased in
// can only impact the starting state, which is special cased in
// start state handling.
builder.set_look_have(|have| have.insert(Look::StartLF));
}
Expand Down Expand Up @@ -412,7 +412,7 @@ pub(crate) fn epsilon_closure(
/// and whether this state is being generated for a transition over a word byte
/// when applicable) that are true immediately prior to transitioning into this
/// state (via `builder.look_have()`). The match pattern IDs should correspond
/// to matches that occured on the previous transition, since all matches are
/// to matches that occurred on the previous transition, since all matches are
/// delayed by one byte. The things that should _not_ be set are look-ahead
/// assertions (EndLF, End and whether the next byte is a word byte or not).
/// The builder state should also not have anything in `look_need` set, as this
Expand Down
4 changes: 2 additions & 2 deletions regex-automata/src/util/determinize/state.rs
Expand Up @@ -60,7 +60,7 @@ DFA state to check if it already exists. If it does, then there's no need to
freeze it into a `State`. It it doesn't exist, then `StateBuilderNFA::to_state`
can be called to freeze the builder into an immutable `State`. In either
case, `clear` should be called on the builder to turn it back into a
`StateBuilderEmpty` that reuses the underyling memory.
`StateBuilderEmpty` that reuses the underlying memory.
The main purpose for splitting the builder into these distinct types is to
make it impossible to do things like adding a pattern ID after adding an NFA
Expand Down Expand Up @@ -103,7 +103,7 @@ use crate::util::{
/// This type is intended to be used only in NFA-to-DFA conversion via powerset
/// construction.
///
/// It may be cheaply cloned and accessed safely from mulitple threads
/// It may be cheaply cloned and accessed safely from multiple threads
/// simultaneously.
#[derive(Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub(crate) struct State(Arc<[u8]>);
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/util/iter.rs
Expand Up @@ -2,7 +2,7 @@
Generic helpers for iteration of matches from a regex engine in a haystack.
The principle type in this module is a [`Searcher`]. A `Searcher` provides
its own lower level iterater-like API in addition to methods for constructing
its own lower level iterator-like API in addition to methods for constructing
types that implement `Iterator`. The documentation for `Searcher` explains a
bit more about why these different APIs exist.
Expand Down
2 changes: 1 addition & 1 deletion regex-automata/src/util/lazy.rs
Expand Up @@ -159,7 +159,7 @@ mod lazy {
impl<T, F: Fn() -> T> Lazy<T, F> {
/// Get the underlying lazy value. If it hasn't been initialized
/// yet, then always attempt to initialize it (even if some other
/// thread is initializing it) and atomicly attach it to this lazy
/// thread is initializing it) and atomically attach it to this lazy
/// value before returning it.
pub(super) fn get(&self) -> &T {
if let Some(data) = self.poll() {
Expand Down
4 changes: 2 additions & 2 deletions regex-automata/src/util/look.rs
Expand Up @@ -972,8 +972,8 @@ impl core::fmt::Display for UnicodeWordBoundaryError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(
f,
"Unicode-aware \\b and \\B are unavailabe because the \
requiste data tables are missing, please enable the \
"Unicode-aware \\b and \\B are unavailable because the \
requisite data tables are missing, please enable the \
unicode-word-boundary feature"
)
}
Expand Down

0 comments on commit 54690c2

Please sign in to comment.