added file extension detection and cleaner lexer definition