Coloring markup simply...

A

Afanasiy

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 )
 
A

Andrei

Originally posted by Afanasiy
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.



Have you looked at the SGML parser? I think that one should be able to
parse text like that. You get the tag and its attributes from it for
each tag. It shouldn't matter what the tags and attribs are.



Andrei


--
Contact info (decode with rot13): (e-mail address removed)
Fcnzserr! Cyrnfr qb abg hfr va choyvp zrffntrf. V ernq gur yvfg, ab arrq gb PP.


Posted via http://dbforums.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,102
Messages
2,570,646
Members
47,248
Latest member
MargretYhh

Latest Threads

Top