Le 2 mars 2012 11:26, Jeff Hardy a écrit :
> On Fri, Mar 2, 2012 at 5:31 AM, Tuomas Utrecht
> wrote:
> > I have body of possible Excel formulas which are identical to Python
> syntax,
> > except for the use of ^.
>
> If that's the case, why not rewrite them as strings instead (i.e.
> s/^/**/g),
On Fri, Mar 2, 2012 at 5:31 AM, Tuomas Utrecht wrote:
> I have body of possible Excel formulas which are identical to Python syntax,
> except for the use of ^.
If that's the case, why not rewrite them as strings instead (i.e.
s/^/**/g), and then pass them to IronPython?
- Jeff
__
No, my case is taking Excel formula strings into a C# application,
redefining ^ to be ** and evaluating expressions in the context of a larger
Python module which may override built-in and third-party Excel functions.
Thank you for the information, though.
Le 2 mars 2012 00:00, Vernon Cole a écr
Le 1 mars 2012 21:58, Curt Hagenlocher a écrit :
> I would argue that this is a bad idea. How Python-compatible do you want
> this simple Excel-like language to be?
>
I have body of possible Excel formulas which are identical to Python
syntax, except for the use of ^.
> If it's really just a s
Err, ummm, ...
Are you perhaps trying to reinvent Resolver 1 -- a spreadsheet written in
Python? Maybe I misunderstand what you are trying to do, but you may want
to look at it, unless you cannot use a commercial product.
On Mar 1, 2012 7:58 PM, "Curt Hagenlocher" wrote:
> I would argue that this
I would argue that this is a bad idea. How Python-compatible do you want
this simple Excel-like language to be? If it's really just a small subset
of the full Python language, you may be better off writing a simple parser
that emits Python text as its back end and prevents the users from doing
anyt
[email protected]
[mailto:[email protected]] On Behalf Of
Tuomas Utrecht
Sent: Thursday, March 01, 2012 4:01 PM
To: [email protected]
Subject: Re: [Ironpython-users] Modifying ASTs when embedding IronPython
Ok, I'
Ok, I'm going to read up on this, but to confirm, I'd need something like
the following (from reading
http://stackoverflow.com/questions/7944521/interrupt-interpreted-user-code-in-silverlight
)?
public class ExpressionRewriter : ExpressionVisitor
{
protected override Expression VisitBinary(Bin
The ASTs are generally immutable so to re-write you'll create a copy of the AST
and any parent nodes. The ExpressionVisitor class makes this easy in that you
can override VisitExtension method and re-write any Python nodes you care about
there. You return a modified node somewhere within the t