Parsing Indented Text (like parsing Python)

alisonken1 alisonken1 at gmail.com
Tue Mar 13 23:22:42 CET 2007


On Mar 11, 2:34 am, "Mike Schinkel" <mikeschin... at gmail.com> wrote:
> Hi,
>
> I'm relatively new to Python but have lots of prior programming experience
> as a developer, instructor, and author (ASP/VBScript/SQL Server and
> Clipper.)
>

<snip>

> --
> -Mike Schinkelhttp://www.mikeschinkel.com/blogs/http://www.welldesignedurls.orghttp://atlanta-web.org-http://t.oolicio.us

Well, when the Master Chief and I were writing Clipper code too many
moons ago, we wrote a basic script that read the text, along with a
list of keywords (indent kw, matching detent kw).

All leading whitespace was removed as the line was read, then keeping
track of the appropriate current level of indent, re-write the leading
whitespace.

For printouts, we would add the appropriate IBM characters for lines
to keep track of matching indent/detent kw's were and could keep track
of where the routines would fall off due to incorrect detent kw usage.

If you don't know what the context is as far as indent/detent kw's
are, then it gets to be a problem figuring it out unless there is
specified characters used to indicate indent/detent issues.




More information about the Python-list mailing list