예제 #1
0
파일: replace.py 프로젝트: gcarothers/lepl
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)
예제 #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)
예제 #3
0
파일: pattern.py 프로젝트: gcarothers/lepl
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)
예제 #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)