Python pyparsing.CaselessLiteral() Examples

The following are 2 code examples of pyparsing.CaselessLiteral(). 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: expansions.py    From pyjsgf with MIT License 5 votes vote down vote up
def _make_matcher_element(self):
        # Return a case-sensitive or case-insensitive pyparsing Literal element.
        text = self._text
        if self.case_sensitive:
            matcher_cls = pyparsing.Literal
        else:
            matcher_cls = pyparsing.CaselessLiteral
        return self._set_matcher_element_attributes(matcher_cls(text)) 
Example #2
Source File: wordsToNum.py    From pyparsing with MIT License 5 votes vote down vote up
def makeLit(s, val):
    ret = pp.CaselessLiteral(s)
    return ret.setParseAction(pp.replaceWith(val))