Coloring markup simply...

Afanasiy abelikov72 at hotmail.com
Fri Sep 5 01:20:45 EDT 2003


What's the best method for coloring simple markup?

<xyz att="val" att="val">

You can assume it is not HTML or XML or valid anything
except markup which happens to look somewhat like them.

You can assume xyz < > = and " always exist for each tag.

What methods are usually employed?

I am not exactly looking for a boxed or roundabout solution using a big
3rd party package. I am curious and want something simple and/or clever.
I would like to know what the common methods for doing this might be.

If re supported some sort of nesting/recursion I think I could do it, but
it seems it does not, so I am currently using a bunch of re expressions,
and it's not exactly fun. I am considering a straight parser with finite
state machine instead... but I thought I'd ask... What other methods?

( p.s. The coloring aspect is not exactly important, as long as
  whatever the method is would allow me to color it, ie. parse it )




More information about the Python-list mailing list