On 07/08/2013 02:03 PM, David Beazley wrote:
I like this idea, although having some kind of default caching scheme is also 
useful for people who just don't want to think about it.

You can see writing the table to /tmp as a layer on top of this proposal.
A simple approach could be to add a method

3. setupTable()
   Reads and/or writes the table data to /tmp using methods 1 & 2.
   It should be able to detect whether a table has already been supplied, making it a 
"pass" method.

"supply a table" should also be true after calling 1, imho.


The open question is whether you have to do 3 explicitly or not.

If yes, and the user calls 3 before parsing, which does all the table & file magic (unless 2 is done first, due to the "pass" reduction mentioned above).
If he doesn't call 3 beforehand, the "internal generate fallback" is performed.

If no, then 3 is done automatically before or during the first parse if 2 is not done. The fallback to internal generation could then be a call to 1, and never save the returned data.


I would prefer the explicit call, but both options seem viable.


On Jul 8, 2013, at 6:55 AM, "A.T.Hofkamp" <[email protected]> wrote:

On 07/08/2013 01:24 PM, David Beazley wrote:
So, I was thinking about the PLY parsetab.py file this morning. What would 
people think if the
data contained in this file was simply written somewhere in the system 
temporary directory (e.g.,

What about giving the user two extra methods

1. get_table_data()
   Generates the parser data table, and returns it to the caller. Simplest 
would be a string of some kind or so, ie a native data type easily handled if 
you don't care about the contents.

2. set_table_data(data)
   User provides the table data obtained from 1 at some point in the past.

Also

If no table has been provided before the first parse, generate the table during 
the first parse internally. Just keep the table internally in memory, during 
the life time of the praser object.


--
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ply-hack/51DAAE1F.8040001%40tue.nl.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to