// Tokenizer.h  P. Conrad, CISC220 06J
// A class that tokenizes input


#ifndef TOKENIZER_H
#define TOKENIZER_H

#include <iostream>
using std::istream;
using std::ostream;

class Tokenizer_C
{
 public:
  Tokenizer_C(istream & theInput,
		   ostream & theOutput) :
    in(theInput), out(theOutput) // initialize
    { 
      line=1; pos=1; state=S0_START; token="";
    }

  void tokenize(); // do the work.. read from "in", send output to "out"

 private:
  
  enum State_E { S0_START,
		 S1_VARIABLE,
		 S2_INT, 
		 S3,
		 S4_DOUBLE,
                 S5_OPERATOR}; // the states
  
  State_E state; // current state

  void process(char c);

  // references to (aliases for) input stream and output stream

  istream & in;
  ostream & out;

  int line;
  int pos;

  std::string token; // accumulate the characters of the token
   

};

#endif

