Terminal* 
Grammar::getNamedNode ( Terminal & node, const string & name )
   {
  // This function only operates on the parent chain.

  // We only want to output non-source-position dependent constructors for SgLocatedNodes. Test for this.
     Terminal* parentNode = node.getBaseClass();
#if 0
     string parentNodeName;
     if (parentNode != NULL)
        {
          parentNodeName = parentNode->getName();
       // printf ("parentNodeName = %s \n",parentNodeName.c_str());
        }
  // printf ("In Grammar::getNamedNode(): name = %s \n",name.c_str());
#endif

     while ( parentNode != NULL && string(parentNode->getName()) != name )
  // while ( (parentNode != NULL) && (parentNodeName != name) )
        {
       // printf ("node %s parent node: %s \n",name.c_str(),parentNode->getName().c_str());
          parentNode = parentNode->getBaseClass();
        }

     if (parentNode != NULL)
        {
       // printf ("Found node %s parent node: %s \n",name.c_str(),parentNode->getName().c_str());
        }

     return parentNode;
   }
StringUtility::FileWithLineNumbers
Grammar::buildConstructorWithoutSourcePositionInformation ( Terminal & node )
   {
  // DQ (11/6/2006): This function generates the code for a newer form of the constructor 
  // that has not source position information in it's parameter list.  This new form of the constructor
  // is easier to work with and separates the details of maintaining the source position information from
  // the construction of the IR node within the AST.


  // Build the constructors for each class
  // Example:
  // /* this is the generated constructor */
  // ClassDeclaration::ClassDeclaration 
  //    ( Name name, int class_type, ClassType* type, ClassDefinition* definition)
  //    : DeclarationStatement(NULL)
  //    {
  //      p_name = name;
  //      p_class_type = class_type;
  //      p_type = type;
  //      p_definition = definition;
  //   /* now a call to the user defined intialization function */
  //      post_construction_initialization();
  //    }

     string className = node.getName();

     StringUtility::FileWithLineNumbers returnString;


  // We only want to output non-source-position dependent constructors for SgLocatedNodes. Test for this.
     Terminal* parentNode = getNamedNode ( node, "SgLocatedNode" );

  // We only want to output non-source-position dependent constructors for SgLocatedNodes.
     if (parentNode != NULL && node.generateConstructor() == true)
        {
          string constructorTemplateFileName = "../Grammar/grammarConstructorDefinitionMacros.macro";
          StringUtility::FileWithLineNumbers constructorSourceCodeTemplate = Grammar::readFileWithPos (constructorTemplateFileName);

          bool complete  = false;
          ConstructParamEnum config = CONSTRUCTOR_PARAMETER;
          if  (node.getBuildDefaultConstructor())
             {
               config = NO_CONSTRUCTOR_PARAMETER;
             }

          StringUtility::FileWithLineNumbers constructorSource = constructorSourceCodeTemplate;
          if (node.getBaseClass() != NULL)
             {
               string parentClassName = node.getBaseClass()->getName();
            // printf ("In Grammar::buildConstructor(): parentClassName = %s \n",parentClassName);
            // printf ("Calling base class default constructor (should call paramtererized version) \n");

               string baseClassParameterString = "";
               bool withInitializers = false;
               bool withTypes        = false;
               baseClassParameterString = buildConstructorParameterListString (*node.getBaseClass(),withInitializers,withTypes, config);
               string preInitializationString = ": " + parentClassName + "($BASECLASS_PARAMETERS)";
               preInitializationString = StringUtility::copyEdit (preInitializationString,"$BASECLASS_PARAMETERS",baseClassParameterString);
               constructorSource = StringUtility::copyEdit (constructorSource,"$PRE_INITIALIZATION_LIST",preInitializationString);
             }
            else
             {
               constructorSource = StringUtility::copyEdit (constructorSource,"$PRE_INITIALIZATION_LIST","");
             }

          bool withInitializers         = false;
          bool withTypes                = true;
          string constructorParameterString = buildConstructorParameterListString (node,withInitializers,withTypes,config,&complete);
          constructorSource = StringUtility::copyEdit (constructorSource,"$CONSTRUCTOR_PARAMETER_LIST",constructorParameterString);
          constructorSource = StringUtility::copyEdit (constructorSource,"$CLASSNAME",className);

          if (config == NO_CONSTRUCTOR_PARAMETER)
             {
               constructorSource = StringUtility::copyEdit (constructorSource,"$CONSTRUCTOR_BODY","");
             }
            else
             {
               string constructorFunctionBody = node.buildConstructorBody(withInitializers, config);
               constructorSource = StringUtility::copyEdit (constructorSource,"$CONSTRUCTOR_BODY",constructorFunctionBody);
             }

          returnString.insert(returnString.end(), constructorSource.begin(), constructorSource.end());
        }

     returnString = StringUtility::copyEdit(returnString,"$GRAMMAR_PREFIX_","Sg");

     return returnString;
   }