
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
--
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+un...@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAFjzj-%2Bh7bXZMpp0n4OKFK%2B9Jegj9J%2BX9xhC7Lo7YomrDZ1mDg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CA%2Bc1-%2B_4nJb%3D3POZ5L5X0LEndj0YHyndJTCmc0FkPBLH29h6ig%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6JoAcMDO2JeLNqv-m0XWNODvz%3DWTUH%3Dg8sEVfRv4brEqA%40mail.gmail.com.