aboutsummaryrefslogtreecommitdiff
path: root/src/tafreader.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-11-09 22:38:47 +0000
committerMike Buland <eichlan@xagasoft.com>2007-11-09 22:38:47 +0000
commit2ab64959d83ed2793d71ab3fa03b8ebdd4925902 (patch)
tree5417aeff1cadeb36793cfee3bc0733b2b6c77f44 /src/tafreader.cpp
parentbb9c0dc8dd2c852d9b6e89b9fd883232019cea93 (diff)
downloadlibbu++-2ab64959d83ed2793d71ab3fa03b8ebdd4925902.tar.gz
libbu++-2ab64959d83ed2793d71ab3fa03b8ebdd4925902.tar.bz2
libbu++-2ab64959d83ed2793d71ab3fa03b8ebdd4925902.tar.xz
libbu++-2ab64959d83ed2793d71ab3fa03b8ebdd4925902.zip
Figured I might as well add single-line comments to taf, it now supports //
style comments.
Diffstat (limited to 'src/tafreader.cpp')
-rw-r--r--src/tafreader.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/tafreader.cpp b/src/tafreader.cpp
index 5609f7c..efcb3d9 100644
--- a/src/tafreader.cpp
+++ b/src/tafreader.cpp
@@ -49,6 +49,8 @@ void Bu::TafReader::groupContent( Bu::TafGroup *pGroup )
49 return; 49 return;
50 else if( c == '/' && la == '*' ) 50 else if( c == '/' && la == '*' )
51 pGroup->addChild( readComment() ); 51 pGroup->addChild( readComment() );
52 else if( c == '/' && la == '/' )
53 pGroup->addChild( readComment( true ) );
52 else if( c == ':' ) 54 else if( c == ':' )
53 throw TafException("Encountered stray ':' in taf stream."); 55 throw TafException("Encountered stray ':' in taf stream.");
54 else 56 else
@@ -71,22 +73,43 @@ Bu::TafProperty *Bu::TafReader::readProperty()
71 //printf(" %s = %s\n", sName.getStr(), sValue.getStr() ); 73 //printf(" %s = %s\n", sName.getStr(), sValue.getStr() );
72} 74}
73 75
74Bu::TafComment *Bu::TafReader::readComment() 76Bu::TafComment *Bu::TafReader::readComment( bool bEOL )
75{ 77{
76 next();
77 FString sCmnt; 78 FString sCmnt;
78 for(;;) 79 next();
80 if( bEOL )
79 { 81 {
80 next(); 82 for(;;)
81 if( c == '*' && la == '/' )
82 { 83 {
83 next(); next(); 84 next();
84 break; 85 if( c == '\n' && la == '\r' )
86 {
87 next(); next();
88 break;
89 }
90 else if( c == '\n' || c == '\r' )
91 {
92 next();
93 break;
94 }
95 sCmnt += c;
96 }
97 }
98 else
99 {
100 for(;;)
101 {
102 next();
103 if( c == '*' && la == '/' )
104 {
105 next(); next();
106 break;
107 }
108 sCmnt += c;
85 } 109 }
86 sCmnt += c;
87 } 110 }
88 111
89 return new TafComment( sCmnt ); 112 return new TafComment( sCmnt, bEOL );
90} 113}
91 114
92Bu::FString Bu::TafReader::readStr() 115Bu::FString Bu::TafReader::readStr()