/*
 * Lexical Parser (header)
 *
 * Author(s) : Catalin Dumitrescu (catalind@acm.org)
 *
 * File: token.hh
 * Created: Mon Aug 27 10:15:57 CDT 2001
 *
 */

#ifndef _TOKEN_
#define _TOKEN_


#include <fstream>
#include <string>
#include <strstream>
using namespace std;

#include "scheme_exc.hh"

class tokenException : public schemeException {
public:
  tokenException (string s) : schemeException (s) { }
};


class token {
  istream *in;
  int back_count;
  string back;
  string spaces;

public:
  token ();
  token (const char*);
  virtual ~token ();

  void setSpaces (string);

  string getNext () throw (schemeException);
  string getNext (string) throw (schemeException);
  void putBack (string) throw (schemeException);
  void putBack (char) throw (schemeException);

  friend token& operator >> (token& t, string& s) 
    { s = t.getNext (); return t; }
  friend token* operator >> (token* t, string& s) 
    { (*t) >> s; return t; }

};


#endif // _TOKEN_
