Python pyparsing.CaselessKeyword() Examples

The following are 3 code examples of pyparsing.CaselessKeyword(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyparsing , or try the search function .
Example #1
Source File: operators.py    From plyse with MIT License 5 votes vote down vote up
def __init__(self, name, symbols, implicit=False):
        symbols_ = [Literal(s) if len(s) == 1 else CaselessKeyword(s) for s in symbols]
        super(Operator, self).__init__(concatenate(symbols_, operator='OR'))

        self.name = name
        self.implicit = implicit 
Example #2
Source File: terms.py    From plyse with MIT License 5 votes vote down vote up
def __init__(self, keyword_name, possible_values, separator=':', parse_method=None, allow_other_values=True):

        _values = concatenate(possible_values, operator="LONGEST_OR", class_to_embed_elem=CaselessKeyword)

        if allow_other_values:
            _values ^= SimpleWord()

        super(KeywordTerm, self).__init__(CaselessKeyword(keyword_name) + Literal(separator) + _values)

        self.name = keyword_name
        self.values = possible_values

        if parse_method:
            self.setParseAction(parse_method) 
Example #3
Source File: delta_time.py    From pyparsing with MIT License 5 votes vote down vote up
def make_integer_word_expr(int_name, int_value):
    return pp.CaselessKeyword(int_name).addParseAction(pp.replaceWith(int_value))