Re: [Pyparsing] Efficency of Keyword (and a couple other bits)
Brought to you by:
ptmcg
From: Corrin L. <Cor...@da...> - 2007-03-19 22:55:18
|
Hi Eike, Yes, I'm using Keyword("STREET")|Keyword("ROAD"). The SQL pulls a list of street types from the database, the Keyword(" + x + ") turns the list into keywords, and the eval creates a pyparsing rule for it. Not the easiest code to read by a long way :( The problem is that five hundred strings seperated by | is much less efficient than Word(alphas) -----Original Message----- From: pyp...@li... [mailto:pyp...@li...] On Behalf Of Eike Welk Sent: Tuesday, March 20, 2007 11:45 AM To: pyp...@li... Subject: Re: [Pyparsing] Efficency of Keyword (and a couple other bits) Hello Corrin! On Monday 19 March 2007 21:06, Corrin Lakeland wrote: > So, any ideas or suggestions welcomed, especially with respect to the=20 > Keyword issue. There is the 'Keyword' parser, it does probably what you want. Usage: mathFuncs =3D Keyword('sin') | Keyword('cos') | Keyword('tan') I use code similar to this in my toy language. Regards Eike. ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V _______________________________________________ Pyparsing-users mailing list Pyp...@li... https://lists.sourceforge.net/lists/listinfo/pyparsing-users |