Permalink
Browse files

MFB 5.3: Rest of the changes for re2c merge

  • Loading branch information...
1 parent e55a0de commit 56352d1a2fd1ac0df868559923e0b792d03d52f8 Scott MacVicar committed Mar 26, 2008
View
@@ -7,7 +7,7 @@ $(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
$(srcdir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
- @$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
+ @(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
@@ -18,6 +18,6 @@ $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
- @$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
+ @(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
View
@@ -2155,7 +2155,7 @@ AC_DEFUN([PHP_PROG_RE2C],[
if test -n "$RE2C"; then
AC_CACHE_CHECK([for re2c version], php_cv_re2c_version, [
re2c_vernum=`re2c --vernum 2>/dev/null`
- if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1200"; then
+ if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1304"; then
php_cv_re2c_version=invalid
else
php_cv_re2c_version="`re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
@@ -2164,7 +2164,7 @@ AC_DEFUN([PHP_PROG_RE2C],[
fi
case $php_cv_re2c_version in
""|invalid[)]
- AC_MSG_WARN([You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.])
+ AC_MSG_WARN([You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.])
RE2C="exit 0;"
;;
esac
View
@@ -161,10 +161,38 @@ dnl check for -R, etc. switch
PHP_RUNPATH_SWITCH
dnl Checks for some support/generator progs
-PHP_PROG_RE2C
+
PHP_PROG_AWK
PHP_PROG_BISON
-PHP_PROG_LEX
+PHP_PROG_RE2C
+
+PHP_ARG_ENABLE(re2c-cgoto, whether to enable computed goto gcc extension with re2c,
+[ --enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension], no, no)
+
+if test "$PHP_RE2C_CGOTO" = "no"; then
+ RE2C_FLAGS=""
+else
+ AC_MSG_CHECKING([whether re2c -g works])
+ AC_TRY_COMPILE([],[
+ int main(int argc, const char **argv)
+ {
+ argc = argc;
+ argv = argv;
+label1:
+label2:
+ static void *adr[] = { &&label1, &&label2};
+ goto *adr[0];
+ return 0;
+ }
+ ],[
+ RE2C_FLAGS=""
+ AC_MSG_RESULT([no])
+ ],[
+ RE2C_FLAGS="-g"
+ AC_MSG_RESULT([yes])
+ ])
+fi
+PHP_SUBST(RE2C_FLAGS)
dnl Platform-specific compile settings.
dnl -------------------------------------------------------------------------
View
@@ -233,7 +233,7 @@ int spl_autoload(const zstr class_name, const zstr lc_name, int class_name_len,
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
new_op_array = NULL;
- zend_file_handle_dtor(&file_handle);
+ zend_file_handle_dtor(&file_handle TSRMLS_CC);
}
if (new_op_array) {
EG(return_value_ptr_ptr) = &result;
@@ -1,5 +1,7 @@
--TEST--
highlight_file() and output buffer
+--INI--
+log_errors_max_len=4096
--FILE--
<?php
@@ -1,5 +1,7 @@
--TEST--
php_strip_whitespace() and output buffer
+--INI--
+log_errors_max_len=4096
--FILE--
<?php
@@ -6,6 +6,7 @@ highlight.comment=#FF9900
highlight.keyword=#007700
highlight.default=#0000BB
highlight.html=#000000
+allow_url_include=1
--FILE--
<?php
@@ -14,19 +15,9 @@ $filename = dirname(__FILE__)."/highlight_file.dat";
var_dump(highlight_file());
var_dump(highlight_file($filename));
-$data = <<<DATA
-<?php echo "test"; ?>
-DATA;
+var_dump(highlight_file('data:,<?php echo "test"; ?>'));
-file_put_contents($filename, $data);
-var_dump(highlight_file($filename));
-
-$data = <<<DATA
-<?php echo "test ?>
-DATA;
-
-file_put_contents($filename, $data);
-var_dump(highlight_file($filename));
+var_dump(highlight_file('data:,<?php echo "test ?>'));
$data = '
<?php
@@ -57,7 +48,7 @@ bool(false)
</span>
</code>bool(true)
<code><span style="color: #000000">
-<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test&nbsp;?&gt;</span>
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #FF9900">"test&nbsp;?&gt;</span>
</span>
</code>bool(true)
<code><span style="color: #000000">
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : basic functionality - with default arguments
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : basic functionality - with all arguments
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : error conditions
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for 'str' argument
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - single quoted strings
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - binary safe checking
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
@@ -1,2 +1,2 @@
-$(top_srcdir)/Zend/zend_language_parser.h:
-$(builddir)/tokenizer.lo: $(top_srcdir)/Zend/zend_language_parser.h
+
+$(builddir)/tokenizer.lo: $(top_srcdir)/Zend/zend_language_parser.c $(top_srcdir)/Zend/zend_language_scanner.c
@@ -516,22 +516,13 @@ echo "hello world"; ?>"
}
}
-- with invalid PHP tags and tokens --
-array(2) {
+array(1) {
[0]=>
array(3) {
[0]=>
int(313)
[1]=>
- string(18) "<PDP display $a; "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(313)
- [1]=>
- string(1) "<"
+ string(19) "<PDP display $a; <"
[2]=>
int(1)
}
@@ -27,67 +27,9 @@
#include "ext/standard/info.h"
#include "php_tokenizer.h"
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-typedef unsigned int yy_size_t;
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
#include "zend.h"
#include "zend_language_scanner.h"
+#include "zend_language_scanner_defs.h"
#include <zend_language_parser.h>
#define zendtext LANG_SCNG(yy_text)
@@ -224,7 +166,7 @@ PHP_FUNCTION(token_get_all)
RETURN_EMPTY_STRING();
}
- LANG_SCNG(start) = 1;
+ LANG_SCNG(yy_state) = yycINITIAL;
tokenize(return_value TSRMLS_CC);
Oops, something went wrong.

0 comments on commit 56352d1

Please sign in to comment.