pythonverse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pythonverse-devel] Proposed changes


From: Sean R. Lynch KG6CVV
Subject: [Pythonverse-devel] Proposed changes
Date: 19 Mar 2002 13:26:03 -0800

The current implementation of the parser in OpenVerse.py makes adding
new server commands require a little more typing than it should. I was
thinking of two possible options that would only require adding code in
one place rather than writing the entry for the table of server commands
*and* adding a method.

One way would be to just have the parser look for a method called
cmd_<keyword> and then call that method with the whole string, allowing
each method to do its own parsing. Each method could just call split on
the string with the number of arguments it was looking for, and then
convert on its own. Regular expressions just add more flexibility than
we need. Ryoko was on the right track for doing a general parser, but
the format that the server uses is restricted enough that we don't
really need regular expressions for parsing. This is the method I'm
leaning toward.

The other way would be to use the existing regular expression-based
parsing, but instead of using a tuple of conversion functions and a
method pointer, use a string that gets compiled into Python code and
execute the code with the matched groups in the regular expression
assigned to variables. This is how I do parsing with FrogGirl, but
that's because i needed the flexibility.

I was also thinking of maybe passing images as strings, which is a
pretty standard way to represent images in Python, rather than having
the client provide an image loading function. This would allow backends
to support proprietary image formats without the frontends even needing
any sort of image loader since all they'd need is a fromstring function.
The disadvantage is that the backends would then need to depend on an
image loading library even though the frontend's GUI library might
already have an image loader.

Comments?

-- 
Sean R. Lynch KG6CVV  http://www.chaosring.org/~seanl/

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]