aboutsummaryrefslogtreecommitdiff
path: root/src/builder.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/builder.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/builder.cpp b/src/builder.cpp
index 1ecbf05..b6ae887 100644
--- a/src/builder.cpp
+++ b/src/builder.cpp
@@ -1,5 +1,7 @@
1#include "builder.h" 1#include "builder.h"
2 2
3subExceptionDef( BuildException );
4
3Builder::Builder() 5Builder::Builder()
4{ 6{
5} 7}
@@ -9,22 +11,42 @@ Builder::~Builder()
9} 11}
10 12
11void yyparse( Builder &bld ); 13void yyparse( Builder &bld );
14extern int yydebug;
12 15
13void Builder::load( const std::string &sFile ) 16void Builder::load( const std::string &sFile )
14{ 17{
15 file = sFile; 18 file = sFile;
16 scanBegin(); 19 scanBegin();
20 yydebug = 1;
17 yyparse( *this ); 21 yyparse( *this );
18 scanEnd(); 22 scanEnd();
19} 23}
20 24
21void Builder::error( YYLTYPE *locp, const char *msg ) 25void Builder::error( YYLTYPE *locp, const char *msg )
22{ 26{
23 printf("%s\n", msg ); 27 fflush( stdout );
28 throw BuildException("%s: %d.%d-%d.%d: %s",
29 file.c_str(),
30 locp->first_line, locp->first_column,
31 locp->last_line, locp->last_column,
32 msg );
24} 33}
25 34
26void Builder::error( const std::string &msg ) 35void Builder::error( const std::string &msg )
27{ 36{
28 printf("%s\n", msg.c_str() ); 37 fflush( stdout );
38 throw BuildException("%s", msg.c_str() );
39}
40
41int Builder::getTargetType( const char *sType )
42{
43 if( !strcmp( sType, "file" ) )
44 return 0;
45 return -1;
46}
47
48bool Builder::isFunction( const char *sFunc )
49{
50 return true;
29} 51}
30 52