%{
- #define YYDEBUG 1
+#define YYDEBUG 1
/******************************************************************************
* Icinga 2 *
m_Expressions.push(std::vector<Expression *>());
try {
- yyparse(this);
+ if (yyparse(this) != 0)
+ BOOST_THROW_EXCEPTION(ConfigError("Syntax error"));
DictExpression *expr = new DictExpression(m_Expressions.top());
m_Expressions.pop();
%}
%%
-statements: /* empty */
- | statements statement
+statements: statement sep
+ | statements statement sep
;
statement: type | library | constant
- { }
- | newlines
{ }
| lterm
{
+ printf("lterm!\n");
m_Expressions.top().push_back($1);
}
;
-library: T_LIBRARY T_STRING sep
+library: T_LIBRARY T_STRING
{
context->HandleLibrary($2);
free($2);
}
;
-constant: T_CONST identifier T_SET rterm sep
+constant: T_CONST identifier T_SET rterm
{
VMFrame frame;
ScriptVariable::Ptr sv = ScriptVariable::Set($2, $4->Evaluate(frame));
m_Type->Register();
}
}
- type_inherits_specifier typerulelist sep
+ type_inherits_specifier typerulelist
{
TypeRuleList::Ptr ruleList = *$5;
delete $5;
$$ = new SetExpression(*$1, $2, $3, false, DebugInfoRange(@1, @3));
delete $1;
}
- | T_INCLUDE rterm sep
+ | T_INCLUDE rterm
{
VMFrame frame;
$$ = context->HandleInclude($2->Evaluate(frame), false, DebugInfoRange(@1, @2));
* @param zone The zone.
*/
ConfigCompiler::ConfigCompiler(const String& path, std::istream *input, const String& zone)
- : m_Path(path), m_Input(input), m_Zone(zone)
+ : m_Path(path), m_Input(input), m_Zone(zone), m_Eof(false)
{
InitializeScanner();
}
#include <iostream>
#include <boost/function.hpp>
+typedef union YYSTYPE YYSTYPE;
+typedef void *yyscan_t;
+
+int yylex(YYSTYPE *context, icinga::DebugInfo *di, yyscan_t scanner);
+
namespace icinga
{
String m_Zone;
void *m_Scanner;
+ bool m_Eof;
static std::vector<String> m_IncludeSearchDirs;
void InitializeScanner(void);
void DestroyScanner(void);
+
+ friend int ::yylex(YYSTYPE *context, icinga::DebugInfo *di, yyscan_t scanner);
};
class I2_CONFIG_API ConfigFragmentRegistry : public Registry<ConfigFragmentRegistry, String>