예제 #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]
예제 #2
0
def phrase_list_filler():
    """parser for filler words"""
    return (Parse.word('we').possibly() +
            first_word('put write have know see') +
            Parse.word('that').possibly()).nil()