Open ESNV opened 5 years ago
Sure. This can probably be implemented by using python's ast
module, and parsing the selected code to see if its a single expression:
import ast
# ok: Wrap it in a print (text)
ast.parse('x+1', mode='eval')
# not expression: raises exception
ast.parse('x=x+1', mode='eval')
SyntaxError: invalid syntax
# not expression: raises exception
ast.parse('x=0; x+=1; print x', mode='eval')
SyntaxError: invalid syntax
Hi,
Would it be possible to mimic in MayaSublime some of the REPL that exists in Maya's Script Editor?
For example, after first executing an assignment: foo = 'bar' then by highlighting and running only the "foo" part get: 'bar' as the output/result, instead of having to do: print(foo)
Cheers! Lalo.