%{ #include "lexer.h" #include "parser.tab.h" int line_number; %} %option noyywrap %% \n { line_number++; return(NL); } STOP { return(STOP); } SEQ { return(SEQ); } [ ]* /* Ignore spaces */ --.*\n { line_number++; } /* Pass over comments */ . error("Lexical error", "Unrecognised input.\n"); %% void initialise_lexer(FILE* input) { yyin = input; line_number = 1; }