h/plugins/explain.py

16 lines
344 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):
2009-11-18 00:38:48 +00:00
".explain <c expression> -- gives an explanation of x expression"
2009-11-12 23:05:07 +00:00
if not inp:
2009-11-13 02:11:10 +00:00
return ""
try:
result = explain_c_declaration(inp.rstrip())
except e:
result = str(e)
return result