#1401: misspelling ActiveThorns in parfiles results in unhelpful error message ---------------------+------------------------------------------------------ Reporter: rhaas | Owner: sbrandt Type: defect | Status: review Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------ Changes (by sbrandt):
* status: assigned => review
Comment:
I thought about a number of ways to solve this, most of them involved teaching the grammar to identify error patterns. These struck me as ugly solutions.
The attached fix suggests that we look at where the failure occurred in the parsing tree, and what the character was that was found, and use that information to provide an output message.
if(m2->inrule_max == "file::set::par" && m2->foundChar() =='=') { std::cout << "Invalid assignment." << std::endl; std::cout << "Valid assignments are: " << std::endl; std::cout << "ActiveThorns = "..."" << std::endl; std::cout << "Arrangement::Thorn = ..." << std::endl; }
This says that if we were part way parsing a parameter pattern and encountered an "=" (this corresponds to a c-identifier that is followed by an =) we print an error message describing what valid assignments are.