diff --git a/Parser/TurtleParser.cpp b/Parser/TurtleParser.cpp index ae65255..c5d6fb8 100644 --- a/Parser/TurtleParser.cpp +++ b/Parser/TurtleParser.cpp @@ -360,6 +360,18 @@ TurtleParser::Lexer::Token TurtleParser::Lexer::next(std::string& token) return Token_Eof; } //--------------------------------------------------------------------------- +void TurtleParser::Lexer::readUntilSep(std::string& value) +{ + value.resize(0); + + char c; + while (read(c)) + { + if (issep(c)) { unread(); break; } + value += c; + } +} +//--------------------------------------------------------------------------- TurtleParser::TurtleParser(istream& in) : lexer(in),triplesReader(0),nextBlank(0) // Constructor @@ -451,6 +463,10 @@ void TurtleParser::parseQualifiedName(const string& prefix,string& name) parseError("unknown prefix '"+prefix+"'"); string expandedPrefix=prefixes[prefix]; + lexer.readUntilSep(name); + name=expandedPrefix+name; + +/* Lexer::Token token=lexer.next(name); if (isName(token)) { name=expandedPrefix+name; @@ -458,6 +474,7 @@ void TurtleParser::parseQualifiedName(const string& prefix,string& name) lexer.unget(token,name); name=expandedPrefix; } +*/ } //--------------------------------------------------------------------------- void TurtleParser::parseBlank(std::string& entry) diff --git a/Parser/TurtleParser.h b/Parser/TurtleParser.h index 81e9283..4de18e1 100644 --- a/Parser/TurtleParser.h +++ b/Parser/TurtleParser.h @@ -94,11 +94,8 @@ class TurtleParser /// Get the line unsigned getLine() const { return line; } - void discardLine() - { - char c; - while (read(c) && c != '\n'); - } + void readUntilSep(std::string& value); + void discardLine() { char c; while (read(c) && c!='\n'); } }; /// A triple struct Triple { @@ -157,10 +154,7 @@ class TurtleParser /// Read the next triple bool parse(std::string& subject,std::string& predicate,std::string& object,Type::Type_ID& objectType,std::string& objectSubType); - void discardLine() - { - lexer.discardLine(); - } + void discardLine() { lexer.discardLine(); } }; //--------------------------------------------------------------------------- #endif