PSP.BraceConverter | index /usr/local/share/webware/PSP/BraceConverter.py

`BraceConverter.py
Contributed 2000-09-04 by Dave Wallace (dwallace@delanet.com)
Converts Brace-blocked Python into normal indented Python.
Brace-blocked Python is non-indentation aware and blocks are
delimited by ':{' and '}' pairs.
Thus:
for x in range(10) :{
if x%2 :{ print x } else :{ print z }
}
Becomes (roughly, barring some spurious newlines):
for x in range(10) :
if x%2 :
print x
else :
print z
This implementation is fed a line at a time via parseLine(),
outputs to a PSPServletWriter, and tracks the current quotation
and block levels internally.`

Modules
`` |  |
re | sys |  |

Classes
`` |  | __builtin__.object BraceConverter
class BraceConverter(__builtin__.object)
`` |  | Methods defined here: __init__(self) closeBrace(self, writer) `Close brace encountered.` handleQuote(self, quote, writer) `Check and handle if current pos is a single or triple quote.` openBlock(self, writer) `Open a new block.` openBrace(self, writer) `Open brace encountered.` parseLine(self, line, writer) `Parse a line. The only public method of this class, call with subsequent lines and an instance of PSPServletWriter.` skipquote(self, writer) `Skip to end of quote. Skip over all chars until the line is exhausted or the current non-escaped quote sequence is encountered.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: COLONBRACE = <_sre.SRE_Pattern object> CSKIP = <_sre.SRE_Pattern object>