From ecedf7a7d87553116c570ba789b6405ac5eff92d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 26 Aug 2007 04:12:51 +0000 Subject: Corrected a bug in the Bu::TafReader, it was getting confused when a stray colon (common in web addresses) was put in the middle of a property list, now it doesn't get confused, it just complains bitterly and refuses to work. --- src/tafreader.cpp | 2 ++ src/tests/taf.cpp | 8 ++++---- test.taf | 13 ++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/tafreader.cpp b/src/tafreader.cpp index db465e9..0d28cd0 100644 --- a/src/tafreader.cpp +++ b/src/tafreader.cpp @@ -49,6 +49,8 @@ void Bu::TafReader::groupContent( Bu::TafGroup *pGroup ) return; else if( c == '/' && la == '*' ) pGroup->addChild( readComment() ); + else if( c == ':' ) + throw TafException("Encountered stray ':' in taf stream."); else pGroup->addChild( readProperty() ); } diff --git a/src/tests/taf.cpp b/src/tests/taf.cpp index e3da120..cb9b75f 100644 --- a/src/tests/taf.cpp +++ b/src/tests/taf.cpp @@ -8,16 +8,16 @@ int main() Bu::TafReader tr( f ); Bu::TafGroup *pGroup = tr.readGroup(); - +/* const Bu::TafGroup *pStats = pGroup->getChild("stats"); printf("%s\n", pStats->getName().getStr() ); - printf(" str = %s\n", pStats->getProperty("str").getStr() ); - + printf(" str = %s\n", pStats->getProperty("str").getStr() );*/ +/* { Bu::File fo("out.taf", "wb"); Bu::TafWriter tw( fo ); tw.writeGroup( pGroup ); - } + }*/ delete pGroup; } diff --git a/test.taf b/test.taf index 1d4e7d1..f9f6e6a 100644 --- a/test.taf +++ b/test.taf @@ -1,7 +1,6 @@ -{"player": "password"="aoeuaoeuao" "userclass"="implementor" "species"="human" "sex"="male" "active" "startroom"="Salourn::Xagafinelle's Room" {"stats": "str"="14" "dex"="12" "spd"="12" "enr"="7" "rea"="12" "wil"="10" "int"="13" "cha"="14" }{"hp": "cur"="100" "max"="100" }{"en": "cur"="100" "max"="100" }"attackrate"="30" "gold"="0" - - /* Hey, the inventory is next...isn't that cool? Oooooh yeah! */ - -{"inventory": {: "count"="1" "id"="Salourn::Dark Blade" }{: "count"="1" "id"="Salourn::Dark Suit" }{: "count"="3" "id"="Salourn::Small Fig" }}{"aliases": {: "key"="." "value"="say" }{: "key"="," "value"="yell" }{: "key"="li" "value"="lightning" }}"description"="They appear to be rather average looking, not particularly - tall or short, with facial features that are difficult to remember even - seconds after witnessing them." } +{test: + {repo: + url = http://svn.xagasoft.com/libbu++ + name = libbu++ + } +} -- cgit v1.2.3