Example #1
0
def parse_replace(text, parser_state):
    '''
    Parse a "replacement" (eg for `re.sub`).

    Returns (parser_state, graph)
    '''
    return parse(text, parser_state, ReplacementBuilder, mutable_flags=False)
Example #2
0
def parse_replace(text, parser_state):
    '''
    Parse a "replacement" (eg for `re.sub`).

    Returns (parser_state, graph)
    '''
    return parse(text, parser_state, ReplacementBuilder, mutable_flags=False)
Example #3
0
def parse_pattern(text, engine, flags=0, alphabet=None):
    '''
    Parse a standard regular expression.
    '''
    from lepl.rxpy.compat.support import default_alphabet
    alphabet = default_alphabet(alphabet, text)
    parser_state = ParserState(alphabet=alphabet, flags=flags,
                        refuse=engine.REFUSE, require=engine.REQUIRE)
    return parse(text, parser_state, SequenceBuilder)
Example #4
0
def parse_pattern(text, engine, flags=0, alphabet=None):
    '''
    Parse a standard regular expression.
    '''
    from lepl.rxpy.compat.support import default_alphabet
    alphabet = default_alphabet(alphabet, text)
    parser_state = ParserState(alphabet=alphabet,
                               flags=flags,
                               refuse=engine.REFUSE,
                               require=engine.REQUIRE)
    return parse(text, parser_state, SequenceBuilder)