Documentation ideas for indentedBlock
Brought to you by:
ptmcg
- It should be also mentioned in the doc-string, that the 'indentStack' argument has to be initialized with [1].
- Changing the characters which are recognized as whitespace should be explained; and the use of LineEnd() to signify the end of a statement. This is what most users of indentedBlock will probably want.
Maybe the following two lines should be recommended (at beginning of parser construction):
#end of line terminates statements,
#so it is not regular whitespace
ParserElement.setDefaultWhitespaceChars('\t ')
#the matching end of line token
newline = LineEnd().suppress()
- Some example code or maybe a helper function to get Python's behavior with respect to statements would be extra nice (IMHO).
Yes, I think a static helper method, something like useLineBasedParsing, that included these statements would be good. Also, '\'+EOL continuation processing would be a good feature to add to such a method - see the Discussion threads on the pyparsing wiki home page on this topic.
And I can update the docstring for indentedBlock - I just got bit by that myself the other day.