h/plugins/explain.py

17 lines
371 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"
if not inp:
return explain.__doc__
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