Posts Tagged parser
Update on the BBCode parser
Posted by admin in News and updates on July 10th, 2009
Last night I posted about me beginning the creation of a brand new BBCode parser which had the potential of allowing nested tags… Of course it has been done
But I myself haven’t done it, until now!
After working on the new function for hours (And adding ~320 more lines of code) I am getting really close to finishing the new product which allows nested tags! XD. I have yet to test how fast it is because it isn’t fully finished, but it is getting there! However, I am quite sure it will be much faster than the older one because it just used regex to find tags on the message, one after another, and regex on a huge message isn’t that fast.
I hope to finish this tomorrow! As long as I don’t run into any major problems.
New BBCode parser?
Posted by admin in Developer updates on July 9th, 2009
I was working on SnowCMS (Yeah, I am back again
), and I started to become super annoyed that the same BBCode tags cannot be nested within one another. So in just a couple minutes, I tried to figure out a way to get those to work. I tried doing something like this before, but for the life of me, I couldn’t get it!
Not to long ago I began pondering how I could approach this problem, and how other systems do it. I then thought, XML! I remembered that in PHP using XML Parser it parses the XML file into levels with by tags, and that is how I am approaching it
I already have a very very very (Did I say very?) rough prototype, only ~32 lines of code, the function parses this string:
[b]Hello there![/b] [i]Why? [color=red]CAUSE![/color][/i]
Into:
Array
(
[1] => [b]
[2] => Hello there!
[3] => [/b]
[4] =>
[5] => [i]
[6] => Why?
[7] => [color=red]
[8] => CAUSE!
[9] => [/color]
[11] => [/i]
)
Right now it isn’t parsed very pretty like
But for the time being, it works for the most part! I can’t wait to dig deeper into this idea tomorrow… Seeya for now! (It is 12:15AM at the time I am posting this, Lol)