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-19 03:20:59 +00:00
|
|
|
".explain <c expression> -- gives an explanation of C expression"
|
2009-11-12 23:05:07 +00:00
|
|
|
if not inp:
|
2009-11-19 03:20:59 +00:00
|
|
|
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
|