MCPcopy Create free account
hub / github.com/davidblewett/rure-python / compile

Method compile

regex/src/compile.rs:122–133  ·  view source on GitHub ↗

Compile a regular expression given its AST. The compiler is guaranteed to succeed unless the program exceeds the specified size limit. If the size limit is exceeded, then compilation stops and returns an error.

(
        mut self,
        exprs: &[Hir],
    )

Source from the content-addressed store, hash-verified

120 /// specified size limit. If the size limit is exceeded, then compilation
121 /// stops and returns an error.
122 pub fn compile(
123 mut self,
124 exprs: &[Hir],
125 ) -> result::Result<Program, Error> {
126 debug_assert!(exprs.len() >= 1);
127 self.num_exprs = exprs.len();
128 if exprs.len() == 1 {
129 self.compile_one(&exprs[0])
130 } else {
131 self.compile_many(exprs)
132 }
133 }
134
135 fn compile_one(mut self, expr: &Hir) -> result::Result<Program, Error> {
136 // If we're compiling a forward DFA and we aren't anchored, then

Callers 15

test_match_is_booleanMethod · 0.80
test_searchMethod · 0.80
test_matchMethod · 0.80
test_findallMethod · 0.80
test_finditerMethod · 0.80
cmd_capturesFunction · 0.80
cmd_compileFunction · 0.80
buildMethod · 0.80
c_classMethod · 0.80
mainFunction · 0.80
compile_simpleFunction · 0.80

Calls 15

compile_oneMethod · 0.80
compile_manyMethod · 0.80
unwrapMethod · 0.80
resetMethod · 0.80
is_noneMethod · 0.80
peekMethod · 0.80
c_utf8_seqMethod · 0.80
fillMethod · 0.80
fill_to_nextMethod · 0.80
push_split_holeMethod · 0.80
fill_splitMethod · 0.80
lenMethod · 0.45

Tested by 5

test_match_is_booleanMethod · 0.64
test_searchMethod · 0.64
test_matchMethod · 0.64
test_findallMethod · 0.64
test_finditerMethod · 0.64