Provide Interpreter nodes for common
Brought to you by:
mcfletch
Make the common library provide interpreter nodes for
the common data types, such that each node is a
callable item that returns a value
(re-entrant/thread-safe) and can be included as an
instance/object in a Parser namespace.
from simpleparse.common import strings, numbers
class MyParser( Parser ):
string = strings.StringInterpreter()
number = numbers.NumerInterpreter()
Such that, if we include the production, we can also
include a stand-alone interpreter that converts the
value to a usable Python value. Obviously that's only
useful for simple data types, but it would make for
easier use of the libraries (and avoid poluting the
user's parser class with sub-production rules).
Logged In: YES
user_id=34901
This is a somewhat difficult task with the current
architecture, the code doesn't allow for passing in the
string-being-parsed to the processing functions (assumes
it's stored in the parser). Likely best to rewrite the
functions that currently exist to allow passing in the
string (which should help overall re-entrancy).
Logged In: YES
user_id=34901
Okay, revised the architecture to support the passing of
buffer along everywhere, also did an actual test of the
library items (and fixed the errors that showed up (still
more to test)).