aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-08-04 21:01:05 +0000
committerMike Buland <eichlan@xagasoft.com>2006-08-04 21:01:05 +0000
commit13bda5d4f77ca469bbbe0d9b1f268682a9f0ec71 (patch)
treebcacd0acb83d68c5071165d26ba253d9c6f217da /src
parent1190030155a43c15fd7e30c8e8c3a9f166955365 (diff)
downloadbuild-13bda5d4f77ca469bbbe0d9b1f268682a9f0ec71.tar.gz
build-13bda5d4f77ca469bbbe0d9b1f268682a9f0ec71.tar.bz2
build-13bda5d4f77ca469bbbe0d9b1f268682a9f0ec71.tar.xz
build-13bda5d4f77ca469bbbe0d9b1f268682a9f0ec71.zip
Better error handling again, and about to add more language features.
Diffstat (limited to 'src')
-rw-r--r--src/build.y7
-rw-r--r--src/builder.cpp10
-rw-r--r--src/builder.h2
3 files changed, 12 insertions, 7 deletions
diff --git a/src/build.y b/src/build.y
index 4d87a86..bf565fb 100644
--- a/src/build.y
+++ b/src/build.y
@@ -244,10 +244,5 @@ rulecompletion: TOK_COMMAND STRING
244 244
245void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ) 245void yyerror( YYLTYPE *locp, Builder &bld, char const *msg )
246{ 246{
247 fprintf( stderr, "%s:%d-%d:%d-%d: %s\n", 247 bld.error( locp, msg );
248 bld.file.c_str(),
249 locp->first_line, locp->last_line,
250 locp->first_column, locp->last_column,
251 msg
252 );
253} 248}
diff --git a/src/builder.cpp b/src/builder.cpp
index 3bcd593..d3cb2c0 100644
--- a/src/builder.cpp
+++ b/src/builder.cpp
@@ -563,3 +563,13 @@ void Builder::error( const std::string &err )
563 throw BuildException( err.c_str() ); 563 throw BuildException( err.c_str() );
564} 564}
565 565
566void Builder::error( YYLTYPE *locp, const std::string &err )
567{
568 fprintf( stderr, "%s:%d-%d:%d-%d: %s\n",
569 file.c_str(),
570 locp->first_line, locp->last_line,
571 locp->first_column, locp->last_column,
572 err.c_str()
573 );
574}
575
diff --git a/src/builder.h b/src/builder.h
index 152b969..06e84f3 100644
--- a/src/builder.h
+++ b/src/builder.h
@@ -39,7 +39,7 @@ public:
39 void build( const char *sAct=NULL ); 39 void build( const char *sAct=NULL );
40 void execute( Action *pAct ); 40 void execute( Action *pAct );
41 41
42 //void error( const yy::location &l, const std::string &m ); 42 void error( YYLTYPE *locp, const std::string &m );
43 void error( const std::string &m ); 43 void error( const std::string &m );
44 44
45 std::string file; 45 std::string file;