#include <stdio.h>
#include "lexer.h"
#include "keyword.h"
#include "stdlib.h"

int main(int argc, char **argv)
{
  int idx = 0;
  
  if( argc<2 ) {
    printf("usage: hsc <file>\n");
    exit(1);
  }
  OpenFile(argv[1]);
  printf("item  - line col - type     value    text\n");
  while( token.type!=TK_EOF ) {
    printf("%05d - ", idx);
    printf("%04d ", token.line);
    printf("%03d - ", token.col);
    printf("%08x ", token.type);
    printf("%08x ", token.value);
    printf("%s\n", token.text);
    NextToken();
    idx++;
  }
  CloseFile();
  return 0;
}

void hsc_abort(char *str)
{
  printf("\n\nError in line %d, column %d: %s\n\n", token.line, token.col, str);
  exit(1);
}