Index: src/Common/SemanticError.cc
===================================================================
--- src/Common/SemanticError.cc	(revision fc1ef6262344eb2eb531046aed824827d0a0909f)
+++ src/Common/SemanticError.cc	(revision 9ed4f946a9631dd56fe6ab84e440eee3341514be)
@@ -10,21 +10,16 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 07:21:25 2015
-// Update Count     : 1
+// Last Modified On : Tue Aug 29 18:17:35 2017
+// Update Count     : 3
 //
 
-#include <cstdio>            // for fileno, stderr
-#include <unistd.h>          // for isatty
-#include <iostream>          // for basic_ostream, operator<<, ostream
-#include <list>              // for list, _List_iterator
-#include <string>            // for string, operator<<, operator+, to_string
+#include <cstdio>										// for fileno, stderr
+#include <unistd.h>										// for isatty
+#include <iostream>										// for basic_ostream, operator<<, ostream
+#include <list>											// for list, _List_iterator
+#include <string>										// for string, operator<<, operator+, to_string
 
-#include "Common/utility.h"  // for to_string, CodeLocation (ptr only)
+#include "Common/utility.h"								// for to_string, CodeLocation (ptr only)
 #include "SemanticError.h"
-
-inline const std::string& error_str() {
-	static std::string str = isatty( fileno(stderr) ) ? "\e[31merror:\e[39m " : "error: ";
-	return str;
-}
 
 SemanticError::SemanticError() {
@@ -49,6 +44,6 @@
 void SemanticError::print( std::ostream &os ) {
 	using std::to_string;
-	for(auto err : errors) {
-		os << to_string( err.location ) << err.description << '\n';
+	for( auto err : errors ) {
+		os << to_string( err.location ) << err.description << std::endl;
 	}
 }
Index: src/Common/SemanticError.h
===================================================================
--- src/Common/SemanticError.h	(revision fc1ef6262344eb2eb531046aed824827d0a0909f)
+++ src/Common/SemanticError.h	(revision 9ed4f946a9631dd56fe6ab84e440eee3341514be)
@@ -9,17 +9,18 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Andrew Beach
-// Last Modified On : Thr Aug 17 14:01:00 2017
-// Update Count     : 7
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Aug 29 22:03:36 2017
+// Update Count     : 17
 //
 
 #pragma once
 
-#include <exception>  // for exception
-#include <iostream>   // for ostream
-#include <list>       // for list
-#include <string>     // for string
+#include <exception>									// for exception
+#include <iostream>										// for ostream
+#include <list>											// for list
+#include <string>										// for string
+#include <unistd.h>										// for isatty
 
-#include "CodeLocation.h"  // for CodeLocation, toString
+#include "CodeLocation.h"								// for CodeLocation, toString
 
 struct error {
@@ -28,7 +29,7 @@
 
 	error() = default;
-	error( const std::string& str ) : description( str ) {}
+	error( const std::string & str ) : description( str ) {}
 
-	void maybeSet( const CodeLocation& location ) {
+	void maybeSet( const CodeLocation & location ) {
 		if( this->location.linenumber < 0 ) {
 			this->location = location;
@@ -41,15 +42,20 @@
 	SemanticError();
 	SemanticError( std::string error );
-	template< typename T > SemanticError( const std::string &error, const T *obj );
+	template< typename T > SemanticError( const std::string & error, const T * obj );
 	~SemanticError() throw() {}
 
-	void append( SemanticError &other );
+	static inline const std::string & error_str() {
+		static std::string str = isatty( STDERR_FILENO ) ? "\e[31merror:\e[39m " : "error: ";
+		return str;
+	}
+
+	void append( SemanticError & other );
 	void append( const std::string & );
 	bool isEmpty() const;
-	void print( std::ostream &os );
+	void print( std::ostream & os );
 
-	void set_location( const CodeLocation& location );
-	// constructs an exception using the given message and the printed
-	// representation of the obj (T must have a print method)
+	void set_location( const CodeLocation & location );
+	// constructs an exception using the given message and the printed representation of the obj (T must have a print
+	// method)
   private:
 	std::list< error > errors;
@@ -57,5 +63,5 @@
 
 template< typename T >
-SemanticError::SemanticError( const std::string &error, const T *obj ) {
+SemanticError::SemanticError( const std::string & error, const T * obj ) {
 	append( toString( error, obj ) );
 }
Index: src/Parser/lex.ll
===================================================================
--- src/Parser/lex.ll	(revision fc1ef6262344eb2eb531046aed824827d0a0909f)
+++ src/Parser/lex.ll	(revision 9ed4f946a9631dd56fe6ab84e440eee3341514be)
@@ -10,6 +10,6 @@
  * Created On       : Sat Sep 22 08:58:10 2001
  * Last Modified By : Peter A. Buhr
- * Last Modified On : Tue Aug 22 22:43:39 2017
- * Update Count     : 558
+ * Last Modified On : Wed Aug 30 07:53:24 2017
+ * Update Count     : 583
  */
 
@@ -19,5 +19,5 @@
 
 %{
-// This lexer assumes the program has been preprocessed by cpp. Hence, all user level preprocessor directive have been
+// The lexer assumes the program has been preprocessed by cpp. Hence, all user level preprocessor directive have been
 // performed and removed from the source. The only exceptions are preprocessor directives passed to the compiler (e.g.,
 // line-number directives) and C/C++ style comments, which are ignored.
@@ -25,6 +25,10 @@
 //**************************** Includes and Defines ****************************
 
+unsigned int column = 0;								// position of the end of the last token parsed
+#define YY_USER_ACTION column += yyleng;				// trigger before each matching rule's action
+
 #include <string>
 #include <cstdio>										// FILENAME_MAX
+using namespace std;
 
 #include "ParseNode.h"
@@ -32,13 +36,13 @@
 
 char *yyfilename;
-std::string *strtext;									// accumulate parts of character and string constant value
+string *strtext;										// accumulate parts of character and string constant value
 
 #define RETURN_LOCN(x)		yylval.tok.loc.file = yyfilename; yylval.tok.loc.line = yylineno; return( x )
-#define RETURN_VAL(x)		yylval.tok.str = new std::string( yytext ); RETURN_LOCN( x )
+#define RETURN_VAL(x)		yylval.tok.str = new string( yytext ); RETURN_LOCN( x )
 #define RETURN_CHAR(x)		yylval.tok.str = nullptr; RETURN_LOCN( x )
 #define RETURN_STR(x)		yylval.tok.str = strtext; RETURN_LOCN( x )
 
 #define WHITE_RETURN(x)		// do nothing
-#define NEWLINE_RETURN()	WHITE_RETURN( '\n' )
+#define NEWLINE_RETURN()	column = 0; WHITE_RETURN( '\n' )
 #define ASCIIOP_RETURN()	RETURN_CHAR( (int)yytext[0] ) // single character operator
 #define NAMEDOP_RETURN(x)	RETURN_CHAR( x )			// multichar operator, with a name
@@ -154,5 +158,5 @@
 		memcpy( &filename, begin_string + 1, length );	// copy file name from yytext
 		filename[ length ] = '\0';						// terminate string with sentinel
-		//std::cout << "file " << filename << " line " << lineno << std::endl;
+		//cout << "file " << filename << " line " << lineno << endl;
 		yylineno = lineno;
 		yyfilename = filename;
@@ -302,5 +306,5 @@
 
 				/* character constant, allows empty value */
-({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new std::string( yytext, yyleng ); }
+({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); }
 <QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); }
 <QUOTE>['\n]	{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
@@ -308,5 +312,5 @@
 
 				/* string constant */
-({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new std::string( yytext, yyleng ); }
+({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); }
 <STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); }
 <STRING>["\n]	{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
@@ -422,8 +426,14 @@
 }
 
-				/* unknown characters */
-.				{ printf("unknown character(s):\"%s\" on line %d\n", yytext, yylineno); }
+				/* unknown character */
+.				{ yyerror( "unknown character" ); }
 
 %%
+// ----end of lexer----
+
+void yyerror( const char * errmsg ) {
+	cout << (yyfilename ? yyfilename : "*unknown file*") << ':' << yylineno << ':' << column - yyleng + 1
+		 << ':' << SemanticError::error_str() << errmsg << " at token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << '"' << endl;
+}
 
 // Local Variables: //
Index: src/Parser/parser.yy
===================================================================
--- src/Parser/parser.yy	(revision fc1ef6262344eb2eb531046aed824827d0a0909f)
+++ src/Parser/parser.yy	(revision 9ed4f946a9631dd56fe6ab84e440eee3341514be)
@@ -10,6 +10,6 @@
 // Created On       : Sat Sep  1 20:22:55 2001
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Aug 28 13:24:10 2017
-// Update Count     : 2720
+// Last Modified On : Wed Aug 30 07:04:19 2017
+// Update Count     : 2740
 //
 
@@ -48,9 +48,11 @@
 #include <cstdio>
 #include <stack>
+using namespace std;
+
 #include "ParseNode.h"
 #include "TypedefTable.h"
 #include "TypeData.h"
 #include "LinkageSpec.h"
-using namespace std;
+#include "Common/SemanticError.h"						// error_str
 
 extern DeclarationNode * parseTree;
@@ -3133,13 +3135,4 @@
 // ----end of grammar----
 
-extern char *yytext;
-
-void yyerror( const char * ) {
-	if ( yyfilename ) {
-		cout << yyfilename << ":";
-	} // if
-	cout << yylineno << ":1 syntax error at token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << endl;
-}
-
 // Local Variables: //
 // mode: c++ //
