h/plugins/explain.py

16 lines
357 B
Python
Raw Normal View History

2009-11-13 02:11:10 +00:00
from util import hook
2009-11-12 23:05:07 +00:00
from pycparser.cdecl import explain_c_declaration
@hook.command('explain')
def explain(inp):
".explain <c expression> -- gives an explanation of C expression"
2009-11-12 23:05:07 +00:00
if not inp:
return explain.__doc__
2009-11-13 02:11:10 +00:00
try:
result = explain_c_declaration(inp.rstrip())
except e:
result = str(e)
return result