Hi Oscar, Many thanks for this, I see. I just went through the documentation and I found the transformations. I guess I will have to add this to the standard transformations (e.g. (merge_double_colon, ) + standard_transformations) so as to work.
BW Giorgino On Thu, Nov 11, 2021 at 10:22 AM Oscar Gustafsson < oscar.gustafs...@gmail.com> wrote: > This behavior is from the Python tokenizer. > > > In [13]: input_code = StringIO('l_::p+3') > > In [14]: list(generate_tokens(input_code.readline)) > > Out[14]: > > [TokenInfo(type=1 (NAME), string='l_', start=(1, 0), end=(1, 2), > line='l_::p+3'), > > TokenInfo(type=54 (OP), string=':', start=(1, 2), end=(1, 3), > line='l_::p+3'), > > TokenInfo(type=54 (OP), string=':', start=(1, 3), end=(1, 4), > line='l_::p+3'), > > TokenInfo(type=1 (NAME), string='p', start=(1, 4), end=(1, 5), > line='l_::p+3'), > > TokenInfo(type=54 (OP), string='+', start=(1, 5), end=(1, 6), > line='l_::p+3'), > > TokenInfo(type=2 (NUMBER), string='3', start=(1, 6), end=(1, 7), > line='l_::p+3'), > > TokenInfo(type=4 (NEWLINE), string='', start=(1, 7), end=(1, 8), line=''), > > TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), > line='')] > > > I guess you can add a transformation that merges NAME, OP=':', OP=':', > NAME sequences into a single name token. > > > BR Oscar > > > > Den tors 11 nov. 2021 kl 10:43 skrev Giorgino R <giorgino...@gmail.com>: > >> Hi all, >> >> I am using `parse_exr` to parse some strings as sympy symbols and then >> generate cxx code with `cxxcode`. When I use an expression with double >> colon, parse_expr is trying to split it. In contrast, if I define this >> expression with Sympy Symbol, I can create cxx code (see below). >> >> [image: image.png] >> >> Any idea how I could overwrite this behavior in `parse_expr`? >> Many thanks in advance, >> Giorgino >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sympy+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/CA%2Bc1-%2B-iMn8BiYWU3T23yb2_Yj3ASTW3LDiy6DWr149TJRGJkg%40mail.gmail.com >> <https://groups.google.com/d/msgid/sympy/CA%2Bc1-%2B-iMn8BiYWU3T23yb2_Yj3ASTW3LDiy6DWr149TJRGJkg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAFjzj-%2Bh7bXZMpp0n4OKFK%2B9Jegj9J%2BX9xhC7Lo7YomrDZ1mDg%40mail.gmail.com > <https://groups.google.com/d/msgid/sympy/CAFjzj-%2Bh7bXZMpp0n4OKFK%2B9Jegj9J%2BX9xhC7Lo7YomrDZ1mDg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CA%2Bc1-%2B_4nJb%3D3POZ5L5X0LEndj0YHyndJTCmc0FkPBLH29h6ig%40mail.gmail.com.