Moved the ply module around

This commit is contained in:
melonhead@grimace 2009-11-12 18:20:21 -05:00
parent bfe427b69d
commit 653a5a6575
6 changed files with 6 additions and 11 deletions

View File

@ -22,20 +22,15 @@
#----------------------------------------------------------------- #-----------------------------------------------------------------
import sys import sys
# This is not required if you've installed pycparser into
# your site-packages/ with setup.py
#
sys.path.insert(0, '..')
from pycparser import c_parser, c_ast from pycparser import c_parser, c_ast
def explain_c_declaration(c_decl): def explain_c_declaration(c_decl):
""" Parses the declaration in c_decl and returns a text """ Parses the declaration in c_decl and returns a text
explanation as a string. explanation as a string.
The last external node of the string is used, to allow The last external node of the string is used, to allow
earlier typedefs for used types. earlier typedefs for used types.
""" """
parser = c_parser.CParser() parser = c_parser.CParser()
@ -51,9 +46,9 @@ def explain_c_declaration(c_decl):
return _explain_decl_node(node.ext[-1]) return _explain_decl_node(node.ext[-1])
def _explain_decl_node(decl_node): def _explain_decl_node(decl_node):
""" Receives a c_ast.Decl note and returns its explanation in """ Receives a c_ast.Decl note and returns its explanation in
English. English.
""" """
#~ print decl_node.show() #~ print decl_node.show()
storage = ' '.join(decl_node.storage) + ' ' if decl_node.storage else '' storage = ' '.join(decl_node.storage) + ' ' if decl_node.storage else ''
@ -64,8 +59,8 @@ def _explain_decl_node(decl_node):
_explain_type(decl_node.type)) _explain_type(decl_node.type))
def _explain_type(decl): def _explain_type(decl):
""" Recursively explains a type decl node """ Recursively explains a type decl node
""" """
typ = type(decl) typ = type(decl)