i did some changes in regex expressions (in parsing->mathematica->parse
method

       (r"(.*\))(\(.*)", #Parenthesized implied multiplication
            lambda m:Parser.parse(m.group(1)) + "*" +
Parser.parse(m.group(2)) ),

        (r"\A(.*[\w\.])(\(.*)\Z", #Implied multiplication - a(b)
            lambda m: Parser.parse(m.group(1)) + "*" +
Parser.parse(m.group(2))  ),

        (r"\A(.*\))([\w\.].*)\Z", #Implied multiplication - (a)b
            lambda m: Parser.parse(m.group(1)) + "*" +
Parser.parse(m.group(2)) ),


        (r"\A(.*[\d\.]+)([a-zA-Z].*)\Z", #Implied multiplicatin - 2a
            lambda m: Parser.parse(m.group(1)) + "*" +
Parser.parse(m.group(2)) ),

and these regex expressions seems to be working fine. Can you please verify
?

On Fri, Nov 25, 2011 at 6:10 PM, Joachim Durchholz <[email protected]> wrote:

> Am 25.11.2011 03:18, schrieb Aaron Meurer:
>
>  I think the problem is that you can't parse this with regular
>> expressions.  You need a more advanced parser.
>>
>
> Actually, there are two ways to use regular expressions to parse
> parenthesized expressions.
>
> Way 1: Do a search-and-replace, replacing parenthese pairs that don't
> contain parentheses with a marker text (that cannot otherwise occur inside
> the string). Keep a dictionary or markers to strings.
> The dictionary ends up being a kind of parse tree.
> This is actually quite fast assuming that the RE engine and
> search-and-replace operations are faster than a handcoded parser, something
> that tends to be true for scripting languages.
>
> Way 2: Use a Perl-compatible regular expression engine. PCRE engines do
> have support for parsing nested parentheses, see
> http://www.pcre.org/pcre.txt and search for "recursive back references".
> That support is limited both in what can be parsed and what you can do
> with the parse, so it may or may not help in this particular case.
>
> Regards,
> Jo
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to sympy+unsubscribe@**
> googlegroups.com <sympy%[email protected]>.
> For more options, visit this group at http://groups.google.com/**
> group/sympy?hl=en <http://groups.google.com/group/sympy?hl=en>.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to