Python pyparsing.StringEnd() Examples

The following are 1 code examples of pyparsing.StringEnd(). 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: julian.py    From pds-tools with Academic Free License v3.0 5 votes vote down vote up
def sec_from_string(string):
    """Returns a second value based on a parsing of a time string."""

    # Give the list zero values for each parameter, in case they are missing
    # from the list returned
    parser = jdp.TIME + pyparsing.StringEnd()
    list = ([["HOUR",0],["MINUTE",0],["SECOND",0]] +
            parser.parseString(string).asList())
    dict = _dict_from_parselist(list)

    return _sec_from_dict(dict)

########################################