diff --git a/wcclparser/main.cpp b/wcclparser/main.cpp index 41fd12a01309f286c5fd4397df7cb71134951192..250a9c68571de65390ff6eb48ae62e94efc38657 100644 --- a/wcclparser/main.cpp +++ b/wcclparser/main.cpp @@ -185,7 +185,7 @@ int main(int argc, char** argv) ("position,p", value(&position), "Position in the sentence to use, 'all' iterates through the sentence\n") ("query-file,f", value(&query_load), - "Run query from file (disables interactive mode)\n") + "Run query from file (disables interohaiactive mode) (- is stdin)\n") ("query,Q", value(&query), "Query to run (disables interactive mode)\n") ("quiet,q", value(&quiet)->zero_tokens(), @@ -237,15 +237,19 @@ int main(int argc, char** argv) process_line(query, parser, sc, position == "all", dump_variables); return 0; } else if (!query_load.empty()) { - std::ifstream qf(query_load.c_str()); - if (qf.good()) { - std::stringstream ss; - ss << qf.rdbuf(); - process_line(ss.str(), parser, sc, position == "all", dump_variables); - return 0; + std::stringstream ss; + if (query_load == "-") { + ss << std::cin.rdbuf(); } else { - throw Wccl::FileNotFound(sentence_load, "", "Query file"); + std::ifstream qf(query_load.c_str()); + if (qf.good()) { + ss << qf.rdbuf(); + } else { + throw Wccl::FileNotFound(sentence_load, "", "Query file"); + } } + process_line(ss.str(), parser, sc, position == "all", dump_variables); + return 0; } boost::function<bool (const std::string&)> f; f = boost::bind(&process_line, _1, boost::ref(parser), boost::ref(sc),