Permalink
Browse files

Some more work on the INI parser/scanner

  • Loading branch information...
1 parent f01e3fb commit e04fd648a67861a7d0d87f4ff4107237bc81b9c7 @zsuraski zsuraski committed Oct 29, 2000
Showing with 146 additions and 41 deletions.
  1. +3 −3 Zend/Makefile.am
  2. +114 −16 Zend/ZendTS.dsp
  3. +1 −1 Zend/zend_ini_parser.y
  4. +24 −18 Zend/zend_ini_scanner.l
  5. +4 −3 Zend/zend_language_scanner.l
View
@@ -42,13 +42,13 @@ zend_language_parser.c: $(srcdir)/zend_language_parser.y
# INI parser/scanner rules
zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
- $(YACC) -p zend_ini -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
+ $(YACC) -p ini -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c
zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
- $(LEX) -Pzend_ini -o$@ -i $(srcdir)/zend_ini_scanner.l
+ $(LEX) -Pini -o$@ -i $(srcdir)/zend_ini_scanner.l
zend_ini_scanner_cc.cc: $(srcdir)/zend_ini_scanner.l
- $(LEX) -+ -B -i -S$(srcdir)/flex.skl -Pzend_ini -o$@ $(srcdir)/zend_ini_scanner.l
+ $(LEX) -+ -B -i -S$(srcdir)/flex.skl -Pini -o$@ $(srcdir)/zend_ini_scanner.l
depend:
View
@@ -107,14 +107,6 @@ LIB32=link.exe -lib
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.cpp"
-# End Source File
-# Begin Source File
-
SOURCE=.\zend.c
# End Source File
# Begin Source File
@@ -171,6 +163,14 @@ SOURCE=.\zend_ini.c
# End Source File
# Begin Source File
+SOURCE=".\zend_language_parser.c"
+# End Source File
+# Begin Source File
+
+SOURCE=".\zend_language_scanner.cpp"
+# End Source File
+# Begin Source File
+
SOURCE=.\zend_list.c
# End Source File
# Begin Source File
@@ -215,14 +215,6 @@ SOURCE=.\modules.h
# End Source File
# Begin Source File
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
SOURCE=.\zend.h
# End Source File
# Begin Source File
@@ -299,6 +291,14 @@ SOURCE=.\zend_ini.h
# End Source File
# Begin Source File
+SOURCE=".\zend_language_parser.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\zend_language_scanner.h"
+# End Source File
+# Begin Source File
+
SOURCE=.\zend_list.h
# End Source File
# Begin Source File
@@ -327,6 +327,67 @@ SOURCE=.\zend_variables.h
# PROP Default_Filter "y"
# Begin Source File
+SOURCE=.\zend_ini_parser.y
+
+!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\zend_ini_parser.y
+
+BuildCmds= \
+ if not "X%CYGWIN%"=="X" bison --output=zend_ini_parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend_ini zend_ini_parser.y \
+ if "X%CYGWIN%"=="X" bison --output=zend_ini_parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend_ini zend_ini_parser.y \
+
+
+"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\zend_ini_parser.y
+
+BuildCmds= \
+ if not "X%CYGWIN%"=="X" bison --output=zend_ini_parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend_ini zend_ini_parser.y \
+ if "X%CYGWIN%"=="X" bison --output=zend_ini_parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend_ini zend_ini_parser.y \
+
+
+"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\zend_ini_parser.y
+
+BuildCmds= \
+ if not "X%CYGWIN%"=="X" bison --output=zend_ini_parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend_ini zend_ini_parser.y \
+ if "X%CYGWIN%"=="X" bison --output=zend_ini_parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend_ini zend_ini_parser.y \
+
+
+"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=".\zend_language_parser.y"
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
@@ -392,6 +453,43 @@ BuildCmds= \
# PROP Default_Filter "l"
# Begin Source File
+SOURCE=.\zend_ini_scanner.l
+
+!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
+
+# Begin Custom Build
+InputPath=.\zend_ini_scanner.l
+
+"zend_ini_scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ flex -+ -B -i -Sflex.skl -Pzend_ini -ozend_ini_scanner.cpp zend_ini_scanner.l
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
+
+# Begin Custom Build
+InputPath=.\zend_ini_scanner.l
+
+"zend_ini_scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ flex -+ -B -i -Sflex.skl -Pzend_ini -ozend_ini_scanner.cpp zend_ini_scanner.l
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
+
+# Begin Custom Build
+InputPath=.\zend_ini_scanner.l
+
+"zend_ini_scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ flex -+ -B -i -Sflex.skl -Pzend_ini -ozend_ini_scanner.cpp zend_ini_scanner.l
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=".\zend_language_scanner.l"
!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
View
@@ -37,7 +37,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winbase.h>
-#include "win32/wfile.h"
+//#include "win32/wfile.h"
#endif
#define YYSTYPE zval
View
@@ -19,17 +19,23 @@
#include "zend.h"
#include "zend_ini_parser.h"
+#include "zend_ini_scanner.h"
#undef YYSTYPE
#define YYSTYPE zval
-#define YY_DECL cfglex(zval *cfglval)
-
+#ifdef ZTS
+#define YY_DECL int ZendIniFlexLexer::lex_scan(zval *inilval CLS_DC)
+#else
+#define YY_DECL int ini_lex_scan(zval *inilval CLS_DC)
+#endif
+#ifndef ZTS
void init_cfg_scanner()
{
- cfglineno=1;
+ inilineno=1;
}
+#endif
%}
@@ -68,17 +74,17 @@ void init_cfg_scanner()
<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
- cfglval->value.str.val = zend_strndup("1",1);
- cfglval->value.str.len = 1;
- cfglval->type = IS_STRING;
+ inilval->value.str.val = zend_strndup("1",1);
+ inilval->value.str.len = 1;
+ inilval->type = IS_STRING;
return CFG_TRUE;
}
<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
- cfglval->value.str.val = zend_strndup("",0);
- cfglval->value.str.len = 0;
- cfglval->type = IS_STRING;
+ inilval->value.str.val = zend_strndup("",0);
+ inilval->value.str.len = 0;
+ inilval->type = IS_STRING;
return CFG_FALSE;
}
@@ -95,9 +101,9 @@ void init_cfg_scanner()
yytext++;
yyleng--;
- cfglval->value.str.val = zend_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
+ inilval->value.str.val = zend_strndup(yytext,yyleng);
+ inilval->value.str.len = yyleng;
+ inilval->type = IS_STRING;
return SECTION;
}
@@ -111,9 +117,9 @@ void init_cfg_scanner()
/* eat leading " */
yytext++;
- cfglval->value.str.val = zend_strndup(yytext, yyleng - 2);
- cfglval->value.str.len = yyleng - 2;
- cfglval->type = IS_STRING;
+ inilval->value.str.val = zend_strndup(yytext, yyleng - 2);
+ inilval->value.str.len = yyleng - 2;
+ inilval->type = IS_STRING;
return TC_ENCAPSULATED_STRING;
}
@@ -145,9 +151,9 @@ void init_cfg_scanner()
}
}
if (yyleng!=0) {
- cfglval->value.str.val = zend_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
+ inilval->value.str.val = zend_strndup(yytext,yyleng);
+ inilval->value.str.len = yyleng;
+ inilval->type = IS_STRING;
return TC_STRING;
} else {
/* whitespace */
@@ -76,6 +76,7 @@
#else
#define YY_DECL int lex_scan(zval *zendlval CLS_DC)
#endif
+
#define ECHO { ZEND_WRITE( yytext, yyleng ); }
#ifdef ZTS
@@ -88,10 +89,10 @@
class istdiostream : public istream
{
private:
- stdiobuf _file;
+ stdiobuf _file;
public:
- istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); }
- stdiobuf* rdbuf()/* const */ { return &_file; }
+ istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); }
+ stdiobuf* rdbuf()/* const */ { return &_file; }
};
#endif

0 comments on commit e04fd64

Please sign in to comment.