Skip to content

Commit c2fd0cf

Browse files
committed
fix(dict_compiler): prism should load compiled schema
Fixes #176
1 parent f920e4f commit c2fd0cf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/rime/dict/dict_compiler.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static string LocateFile(const string& file_name) {
3535
}
3636

3737
bool DictCompiler::Compile(const string &schema_file) {
38-
LOG(INFO) << "compiling:";
38+
LOG(INFO) << "compiling dictionary for " << schema_file;
3939
bool build_table_from_source = true;
4040
DictSettings settings;
4141
string dict_file = LocateFile(dict_name_ + ".dict.yaml");
@@ -215,9 +215,13 @@ bool DictCompiler::BuildPrism(const string &schema_file,
215215
// apply spelling algebra
216216
Script script;
217217
if (!schema_file.empty()) {
218+
Config config;
219+
if (!config.LoadFromFile(schema_file)) {
220+
LOG(ERROR) << "error loading prism definition from " << schema_file;
221+
return false;
222+
}
218223
Projection p;
219-
the<Config> config(Config::Require("config")->Create(schema_file));
220-
auto algebra = config->GetList("speller/algebra");
224+
auto algebra = config.GetList("speller/algebra");
221225
if (algebra && p.Load(algebra)) {
222226
for (const auto& x : syllabary) {
223227
script.AddSyllable(x);

0 commit comments

Comments
 (0)