/*******************************************************************\

Module:

Author: Daniel Kroening, kroening@cs.cmu.edu

\*******************************************************************/

#ifndef XML_PARSER_H
#define XML_PARSER_H

#include <parser.h>

#include "xml_parse_tree.h"

int yyxmlparse();

class xml_parsert:public parsert
{
public:
  xml_parse_treet parse_tree;

  std::list<xmlt *> stack;
  
  xmlt &current()
  {
    return *stack.back();
  }
   
  virtual bool parse()
  {
    return yyxmlparse();
  }
  
  void new_level()
  {
    current().elements.push_back(xmlt());
    stack.push_back(&current().elements.back());
  }

  virtual void clear()
  {
    parse_tree.clear();
    // set up stack
    stack.clear();
    stack.push_back(&parse_tree.element);
  }
};

extern xml_parsert xml_parser;

int yyxmlerror(const std::string &error);

#endif
