![]() |
Some parsers
Well, lately when I didn't have subscription I felt like.. making parsers for some really odd reason, don't ask why :(
Anyways, PHP Code:
PHP Code:
It will parse all variables and functions it finds :) I'll also use this thread to post my other parsers that I've made, so.. have fun? xD (PS: I know they probably isn't for good use, butI learnt much out of making parsers so by reading them or making your own, you learn how things works :o) |
PHP Code:
PHP Code:
output is "Hi Zeo and CHOMPI!" (OH, who see it? Hidden 'easter egg') It will parse all variables and functions it finds Basicly this parser detects if it should parse a variable or a function, and works from there. |
PHP Code:
PHP Code:
PHP Code:
NPC Code: |
Very nice! I think someone already made one of these though
|
Quote:
|
Quote:
|
Quote:
|
Actually I made an xml parser/generator: http://forums.graalonline.com/forums....php?p=1314210
http://forums.graalonline.com/forums...ad.php?t=74882 the object from XML is slightly buggy, it doesn't support objects in arrays under 2 levels. Nice work though :) |
Quote:
|
Ahh, Chompy. Always parsing something. You, sir, are the parse-master.
|
Quote:
|
PHP Code:
Btw, this parses lines, not just only tags! :p In next update of this (1.2) I'll add a function to parse tags only So it can parse: PHP Code:
(Parsers that I make will work clientside aswell, if they don't, not much is needed to make them work clientside!) NOTE TO MODS: Do you guys mind renaming the thread to "Some parsers"? |
Quote:
|
Quote:
|
Quote:
|
Quote:
PHP Code:
PHP Code:
(I'd like to point out that the period disappeared.) :( e: I see you're using if (~some_index). Helpful hint: the engine has to perform twice as many tasks this way. It is more efficient to use the old fashioned if (some_index >= 0). [I know that I used it too...] |
Quote:
Quote:
Will improve it, thanks PFA :D |
Tag Parser v0.1
Ok, I just noticed this thread, and I felt like I had to continue on it. So, I did what PFA suggested/pointed out and added support for multiple tags:
PHP Code:
PHP Code:
PHP Code:
|
Well done!
Tried with this: PHP Code:
|
Thanks PFA <3 :D
|
Tag Parser v0.2
PHP Code:
Now, example: PHP Code:
And, suggestions for what more to support etc. are welcome :) |
Variable parser v0.1
PHP Code:
PHP Code:
Edit: Could a moderator rename the thread to "Some parsers"? |
PHP Code:
An example of usage: PHP Code:
|
CHOMPY!!!!!!!!!!!
UR GOING TO GO INSANE!!!!! TOO .... MANY ... PARSERS!!!! Good job though :) |
Quote:
Well, they're.. sometimes frustrating to make but you learn from it.. Anyways, going to update some of the older parsers soon if I become bored..! Hehe, I've released 8 parsers in this thread :p |
Ok, well I figured to try to make a simple DTD parser *cough* pfa *cough*
Anyways, here's my try on it.. PHP Code:
PHP Code:
Atm it supports optional variables (The ? indicates that an element is optional). The thing is, if you look at the line <!ELEMENT note (to,from,heading,body,signature?)>, in the parenthesis, are the variables that will be declared. If the variable has a '?' behind it, then it's optional. If it does not have a '?' behind, it must be set inside the <note> ... </note> declaration or it will return an error Currently stuff it supports: -Making variables optional -Error and Syntax checking At the moment it doesn't support sub roots (it doesn't support: NPC Code: yet since I haven't added support for multiple elements). I might add that later though.. if I get into editing this again.. Ang again, I dunno if this is a DTD parser at all or if it is any good.. so.. feedback would be nice :o |
PHP Code:
example: PHP Code:
Todo: -Multiple roots (plus root container) -Maybe add more types (woohoo, I've released 10 parsers in all in this thread xD) |
So, essentially, it's an XML parser with a small amount of recognition for doctype declarations where doctype declarations aren't even needed, or are barely even used by the script? What would I use this for in GScript?
|
Quote:
I make these for practice and when I'm bored, but if you see no use for them I suppose I should be making something that is usable..? I just make different parsers, what other people will use them for, I don't know. But fine, won't release anymore parsers.. Need to find something else to make then >_> |
Quote:
|
Quote:
And, by JSON, you mean parsing something like.. NPC Code: and turn it into something like NPC Code: just curious, a JSON interpreter sounds interesting, but I dunno if I fully understand what 'interpreter' means.. so.. dunno if the stuff above is correct |
Quote:
|
| All times are GMT +2. The time now is 04:21 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.