/*
 * This file is part of the Cforall project
 *
 * A singleton class to encapsulate the bison-generated parser
 *
 * $Id: Parser.h,v 1.4 2002/09/09 16:47:14 rcbilson Exp $
 *
 */

#ifndef PARSER_H
#define PARSER_H

#include <cstdio>

#include "Parser/ParseNode.h"
#include "LinkageSpec.h"

class Parser
{
public:
  static Parser &get_parser();

  /* do the actual parse */
  void parse( FILE *input );

  /* accessors to return the result of the parse */
  DeclarationNode *get_parseTree() const { return parseTree; }
  int get_parseStatus() const { return parseStatus; }

  /* mutators to control parse options */
  void set_debug( bool debug );
  void set_linkage( LinkageSpec::Type linkage );

  /* free the parse tree without actually destroying the parser */
  void freeTree();

  ~Parser();

private:
  Parser();
  static Parser *theParser;
  DeclarationNode *parseTree;
  int parseStatus;
};

#endif /* #ifndef PARSER_H */
