finished scanner.c with some errors. needs testing