Nonrecursive, stack based BBCode parser

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

mator
Forum Newbie
Posts: 11
Joined: Sat Aug 19, 2006 1:23 am

Post by mator »

Not an option, would require some massive restructuring. BBCodes are the only way to go.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

The reason you want it to be nonrecursive is because of performance?
mator
Forum Newbie
Posts: 11
Joined: Sat Aug 19, 2006 1:23 am

Post by mator »

What I mean by nonrecurisve is that I don't call another instance of the parser to handle the attributes. Some parts of this system would have to be recursive in order to make things more managable.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Well, you could split parsing into BLOCK and INLINE, and call the INLINE parser.
mator
Forum Newbie
Posts: 11
Joined: Sat Aug 19, 2006 1:23 am

Post by mator »

pardon?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Well, there's block level tags like quote and inline level tags like bold. Split up processing for them, then you call just the inline processing when you have an attribute.
Post Reply