]> granicus.if.org Git - icinga2/commitdiff
Refactored parser.
authorGunnar Beutner <gunnar@beutner.name>
Thu, 31 May 2012 07:14:44 +0000 (09:14 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 31 May 2012 07:14:44 +0000 (09:14 +0200)
components/configfile/configcontext.cpp
components/configfile/configcontext.h
components/configfile/configfile.vcxproj
components/configfile/i2-configfile.h
components/configfile/icinga_lexer.ll
components/configfile/icinga_parser.yy

index 1abfa20a1c007109c518acb574ddf0e953739dad..263c77c5d8d5cdd5ff06f108cdb9fcf4a69eb2dc 100644 (file)
@@ -1,7 +1,6 @@
-#include <iostream>
-#include "configcontext.h"
+#include "i2-configfile.h"
 
-using namespace std;
+using namespace icinga;
 
 ConfigContext::ConfigContext(istream *input)
 {
index 4d4ada0b267316a2c9dc69bcb7fa623101ffada8..2d49b300c48878f934643ac0583ad8d99c27c1ce 100644 (file)
@@ -1,13 +1,35 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
+ *                                                                            *
+ * This program is free software; you can redistribute it and/or              *
+ * modify it under the terms of the GNU General Public License                *
+ * as published by the Free Software Foundation; either version 2             *
+ * of the License, or (at your option) any later version.                     *
+ *                                                                            *
+ * This program is distributed in the hope that it will be useful,            *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+ * GNU General Public License for more details.                               *
+ *                                                                            *
+ * You should have received a copy of the GNU General Public License          *
+ * along with this program; if not, write to the Free Software Foundation     *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
+ ******************************************************************************/
+
 #ifndef CONFIGCONTEXT_H
 #define CONFIGCONTEXT_H
 
+namespace icinga
+{
+
 class ConfigContext
 {
 public:
-       ConfigContext(std::istream *input = &std::cin);
+       ConfigContext(istream *input = &cin);
        virtual ~ConfigContext(void);
 
-       std::istream *Input;
+       istream *Input;
        void *Scanner;
 
 private:
@@ -15,6 +37,8 @@ private:
        void DestroyScanner(void);
 };
 
-int icingaparse(ConfigContext *context);
+}
+
+int yyparse(icinga::ConfigContext *context);
 
 #endif /* CONFIGCONTEXT_H */
index 74e474d155ec3e0ff042473666358de6828063b4..698e3a238882222c0b1dd62597e015692bde2cc1 100644 (file)
     </ProjectConfiguration>
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="configcontext.cpp" />
     <ClCompile Include="configfilecomponent.cpp" />
+    <ClCompile Include="icinga_lexer.cc" />
+    <ClCompile Include="icinga_parser.cc" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="configcontext.h" />
     <ClInclude Include="configfilecomponent.h" />
     <ClInclude Include="i2-configfile.h" />
+    <ClInclude Include="icinga_parser.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="icinga_lexer.ll" />
+    <None Include="icinga_parser.yy" />
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{E58F1DA7-B723-412B-B2B7-7FF58E2A944E}</ProjectGuid>
index 25dbe9334592166c66050667e61d34a8c9eabdce..96776dee384114bc39bbf4879ad4c25695e725da 100644 (file)
@@ -30,6 +30,7 @@
 #include <i2-base.h>
 #include <i2-icinga.h>
 
+#include "configcontext.h"
 #include "configfilecomponent.h"
 
 #endif /* I2CONFIGFILECOMPONENT_H */
index 84170465bb76ff357c6cf99496ecd72b21ae1511..89d33cd76db948b61e50123f1defc36b745b8675 100644 (file)
@@ -1,7 +1,7 @@
 %{
-#include <iostream>
-#include "configcontext.h"
-#include "icinga_parser.h"
+#include "i2-configfile.h"
+
+using namespace icinga;
 
 #define YY_EXTRA_TYPE ConfigContext *
 #define YY_USER_ACTION yylloc->first_line = yylineno;
@@ -11,13 +11,11 @@ do {                                                \
        yyextra->Input->read(buf, max_size);    \
        result = yyextra->Input->gcount();      \
 } while (0)
-
-#define YY_NO_UNISTD_H
 %}
 
 %option reentrant noyywrap yylineno
 %option bison-bridge bison-locations
-%option never-interactive
+%option never-interactive nounistd
 
 %x IN_C_COMMENT
 
index 744172ec9b4f4262fa55eece3a9b508de68981fa..7fcfe96e9d1ba123c6458104a87067f7a9e87625 100644 (file)
@@ -28,8 +28,9 @@
 %token T_INHERITS
 
 %{
-#include <iostream>
-#include "configcontext.h"
+#include "i2-configfile.h"
+
+using namespace icinga;
 
 int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);