[DGD] parse_string regular_expression

bart at wotf.org bart at wotf.org
Mon Apr 12 20:55:02 CEST 2010


Keep in mind that when defining tokens for parse_string, / denotes the
beginning and end of a regular expression.

So, a token that matches C style comments /* comment */ would be defined by:

comment = /\\/\\*([^*]|\\*+[^/*])*\\*\\//

taken from Dworkin's LPC grammar for parse_string as used by
http://mud.wotf.org/downloads/lpc/happycode.c

Bart.

On Mon, 12 Apr 2010 00:50:48 -0700, Shentino wrote
> Regarding malformedness...
> 
> //[^*\n]+/
> 
> Appears to be interpreted an empty regex "//" followed by
> gibberish...apparently one too many slashes at the beginning
> 
> /\\/\*(.*?)\*\//
> 
> /, escaped \, /, then more stuff outside the regex.
> 
> My guess is that you fell victim to a couple of typos.
> ___________________________________________
> 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