Mercurial > python-cmd2
comparison cmd2.py @ 172:c01f8e612a0a
\n\n finally works
author | catherine@dellzilla |
---|---|
date | Fri, 12 Dec 2008 10:14:01 -0500 |
parents | 0b93f1a4076c |
children | 10a45c030364 |
comparison
equal
deleted
inserted
replaced
171:0b93f1a4076c | 172:c01f8e612a0a |
---|---|
385 pyparsing.Optional(pipe + pyparsing.SkipTo(outputParser ^ stringEnd)('pipeTo')) + \ | 385 pyparsing.Optional(pipe + pyparsing.SkipTo(outputParser ^ stringEnd)('pipeTo')) + \ |
386 pyparsing.Optional(outputParser + pyparsing.SkipTo(stringEnd).setParseAction(lambda x: x[0].strip())('outputTo')) | 386 pyparsing.Optional(outputParser + pyparsing.SkipTo(stringEnd).setParseAction(lambda x: x[0].strip())('outputTo')) |
387 if self.caseInsensitive: | 387 if self.caseInsensitive: |
388 multilineCommand.setParseAction(lambda x: x[0].lower()) | 388 multilineCommand.setParseAction(lambda x: x[0].lower()) |
389 oneLineCommand.setParseAction(lambda x: x[0].lower()) | 389 oneLineCommand.setParseAction(lambda x: x[0].lower()) |
390 blankLineTerminator = (pyparsing.Literal('\n') + pyparsing.stringEnd)('terminator') | |
391 if self.blankLinesAllowed: | 390 if self.blankLinesAllowed: |
392 subparser0 = pyparsing.NoMatch | 391 subparser0 = pyparsing.NoMatch |
393 else: | 392 else: |
394 subparser0 = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') | 393 blankLineTerminator = (pyparsing.Literal('\n') + pyparsing.stringEnd)('terminator') |
394 subparser0 = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + blankLineTerminator)('statement') | |
395 subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + | 395 subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + |
396 pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements) | 396 pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements) |
397 #subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + | 397 #subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + |
398 # pyparsing.Optional(pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip()))('suffix') + afterElements) | 398 # pyparsing.Optional(pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip()))('suffix') + afterElements) |
399 subparser2 = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') + | 399 subparser2 = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') + |