-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Dear Eric,
On 05.01.2015 08:43, Eric S. Johansson wrote: > what's a good open editor ( preferably multiplatform) that > actually decomposes Python code into fundamental components such as > class, expression, etc. and, lets you operate on those components? > this is in contrast to editors such as Emacs which give you some > fundamental pieces you can operate on but it's really character > oriented and all of the syntax smartness not really available for > coupling to speech recognition environment. it would be great if it > was in Python so I don't have to learn yet another fricking > language. As a first iteration, I would try with any editor written in Python. Are you familiar with the ast[1] module? It could be worth trying to use this module and perform some kind of pattern matching on the results to recover the information. In case you don’t know, the module produces a tree of objects representing the syntactic representation of the Python code. The example you gave should be easily recoverable from the AST representation, assuming togglename has run through (appearantly, the code is not valid python without the togglename transformation). I would start small in that case. At some point, one would probably need a XML Stylesheet-ish transformation language (not neccessarily in XML; the main point is that you may need complex matching rules). For the beginning, hardcoded rules might suffice, and for the cases where it doesn’t work, you could persue Chris’ approach of falling back to spelled-out code. Basically, you could formalize your template language to operate on ASTs and write a pattern matcher recognizing ASTs which have been generated from a given template. Hope this helps. I find that topic pretty interesting. Is there anything I can follow to see progress on this? regards, jwi [1]: https://docs.python.org/3/library/ast.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJUqlq8AAoJEMBiAyWXYliKrJQP/A/w8DBbgzXVPdqkwvE+/LRJ WVuB2+QiAbj8XU84m0w1HPJ5KWMJfmHp/mSCLy/ZoP46LrE+lpuJvNMjbeiijZ1x jERfJ2Jvi2ylGtPPh4HSaLKeVqSIoSipj0aZSyqqVmLQ6vce15B4TuviXvHgE7pi SXDUtNdiE8K4VFM1ltvFqwDBgCF579Fk900LD4g4SNxNFVK4jlbeLgP+bCwPFZ4q 5Nf3PcEal20C5a8LqIkXbxdip68nGJV3nqQUZGmbDWboeBNN7ZdF5/1q1/Hv6f52 +AQbvtKOzO8NOse/ViR4X+TCUIfejdnl5HPRhCz7kWo/E+UyisC1UQhelawr2rJZ ldvIjyZ58a4Uh7O1FoK3Kl6WOXoC8Dsf0F0VKSC5UtqsQwvWKhE+cm0kyLC2+dBt 0LkhSguSJHgAIl8cXtdPpP90Db1ggSkqUmLnL8XkHarwLrEwELQDri2NGL56jJiC hhumbHVAZXiH/erW/DencIVQsYMmjMhiLI6ioaktT7TxTvSOgu54JLTepzANSJ3t tuOgNyCRXpmhPLCho4qZT11agbcfDRVwOXjblhG6lc3eJxHmx13Evw7I4Zf0G80j ddQtOBbGgVmIg99/8dwT6eNLwTTc+793vOV0JgEk9n41U9oU9PbYrdKOcoLgrtyN bMAvdd71Zmys0Cq+DYZB =V4tl -----END PGP SIGNATURE----- -- https://mail.python.org/mailman/listinfo/python-list