diff options
Diffstat (limited to 'src/builder.cpp')
-rw-r--r-- | src/builder.cpp | 26 |
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 | ||
3 | subExceptionDef( BuildException ); | ||
4 | |||
3 | Builder::Builder() | 5 | Builder::Builder() |
4 | { | 6 | { |
5 | } | 7 | } |
@@ -9,22 +11,42 @@ Builder::~Builder() | |||
9 | } | 11 | } |
10 | 12 | ||
11 | void yyparse( Builder &bld ); | 13 | void yyparse( Builder &bld ); |
14 | extern int yydebug; | ||
12 | 15 | ||
13 | void Builder::load( const std::string &sFile ) | 16 | void 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 | ||
21 | void Builder::error( YYLTYPE *locp, const char *msg ) | 25 | void 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 | ||
26 | void Builder::error( const std::string &msg ) | 35 | void 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 | |||
41 | int Builder::getTargetType( const char *sType ) | ||
42 | { | ||
43 | if( !strcmp( sType, "file" ) ) | ||
44 | return 0; | ||
45 | return -1; | ||
46 | } | ||
47 | |||
48 | bool Builder::isFunction( const char *sFunc ) | ||
49 | { | ||
50 | return true; | ||
29 | } | 51 | } |
30 | 52 | ||