diff options
Diffstat (limited to '')
-rw-r--r-- | src/tafreader.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tafreader.cpp b/src/tafreader.cpp index c5ef8cc..2918454 100644 --- a/src/tafreader.cpp +++ b/src/tafreader.cpp | |||
@@ -15,7 +15,7 @@ using namespace Bu; | |||
15 | Bu::TafReader::TafReader( Bu::Stream &sIn ) : | 15 | Bu::TafReader::TafReader( Bu::Stream &sIn ) : |
16 | c( 0 ), | 16 | c( 0 ), |
17 | sIn( sIn ), | 17 | sIn( sIn ), |
18 | iLine( 1 ), iCol( 1 ) | 18 | iLine( 1 ), iCol( -1 ) |
19 | { | 19 | { |
20 | next(); next(); | 20 | next(); next(); |
21 | } | 21 | } |
@@ -29,18 +29,21 @@ Bu::TafGroup *Bu::TafReader::readGroup() | |||
29 | { | 29 | { |
30 | ws(); | 30 | ws(); |
31 | if( c != '{' ) | 31 | if( c != '{' ) |
32 | throw TafException("Expected '{' at %d:%d.", iLine, iCol ); | 32 | throw TafException("%d:%d: Expected '{' got '%c'.", iLine, iCol, c ); |
33 | next(); | 33 | next(); |
34 | ws(); | 34 | ws(); |
35 | FString sName = readStr(); | 35 | FString sName = readStr(); |
36 | TafGroup *pGroup = new TafGroup( sName ); | 36 | TafGroup *pGroup = new TafGroup( sName ); |
37 | ws(); | ||
38 | if( c != ':' ) | ||
39 | throw TafException("%d:%d: Expected ':' got '%c'.", iLine, iCol, c ); | ||
37 | next(); | 40 | next(); |
38 | //printf("Node[%s]:\n", sName.getStr() ); | 41 | //printf("Node[%s]:\n", sName.getStr() ); |
39 | 42 | ||
40 | groupContent( pGroup ); | 43 | groupContent( pGroup ); |
41 | 44 | ||
42 | if( c != '}' ) | 45 | if( c != '}' ) |
43 | throw TafException("Expected '}' at %d:%d.", iLine, iCol ); | 46 | throw TafException("%d:%d: Expected '}' got '%c'.", iLine, iCol, c ); |
44 | 47 | ||
45 | //next(); | 48 | //next(); |
46 | 49 | ||
@@ -64,7 +67,8 @@ void Bu::TafReader::groupContent( Bu::TafGroup *pGroup ) | |||
64 | else if( c == '/' && la == '/' ) | 67 | else if( c == '/' && la == '/' ) |
65 | pGroup->addChild( readComment( true ) ); | 68 | pGroup->addChild( readComment( true ) ); |
66 | else if( c == ':' ) | 69 | else if( c == ':' ) |
67 | throw TafException("Encountered stray ':' in taf stream at %d:%d.", iLine, iCol ); | 70 | throw TafException("%d:%d: Encountered stray ':' in taf stream.", |
71 | iLine, iCol ); | ||
68 | else | 72 | else |
69 | pGroup->addChild( readProperty() ); | 73 | pGroup->addChild( readProperty() ); |
70 | } | 74 | } |
@@ -154,7 +158,8 @@ Bu::FString Bu::TafReader::readStr() | |||
154 | else if( c == 't' ) | 158 | else if( c == 't' ) |
155 | c = '\t'; | 159 | c = '\t'; |
156 | else | 160 | else |
157 | throw TafException("Invalid escape sequence at %d:%d.", iLine, iCol ); | 161 | throw TafException("%d:%d: Invalid escape sequence '\\%c'.", |
162 | iLine, iCol, c ); | ||
158 | } | 163 | } |
159 | else if( c == '"' ) | 164 | else if( c == '"' ) |
160 | break; | 165 | break; |
@@ -195,6 +200,7 @@ bool Bu::TafReader::isws() | |||
195 | 200 | ||
196 | void Bu::TafReader::next() | 201 | void Bu::TafReader::next() |
197 | { | 202 | { |
203 | printf("%d:%d: read '%c' (%d)\n", iLine, iCol, c, c ); | ||
198 | if( c == '\n' ) | 204 | if( c == '\n' ) |
199 | { | 205 | { |
200 | iLine++; | 206 | iLine++; |