/* Line 1806 of yacc.c */
#line 118 "config_parser.yy"
{
- context->HandleInclude((yyvsp[(2) - (2)].text), false);
+ context->HandleInclude((yyvsp[(2) - (2)].text), false, yylloc);
}
break;
/* Line 1806 of yacc.c */
#line 122 "config_parser.yy"
{
- context->HandleInclude((yyvsp[(2) - (2)].text), true);
+ context->HandleInclude((yyvsp[(2) - (2)].text), true, yylloc);
}
break;
include: T_INCLUDE T_STRING
{
- context->HandleInclude($2, false);
+ context->HandleInclude($2, false, yylloc);
}
| T_INCLUDE T_STRING_ANGLE
{
- context->HandleInclude($2, true);
+ context->HandleInclude($2, true, yylloc);
}
library: T_LIBRARY T_STRING
*
* @param include The path from the include directive.
* @param search Whether to search global include dirs.
+ * @param debuginfo Debug information.
*/
-void ConfigCompiler::HandleInclude(const String& include, bool search)
+void ConfigCompiler::HandleInclude(const String& include, bool search, const DebugInfo& debuginfo)
{
String path = Utility::DirName(GetPath()) + "/" + include;
vector<ConfigType::Ptr> types;
- m_HandleInclude(path, search, &m_ResultObjects, &types);
+ m_HandleInclude(path, search, &m_ResultObjects, &types, debuginfo);
BOOST_FOREACH(const ConfigType::Ptr& type, types) {
AddType(type);
* configuration items.
*
* @param include The path from the include directive.
+ * @param search Whether to search include dirs.
+ * @param resultItems The resulting items.
+ * @param resultTypes The resulting types.
+ * @param debuginfo Debug information.
*/
void ConfigCompiler::HandleFileInclude(const String& include, bool search,
- vector<ConfigItem::Ptr> *resultItems, vector<ConfigType::Ptr> *resultTypes)
+ vector<ConfigItem::Ptr> *resultItems, vector<ConfigType::Ptr> *resultTypes, const DebugInfo& debuginfo)
{
String includePath = include;
vector<ConfigItem::Ptr> items;
- if (!Utility::Glob(includePath, boost::bind(&ConfigCompiler::CompileFile, _1, resultItems, resultTypes)))
- throw_exception(invalid_argument("Include file '" + include + "' does not exist (or no files found for pattern)."));
+ if (!Utility::Glob(includePath, boost::bind(&ConfigCompiler::CompileFile, _1, resultItems, resultTypes))) {
+ stringstream msgbuf;
+ msgbuf << "Include file '" + include + "' does not exist (or no files found for pattern): " << debuginfo;
+ throw_exception(invalid_argument(msgbuf.str()));
+ }
}
/**
class I2_CONFIG_API ConfigCompiler
{
public:
- typedef function<void (const String&, bool, vector<ConfigItem::Ptr> *, vector<ConfigType::Ptr> *)> HandleIncludeFunc;
+ typedef function<void (const String&, bool, vector<ConfigItem::Ptr> *,
+ vector<ConfigType::Ptr> *, const DebugInfo&)> HandleIncludeFunc;
ConfigCompiler(const String& path, istream *input = &cin,
HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
String GetPath(void) const;
static void HandleFileInclude(const String& include, bool search,
- vector<ConfigItem::Ptr> *resultItems, vector<ConfigType::Ptr> *resultTypes);
+ vector<ConfigItem::Ptr> *resultItems, vector<ConfigType::Ptr> *resultTypes,
+ const DebugInfo& debuginfo);
/* internally used methods */
- void HandleInclude(const String& include, bool search);
+ void HandleInclude(const String& include, bool search, const DebugInfo& debuginfo);
void HandleLibrary(const String& library);
void AddObject(const ConfigItem::Ptr& object);