#include <iostream>

#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TTransportUtils.h>

#include "gen-cpp/PhabricatorParserPrivate.h"

using namespace std;
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;

int main() {
  boost::shared_ptr<TTransport> socket(new TSocket("/tmp/phabricator-parser"));
  boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
  boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
  PhabricatorParserPrivateClient client(protocol);

  string text =
"= Large Header =         \n \
                        \n\
== Smaller Header ==      \n\
                        \n\
## This is a Header As Well\n\
                        \n\
Also a Large Header       \n\
===================       \n\
                        \n\
Also a Smaller Header     \n\
---------------------";
  try {
    transport->open();


    for (int i=0; i<answer.size(); ++i){
        Block b = answer[i];
        cout << b.start << " " << b.num_lines << " " << b.rule << endl;
    }

 cout << answer.size();

  } catch (TException& tx) {
    cout << "ERROR: " << tx.what() << endl;
  }
}
