Skip to content
Snippets Groups Projects
Commit 8aa47d3a authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Keep file name with Lexicon.

parent a5674e4b
Branches
No related merge requests found
......@@ -53,10 +53,10 @@ private:
///////////////////////////////////////////////////////////////////////////////
parse_lexicon_file
[const std::string& name]
[const std::string& name, const std::string& file_name]
returns [boost::shared_ptr<Lexicon> lex]
{
lex.reset(new Lexicon(name));
lex.reset(new Lexicon(name, file_name));
}
: (lexicon_entry [*lex])*
EOF
......
......@@ -14,8 +14,9 @@ class Lexicon : boost::noncopyable
public:
typedef boost::unordered_map<UnicodeString, UnicodeString> map_t;
Lexicon(const std::string& name)
: name_(name)
Lexicon(const std::string& name, const std::string& file_name)
: name_(name),
file_name_(file_name_)
{
BOOST_ASSERT(!name_.empty());
}
......@@ -40,6 +41,10 @@ public:
return name_;
}
std::string file_name() const {
return file_name_;
}
bool has_key(const UnicodeString& key) const {
return map_.find(key) != map_.end();
}
......@@ -55,6 +60,7 @@ public:
private:
map_t map_;
const std::string name_;
const std::string file_name_;
};
} /* end ns Wccl */
......
......@@ -22,7 +22,7 @@ boost::shared_ptr<Lexicon> LexiconParser::parse_lexicon(
ANTLRLexiconLexer lexer(is);
ANTLRLexiconParser parser(lexer);
return parser.parse_lexicon_file(lexicon_name);
return parser.parse_lexicon_file(lexicon_name, filename);
}
} /* end ns Wccl */
......@@ -26,6 +26,10 @@ public:
void insert(const boost::shared_ptr<Lexicon>& lexicon);
const map_t& get_lexicons() const {
return lexicons_;
}
private:
map_t lexicons_;
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment