Exemplo n.º 1
0
def lit(s):
    """parser generator for 's'-like words or phrases"""
    if s in ['record', 'doc', 'location']:
        if s == 'record':
            return (Parse.word('we').possibly() +
                    first_word('record register') +
                    Parse.word('identification').possibly() +
                    Parse.word('that').possibly())
        if s == 'doc':
            return lit['document'] | lit['end-document']
        if s == 'location':
            return Parse.first(
                [lit_dict['document'], lit_dict['theorem'], lit_dict['axiom']])
    return lit_dict[s]
Exemplo n.º 2
0
def phrase_list_transition():
    """parser for transition phrases"""
    prs = [next_phrase(s) for s in word_lists.transition]
    return (Parse.first(prs) + next_word('that').possibly()).nil()