h/plugins/explain.py

15 lines
324 B
Python
Raw Normal View History

from util import hook
from pycparser.cdecl import explain_c_declaration
2010-03-01 02:32:41 +00:00
@hook.command
def explain(inp):
".explain <c expression> -- gives an explanation of C expression"
inp = inp.encode('utf8', 'ignore')
2010-03-01 02:32:41 +00:00
try:
return explain_c_declaration(inp)
except Exception, e:
return 'error: %s' % e