[DGD] parse_string() help

bart at wotf.org bart at wotf.org
Tue Feb 23 22:35:15 CET 2010


I made a small example based on an earlier mail

http://wotf.org/downloads/lpc/colorize.c

Its merely an example of how you could do this with help of parse_string, it
can probably be beautified and improved quite a bit :)

Bart.

On Tue, 23 Feb 2010 11:43:46 -0600, Joe wrote
> bart at wotf.org wrote:
> > Hi Joseph,
> >
> > On Wed, 10 Feb 2010 0:45:48 -0500, aishiteru wrote
> >   
> >> Greetings,
> >>
> >> I am a newbie to DGD in general and am completely out of my element 
> >> in terms of regexp and parse_string(); however, I need help with a 
> >> command I am making to colorize an lpc file.  For starters, I have a 
> >> simple workroom.c file as follows:
> >>     
> >
> > <snip>
> >
> > Looks like you are running Gurbalib?
> >
> >   
> >> What I am trying to do is parse any of the lpc files on our mud into 
> >> a colorized output for easier viewing.  For instance, in this 
> >> command, I'd have the following defines:
> >>     
> >
> > <snip> 
> >
> > Doing this based on (a modified version of) the grammar you posted should be
> > possible, but formatting will be lost on the way, and it won't deal with
> > incomplete fragments of code. Also, it regards preprocessor statements as
> > whitespace.
> >
> > Beyond that, using an LPC grammar seems overkill, since you are interested in
> > marking tokens, not in actual syntax.
> >
> >   
> >> Any ideas on where I can go from here?  Any help would be greatly 
> >> appreciated by me and the admins of my mud.  Thanks in advance and I 
> >> apologize for my inexperience.
> >>     
> >
> > Well, my first suggestion would be to try some smaller things with
> > parse_string. It is a very powerful tool, but has somewhat of a steep learning
> > curve, and trying to use it with a big grammar is probably not the easiest way
> > to get upto speed with it. 
> >
> > Bart
> > --
> > Created with Open WebMail at http://www.bartsplace.net/
> > Read my weblog at http://soapbox.bartsplace.net/
> >
> > ___________________________________________
> > https://mail.dworkin.nl/mailman/listinfo/dgd
> >
> >   
> Yes, I'm running on a modified Gurbalib.  Since, ideally, I'd like 
> to maintain the format of the LPC file, or even properly indent it 
> when it is parsed for colors, do you have any suggestions?  I had 
> done this on a TMI-2 mudlib and had used reg_assoc() to separate all 
> the tokens.  If using an LPC grammar is overkill, what would you 
> suggest?  Again, I'm new to this and, while I think I'm bright 
> enough to muddle through it, I don't have a clue where to start.
> 
> Joseph
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd


--
Created with Open WebMail at http://www.bartsplace.net/
Read my weblog at http://soapbox.bartsplace.net/




More information about the DGD mailing list