Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Rewrite scanner to be based on re2c instead of flex

  The full patch is available as:
  http://php.net/~helly/php-re2c-5.3-20080316.diff.txt
  This is against php-re2c repository version 98
  An older patch against version 97 is available under:
  http://php.net/~helly/php-re2c-97-20080316.diff.txt
  • Loading branch information...
commit af316021e8f69896cd0d246114962e48b973972f 1 parent eb8f83a
Marcus Boerger authored
Showing with 1,049 additions and 2,995 deletions.
  1. +2 −2 Makefile.frag
  2. +1 −0  NEWS
  3. +0 −186 Zend/FlexLexer.h
  4. +3 −3 Zend/Makefile.am
  5. +0 −15 Zend/Zend.m4
  6. +0 −1  Zend/configure.in
  7. +0 −1,648 Zend/flex.skl
  8. +7 −0 Zend/tests/bug42767.phpt
  9. +14 −21 Zend/zend.c
  10. +12 −51 Zend/zend_compile.c
  11. +0 −8 Zend/zend_compile.h
  12. +29 −53 Zend/zend_globals.h
  13. +6 −5 Zend/zend_globals_macros.h
  14. +2 −20 Zend/zend_highlight.c
  15. +1 −1  Zend/zend_ini_parser.y
  16. +0 −1  Zend/zend_ini_scanner.h
  17. +98 −119 Zend/zend_ini_scanner.l
  18. +9 −19 Zend/zend_language_scanner.h
  19. +235 −505 Zend/zend_language_scanner.l
  20. +6 −5 Zend/zend_stack.c
  21. +242 −68 Zend/zend_stream.c
  22. +40 −23 Zend/zend_stream.h
  23. +1 −1  Zend/zend_strtod.c
  24. +1 −1  Zend/zend_vm_def.h
  25. +4 −4 Zend/zend_vm_execute.h
  26. +4 −67 acinclude.m4
  27. +29 −2 configure.in
  28. +1 −1  ext/spl/php_spl.c
  29. +4 −4 ext/standard/tests/strings/006.phpt
  30. +3 −3 ext/standard/tests/strings/007.phpt
  31. +4 −13 ext/standard/tests/strings/highlight_file.phpt
  32. +1 −1  ext/standard/tests/strings/strip_tags_basic1.phpt
  33. +1 −1  ext/standard/tests/strings/strip_tags_basic2.phpt
  34. +1 −1  ext/standard/tests/strings/strip_tags_error.phpt
  35. +1 −1  ext/standard/tests/strings/strip_tags_variation1.phpt
  36. +1 −1  ext/standard/tests/strings/strip_tags_variation10.phpt
  37. +1 −1  ext/standard/tests/strings/strip_tags_variation2.phpt
  38. +1 −1  ext/standard/tests/strings/strip_tags_variation3.phpt
  39. +1 −1  ext/standard/tests/strings/strip_tags_variation4.phpt
  40. +1 −1  ext/standard/tests/strings/strip_tags_variation5.phpt
  41. +1 −1  ext/standard/tests/strings/strip_tags_variation6.phpt
  42. +1 −1  ext/standard/tests/strings/strip_tags_variation7.phpt
  43. +1 −1  ext/standard/tests/strings/strip_tags_variation8.phpt
  44. +1 −1  ext/standard/tests/strings/strip_tags_variation9.phpt
  45. +2 −2 ext/tokenizer/Makefile.frag
  46. +2 −11 ext/tokenizer/tests/token_get_all_variation14.phpt
  47. +2 −60 ext/tokenizer/tokenizer.c
  48. +35 −13 main/main.c
  49. +0 −8 sapi/apache/mod_php5.c
  50. +0 −8 sapi/apache_hooks/mod_php5.c
  51. +3 −3 sapi/cgi/cgi_main.c
  52. +2 −2 sapi/cgi/tests/007.phpt
  53. +4 −1 sapi/cli/php_cli.c
  54. +11 −12 sapi/cli/tests/010.phpt
  55. +105 −0 sapi/cli/tests/016.phpt
  56. +106 −0 sapi/cli/tests/017.phpt
  57. +3 −3 sapi/tests/test003.phpt
  58. +3 −3 sapi/tests/test004.phpt
  59. +0 −6 win32/build/config.w32
View
4 Makefile.frag
@@ -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
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_language_scanner_defs.h -o$@ $(srcdir)/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
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_ini_scanner_defs.h -o$@ $(srcdir)/zend_ini_scanner.l
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
View
1  NEWS
@@ -79,6 +79,7 @@ PHP NEWS
- Added PREG_BAD_UTF8_OFFSET_ERROR constant. (Nuno)
- Improved PHP runtime speed and memory usage:
+ . Replaced flex based scanner with re2c based scanner. (Marcus, Nuno, Scott)
. Added garbage collector. (David Wang, Dmitry).
. Improved PHP binary size and startup speed with GCC4 visibility control.
(Nuno)
View
186 Zend/FlexLexer.h
@@ -1,186 +0,0 @@
-// $Header$
-
-// FlexLexer.h -- define interfaces for lexical analyzer classes generated
-// by flex
-
-// Copyright (c) 1993 The Regents of the University of California.
-// All rights reserved.
-//
-// This code is derived from software contributed to Berkeley by
-// Kent Williams and Tom Epperly.
-//
-// Redistribution and use in source and binary forms with or without
-// modification are permitted provided that: (1) source distributions retain
-// this entire copyright notice and comment, and (2) distributions including
-// binaries display the following acknowledgement: ``This product includes
-// software developed by the University of California, Berkeley and its
-// contributors'' in the documentation or other materials provided with the
-// distribution and in all advertising materials mentioning features or use
-// of this software. Neither the name of the University nor the names of
-// its contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-
-// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-// This file defines FlexLexer, an abstract class which specifies the
-// external interface provided to flex C++ lexer objects, and yyFlexLexer,
-// which defines a particular lexer class.
-//
-// If you want to create multiple lexer classes, you use the -P flag
-// to rename each yyFlexLexer to some other xxFlexLexer. You then
-// include <FlexLexer.h> in your other sources once per lexer class:
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer xxFlexLexer
-// #include <FlexLexer.h>
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer zzFlexLexer
-// #include <FlexLexer.h>
-// ...
-
-#ifndef FLEXLEXER_H
-// Never included before - need to define base class.
-#define FLEXLEXER_H
-#include <iostream.h>
-
-extern "C++" {
-
-struct yy_buffer_state;
-typedef int yy_state_type;
-
-class FlexLexer {
-public:
- virtual ~FlexLexer() { }
-
- const char* YYText() { return yytext; }
- int YYLeng() { return yyleng; }
-
- virtual void
- yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
- virtual struct yy_buffer_state*
- yy_create_buffer( istream* s, int size ) = 0;
- virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
- virtual void yyrestart( istream* s ) = 0;
-
- virtual int yylex() = 0;
-
- // Call yylex with new input/output sources.
- int yylex( istream* new_in, ostream* new_out = 0 )
- {
- switch_streams( new_in, new_out );
- return yylex();
- }
-
- // Switch to new input/output streams. A nil stream pointer
- // indicates "keep the current one".
- virtual void switch_streams( istream* new_in = 0,
- ostream* new_out = 0 ) = 0;
-
- int lineno() const { return yylineno; }
-
- int debug() const { return yy_flex_debug; }
- void set_debug( int flag ) { yy_flex_debug = flag; }
-
-protected:
- char* yytext;
- int yyleng;
- int yylineno; // only maintained if you use %option yylineno
- int yy_flex_debug; // only has effect with -d or "%option debug"
-};
-
-}
-#endif
-
-#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
-// Either this is the first time through (yyFlexLexerOnce not defined),
-// or this is a repeated include to define a different flavor of
-// yyFlexLexer, as discussed in the flex man page.
-#define yyFlexLexerOnce
-
-class yyFlexLexer : public FlexLexer {
-public:
- // arg_yyin and arg_yyout default to the cin and cout, but we
- // only make that assignment when initializing in yylex().
- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
-
- virtual ~yyFlexLexer();
-
- void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
- struct yy_buffer_state* yy_create_buffer( istream* s, int size );
- void yy_delete_buffer( struct yy_buffer_state* b );
- void yyrestart( istream* s );
-
- virtual int yylex();
- virtual void switch_streams( istream* new_in, ostream* new_out );
-
-protected:
- virtual int LexerInput( char* buf, int max_size );
- virtual void LexerOutput( const char* buf, int size );
- virtual void LexerError( const char* msg );
-
- void yyunput( int c, char* buf_ptr );
- int yyinput();
-
- void yy_load_buffer_state();
- void yy_init_buffer( struct yy_buffer_state* b, istream* s );
- void yy_flush_buffer( struct yy_buffer_state* b );
-
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int* yy_start_stack;
-
- void yy_push_state( int new_state );
- void yy_pop_state();
- int yy_top_state();
-
- yy_state_type yy_get_previous_state();
- yy_state_type yy_try_NUL_trans( yy_state_type current_state );
- int yy_get_next_buffer();
-
- istream* yyin; // input source for default LexerInput
- ostream* yyout; // output sink for default LexerOutput
-
- struct yy_buffer_state* yy_current_buffer;
-
- // yy_hold_char holds the character lost when yytext is formed.
- char yy_hold_char;
-
- // Number of characters read into yy_ch_buf.
- int yy_n_chars;
-
- // Points to current character in buffer.
- char* yy_c_buf_p;
-
- int yy_init; // whether we need to initialize
- int yy_start; // start state number
-
- // Flag which is used to allow yywrap()'s to do buffer switches
- // instead of setting up a fresh yyin. A bit of a hack ...
- int yy_did_buffer_switch_on_eof;
-
- // The following are not always needed, but may be depending
- // on use of certain flex features (like REJECT or yymore()).
-
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- yy_state_type* yy_state_buf;
- yy_state_type* yy_state_ptr;
-
- char* yy_full_match;
- int* yy_full_state;
- int yy_full_lp;
-
- int yy_lp;
- int yy_looking_for_trail_begin;
-
- int yy_more_flag;
- int yy_more_len;
- int yy_more_offset;
- int yy_prev_more_offset;
-};
-
-#endif
View
6 Zend/Makefile.am
@@ -17,7 +17,7 @@ libZend_la_SOURCES=\
zend_objects_API.c zend_ts_hash.c zend_stream.c \
zend_default_classes.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c \
- zend_strtod.c zend_multibyte.c
+ zend_strtod.c
libZend_la_LDFLAGS =
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
@@ -31,7 +31,7 @@ zend_ini_scanner.lo: zend_ini_parser.h
# Language parser/scanner rules
zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
- $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_language_scanner_defs.h -o$@ $(srcdir)/zend_language_scanner.l
zend_language_parser.h: zend_language_parser.c
zend_language_parser.c: $(srcdir)/zend_language_parser.y
@@ -43,7 +43,7 @@ zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
$(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) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt $(srcdir)/zend_ini_scanner_defs.h -o$@ $(srcdir)/zend_ini_scanner.l
zend_ini_parser.h: zend_ini_parser.c
View
15 Zend/Zend.m4
@@ -31,7 +31,6 @@ AC_DEFUN([LIBZEND_BASIC_CHECKS],[
AC_REQUIRE([AC_PROG_YACC])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_CC_C_O])
-AC_REQUIRE([AC_PROG_LEX])
AC_REQUIRE([AC_HEADER_STDC])
LIBZEND_BISON_CHECK
@@ -155,13 +154,6 @@ AC_ARG_ENABLE(inline-optimization,
ZEND_INLINE_OPTIMIZATION=yes
])
-AC_ARG_ENABLE(zend-multibyte,
-[ --enable-zend-multibyte Compile with zend multibyte support], [
- ZEND_MULTIBYTE=$enableval
-],[
- ZEND_MULTIBYTE=no
-])
-
AC_MSG_CHECKING([virtual machine dispatch method])
AC_MSG_RESULT($PHP_ZEND_VM)
@@ -174,9 +166,6 @@ AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
AC_MSG_CHECKING(whether to enable Zend debugging)
AC_MSG_RESULT($ZEND_DEBUG)
-AC_MSG_CHECKING(whether to enable Zend multibyte)
-AC_MSG_RESULT($ZEND_MULTIBYTE)
-
case $PHP_ZEND_VM in
SWITCH)
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method])
@@ -211,10 +200,6 @@ if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
LIBZEND_CPLUSPLUS_CHECKS
fi
-if test "$ZEND_MULTIBYTE" = "yes"; then
- AC_DEFINE(ZEND_MULTIBYTE, 1, [ ])
-fi
-
changequote({,})
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
View
1  Zend/configure.in
@@ -7,7 +7,6 @@ AM_CONFIG_HEADER(zend_config.h)
AM_SANITY_CHECK
AM_MAINTAINER_MODE
AC_PROG_CC
-AM_PROG_LEX
AM_PROG_CC_STDC
ZEND_VERSION=$VERSION
AC_ZEND_C_BIGENDIAN
View
1,648 Zend/flex.skl
@@ -1,1648 +0,0 @@
-/* A Lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header$
- * vim:ft=lex:
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-%-
-#include <stdio.h>
-%*
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-%+
-class istream;
-%*
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-#undef YY_USE_PROTOS
-#define YY_USE_PROTOS
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-%-
-%*
-
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
-%-
- struct _zend_file_handle *yy_input_file;
-%+
- istream* 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
- };
-
-%- Standard (non-C++) definition
-#define yy_current_buffer SCNG(current_buffer)
-#define yy_hold_char SCNG(_yy_hold_char)
-%*
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-%- Standard (non-C++) definition
-/* yy_hold_char holds the character lost when yytext is formed. */
-
-#if 0
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-#endif
-
-/* Points to current character in buffer. */
-#define yy_c_buf_p SCNG(c_buf_p)
-#define yy_init SCNG(init)
-#define yy_start SCNG(start)
-
-#ifdef ZTS
-#define TSRMLS_D void ***tsrm_ls
-#define TSRMLS_DC , TSRMLS_D
-#define TSRMLS_C tsrm_ls
-#define TSRMLS_CC , TSRMLS_C
-#else
-#define TSRMLS_D
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-#endif
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-/* static int yy_did_buffer_switch_on_eof; */
-#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof)
-
-void yyrestart YY_PROTO(( struct _zend_file_handle *input_file TSRMLS_DC ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC ));
-void yy_load_buffer_state YY_PROTO(( TSRMLS_D ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( struct _zend_file_handle *file, int size TSRMLS_DC ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC ));
-
-%*
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
-#undef yyleng
-#define yyleng SCNG(yy_leng)
-#undef yytext
-#define yytext SCNG(yy_text)
-#undef yytext_ptr
-#define yytext_ptr SCNG(yy_text)
-#undef yyin
-#define yyin SCNG(yy_in)
-#undef yyout
-#define yyout SCNG(yy_out)
-#undef yy_last_accepting_state
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#undef yy_last_accepting_cpos
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#undef yy_more_flag
-#define yy_more_flag SCNG(_yy_more_flag)
-#undef yy_more_len
-#define yy_more_len SCNG(_yy_more_len)
-
-
-%- Standard (non-C++) definition
-static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC ));
-static int yy_get_next_buffer YY_PROTO(( TSRMLS_D ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-%*
-
-#undef TSRMLS_D
-#undef TSRMLS_DC
-#undef TSRMLS_C
-#undef TSRMLS_CC
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
-%% code to fiddle yytext and yyleng for yymore() goes here
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
-%% code to copy yytext_ptr to yytext[] goes here, if %array
- yy_c_buf_p = yy_cp;
-
-#undef yyleng
-#undef yytext
-#undef yytext_ptr
-#undef yyin
-#undef yyout
-#undef yy_last_accepting_state
-#undef yy_last_accepting_cpos
-#undef yy_more_flag
-#undef yy_more_len
-
-
-%% data tables for the DFA and the user's section 1 definitions go here
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-%-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC ));
-#endif
-%*
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-%- Standard (non-C++) definition
-#ifdef __cplusplus
-static int 3 YY_PROTO(( TSRMLS_D ));
-#else
-static int input YY_PROTO(( TSRMLS_D ));
-#endif
-%*
-#endif
-
-#if YY_STACK_USED
-#define yy_start_stack_ptr SCNG(yy_start_stack_ptr)
-#define yy_start_stack_depth SCNG(yy_start_stack_depth)
-#define yy_start_stack SCNG(yy_start_stack)
-/*
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-*/
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( TSRMLS_D ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( TSRMLS_D ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-/* Zend file handle reading */
-#ifndef ECHO
-#define ECHO /* There is no output */
-#endif
-
-#ifdef ZEND_MULTIBYTE
-# define YY_INPUT(buf, result, max_size) \
- if ( ((result = zend_multibyte_yyinput(yyin, buf, max_size TSRMLS_CC)) == 0) \
- && zend_stream_ferror( yyin TSRMLS_CC) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#else
-# define YY_INPUT(buf, result, max_size) \
- if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \
- && zend_stream_ferror( yyin TSRMLS_CC) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#endif
-
-#ifndef ECHO
-%- Standard (non-C++) definition
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) )
-%+ C++ definition
-#define ECHO LexerOutput( yytext, yyleng )
-%*
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-%% fread()/read() definition of YY_INPUT goes here unless we're doing C++
-%+ C++ definition
- if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-%*
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-%-
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-%+
-#define YY_FATAL_ERROR(msg) LexerError( msg )
-%*
-#endif
-
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-%- Standard (non-C++) definition
-#define YY_DECL int yylex YY_PROTO(( void ))
-%+ C++ definition
-#define YY_DECL int yyFlexLexer::yylex()
-%*
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-%% YY_RULE_SETUP definition goes here
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-%% user's declarations go here
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
-#if 0
- if ( ! SCNG(yy_in) )
-%-
- SCNG(yy_in) = stdin;
-%+
- SCNG(yy_in) = &cin;
-%*
-
- if ( ! SCNG(yy_out) )
-%-
- SCNG(yy_out) = stdout;
-%+
- SCNG(yy_out) = &cout;
-%*
-#endif
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
-
- yy_load_buffer_state(TSRMLS_C);
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
-%% yymore()-related code goes here
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
-%% code to set up and find next match goes here
-
-yy_find_action:
-%% code to find the action number goes here
-
- YY_DO_BEFORE_ACTION;
-
-%% code for yylineno update goes here
-
-do_action: /* This label is used only to access EOF actions. */
-
-%% debug code goes here
-
- switch ( yy_act )
- { /* beginning of action switch */
-%% actions go here
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = SCNG(yy_in);
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
-%% code to do back-up for compressed tables and set up yy_cp goes here
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer(TSRMLS_C) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)];
-
- yy_current_state = yy_get_previous_state(TSRMLS_C);
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-%+
-yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
- {
- SCNG(yy_in) = arg_yyin;
- SCNG(yy_out) = arg_yyout;
- yy_c_buf_p = 0;
- yy_init = 1;
- yy_start = 0;
- yy_flex_debug = 0;
- yylineno = 1; // this will only get updated if %option yylineno
-
- yy_did_buffer_switch_on_eof = 0;
-
- yy_looking_for_trail_begin = 0;
- yy_more_flag = 0;
- yy_more_len = 0;
- yy_more_offset = yy_prev_more_offset = 0;
-
- yy_start_stack_ptr = yy_start_stack_depth = 0;
- yy_start_stack = 0;
-
- yy_current_buffer = 0;
-
-#ifdef YY_USES_REJECT
- yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
-#else
- yy_state_buf = 0;
-#endif
- }
-
-yyFlexLexer::~yyFlexLexer()
- {
- delete yy_state_buf;
- yy_delete_buffer( yy_current_buffer TSRMLS_CC );
- }
-
-void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
- {
- if ( new_in )
- {
- yy_delete_buffer( SCNG(yy_current_buffer TSRMLS_CC ) );
- yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE TSRMLS_CC ) TSRMLS_CC );
- }
-
- if ( new_out )
- SCNG(yy_out) = new_out;
- }
-
-int yyFlexLexer::LexerInput( char* buf, int max_size )
- {
- if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() )
- return 0;
-
- if (yy_current_buffer->yy_is_interactive) {
- SCNG(yy_in)->get( buf[0] );
-
- if ( SCNG(yy_in)->eof() )
- return 0;
-
- if ( SCNG(yy_in)->bad() )
- return -1;
-
- return 1;
- } else {
- (void) SCNG(yy_in)->read( buf, max_size );
-
- if ( SCNG(yy_in)->bad() )
- return -1;
- else
- return SCNG(yy_in)->gcount();
- }
- }
-
-void yyFlexLexer::LexerOutput( const char* buf, int size )
- {
- (void) SCNG(yy_out)->write( buf, size );
- }
-%*
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-%-
-static int yy_get_next_buffer(TSRMLS_D)
-%+
-int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
-%*
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- SCNG(yy_n_chars), num_to_read );
-
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
- }
-
- if ( SCNG(yy_n_chars) == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( SCNG(yy_in) TSRMLS_CC );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- SCNG(yy_n_chars) += number_to_move;
- yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-%-
-static yy_state_type yy_get_previous_state(TSRMLS_D)
-%+
-yy_state_type yyFlexLexer::yy_get_previous_state(TSRMLS_D)
-%*
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
-%% code to get the start state into yy_current_state goes here
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
-%% code to find the next state goes here
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-%-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC )
-yy_state_type yy_current_state;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC )
-%*
- {
- register int yy_is_jam;
-%% code to find the next state, and perhaps do backing up, goes here
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-%-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp TSRMLS_DC )
-#else
-static void yyunput( c, yy_bp TSRMLS_CC )
-int c;
-register char *yy_bp;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC )
-%*
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = SCNG(yy_n_chars) + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-%% update yylineno here
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-%-
-#endif /* ifndef YY_NO_UNPUT */
-%*
-
-
-%-
-#ifdef __cplusplus
-static int yyinput(TSRMLS_D)
-#else
-static int input(TSRMLS_C)
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-int yyFlexLexer::yyinput(TSRMLS_D)
-%*
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer(TSRMLS_C) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( SCNG(yy_in) TSRMLS_CC );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(TSRMLS_C);
-#else
- return input(TSRMLS_C);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-%% update BOL and yylineno
-
- return c;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yyrestart( struct _zend_file_handle *input_file TSRMLS_DC )
-#else
-void yyrestart( input_file TSRMLS_CC )
-struct _zend_file_handle *input_file;
-#endif
-%+
-void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC )
-%*
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
-
- yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC );
- yy_load_buffer_state(TSRMLS_C);
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC)
-#else
-void yy_switch_to_buffer( new_buffer TSRMLS_CC)
-YY_BUFFER_STATE new_buffer;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC )
-%*
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = SCNG(yy_n_chars);
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state(TSRMLS_C);
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( TSRMLS_D )
-#else
-void yy_load_buffer_state(TSRMLS_C)
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_load_buffer_state()
-%*
- {
- SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- SCNG(yy_in) = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( struct _zend_file_handle *file, int size TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC )
-struct _zend_file_handle *file;
-int size;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size TSRMLS_DC )
-%*
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file TSRMLS_CC );
-
- return b;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-#else
-void yy_delete_buffer( b TSRMLS_CC )
-YY_BUFFER_STATE b;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-%*
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-%-
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC )
-#else
-void yy_init_buffer( b, file TSRMLS_CC )
-YY_BUFFER_STATE b;
-struct _zend_file_handle *file;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-
-%+
-extern "C" int isatty YY_PROTO(( int ));
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file TSRMLS_DC )
-%*
-
- {
- yy_flush_buffer( b TSRMLS_CC );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-%-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file->handle.stream.interactive;
-#endif
-#endif
-%+
- b->yy_is_interactive = (file == (istream *) &cin) ? 1 : 0;
-%*
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-#else
-void yy_flush_buffer( b TSRMLS_CC )
-YY_BUFFER_STATE b;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-
-%+
-void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC )
-%*
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state(TSRMLS_C);
- }
-%*
-
-
-#ifndef YY_NO_SCAN_BUFFER
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC )
-char *base;
-yy_size_t size;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b TSRMLS_CC );
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC )
-yyconst char *yy_str;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len TSRMLS_CC );
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC )
-yyconst char *bytes;
-int len;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n TSRMLS_CC);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-%-
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state TSRMLS_DC )
-#else
-static void yy_push_state( new_state TSRMLS_CC )
-int new_state;
-#ifdef ZTS
-void ***tsrm_ls;
-#endif
-#endif
-%+
-void yyFlexLexer::yy_push_state( int new_state TSRMLS_DC )
-%*
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-%-
-static void yy_pop_state(TSRMLS_D)
-%+
-void yyFlexLexer::yy_pop_state(TSRMLS_D)
-%*
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-%-
-static int yy_top_state(TSRMLS_D)
-%+
-int yyFlexLexer::yy_top_state()
-%*
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-%-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-%+
-
-void yyFlexLexer::LexerError( yyconst char msg[] )
- {
- cerr << msg << '\n';
- exit( YY_EXIT_FAILURE );
- }
-%*
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
View
7 Zend/tests/bug42767.phpt
@@ -1,5 +1,12 @@
--TEST--
Bug #42767 (highlight_string() truncates trailing comments)
+--INI--
+highlight.string = #DD0000
+highlight.comment = #FF8000
+highlight.keyword = #007700
+highlight.bg = #FFFFFF
+highlight.default = #0000BB
+highlight.html = #000000
--FILE--
<?php
highlight_string('<?php /*some comment..');
View
35 Zend/zend.c
@@ -91,9 +91,6 @@ ZEND_INI_BEGIN()
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
STD_ZEND_INI_BOOLEAN("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, gc_enabled, zend_gc_globals, gc_globals)
STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals)
-#ifdef ZEND_MULTIBYTE
- STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
-#endif
ZEND_INI_END()
@@ -565,19 +562,15 @@ static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) /* {{{ */
#include <floatingpoint.h>
#endif
-static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
+static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
+{
+ memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
+}
+/* }}} */
+
+static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
{
- scanner_globals_p->c_buf_p = (char *) 0;
- scanner_globals_p->init = 1;
- scanner_globals_p->start = 0;
- scanner_globals_p->current_buffer = NULL;
- scanner_globals_p->yy_in = NULL;
- scanner_globals_p->yy_out = NULL;
- scanner_globals_p->_yy_more_flag = 0;
- scanner_globals_p->_yy_more_len = 0;
- scanner_globals_p->yy_start_stack_ptr = 0;
- scanner_globals_p->yy_start_stack_depth = 0;
- scanner_globals_p->yy_start_stack = 0;
+ memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
}
/* }}} */
@@ -591,8 +584,8 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
#else
- extern zend_scanner_globals ini_scanner_globals;
- extern zend_scanner_globals language_scanner_globals;
+ extern zend_ini_scanner_globals ini_scanner_globals;
+ extern zend_php_scanner_globals language_scanner_globals;
#endif
TSRMLS_FETCH();
@@ -658,8 +651,8 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifdef ZTS
ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
- ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
- ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL);
+ ts_allocate_id(&language_scanner_globals_id, sizeof(zend_php_scanner_globals), (ts_allocate_ctor) php_scanner_globals_ctor, NULL);
+ ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_ini_scanner_globals), (ts_allocate_ctor) ini_scanner_globals_ctor, NULL);
compiler_globals = ts_resource(compiler_globals_id);
executor_globals = ts_resource(executor_globals_id);
tsrm_ls = ts_resource_ex(0, NULL);
@@ -676,8 +669,8 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
zend_hash_destroy(executor_globals->zend_constants);
*executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
#else
- scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
- scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
+ ini_scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
+ php_scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
zend_set_default_compile_time_values(TSRMLS_C);
EG(user_error_handler) = NULL;
EG(user_exception_handler) = NULL;
View
63 Zend/zend_compile.c
@@ -28,10 +28,6 @@
#include "zend_exceptions.h"
#include "tsrm_virtual_cwd.h"
-#ifdef ZEND_MULTIBYTE
-#include "zend_multibyte.h"
-#endif /* ZEND_MULTIBYTE */
-
ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename TSRMLS_DC);
@@ -77,7 +73,7 @@ static void build_runtime_defined_function_key(zval *result, char *name, int nam
uint char_pos_len;
char *filename;
- char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(_yy_last_accepting_cpos));
+ char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text));
if (CG(active_op_array)->filename) {
filename = CG(active_op_array)->filename;
} else {
@@ -86,14 +82,7 @@ static void build_runtime_defined_function_key(zval *result, char *name, int nam
/* NULL, name length, filename length, last accepting char position length */
result->value.str.len = 1+name_length+strlen(filename)+char_pos_len;
-#ifdef ZEND_MULTIBYTE
- /* must be binary safe */
- result->value.str.val = (char *) safe_emalloc(result->value.str.len, 1, 1);
- result->value.str.val[0] = '\0';
- sprintf(result->value.str.val+1, "%s%s%s", name, filename, char_pos_buf);
-#else
zend_spprintf(&result->value.str.val, 0, "%c%s%s%s", '\0', name, filename, char_pos_buf);
-#endif /* ZEND_MULTIBYTE */
result->type = IS_STRING;
Z_SET_REFCOUNT_P(result, 1);
}
@@ -144,15 +133,14 @@ void zend_init_compiler_data_structures(TSRMLS_D)
CG(current_import) = NULL;
init_compiler_declarables(TSRMLS_C);
zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_arm TSRMLS_CC);
+}
+
+
+ZEND_API void file_handle_dtor(zend_file_handle *fh)
+{
+ TSRMLS_FETCH();
-#ifdef ZEND_MULTIBYTE
- CG(script_encoding_list) = NULL;
- CG(script_encoding_list_size) = 0;
- CG(internal_encoding) = NULL;
- CG(encoding_detector) = NULL;
- CG(encoding_converter) = NULL;
- CG(encoding_oddlen) = NULL;
-#endif /* ZEND_MULTIBYTE */
+ zend_file_handle_dtor(fh TSRMLS_CC);
}
@@ -162,7 +150,7 @@ void init_compiler(TSRMLS_D)
zend_init_compiler_data_structures(TSRMLS_C);
zend_init_rsrc_list(TSRMLS_C);
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
- zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
+ zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) file_handle_dtor, 0);
CG(unclean_shutdown) = 0;
}
@@ -178,12 +166,6 @@ void shutdown_compiler(TSRMLS_D)
zend_stack_destroy(&CG(list_stack));
zend_hash_destroy(&CG(filenames_table));
zend_llist_destroy(&CG(open_files));
-
-#ifdef ZEND_MULTIBYTE
- if (CG(script_encoding_list)) {
- efree(CG(script_encoding_list));
- }
-#endif /* ZEND_MULTIBYTE */
}
@@ -4322,33 +4304,12 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC)
if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) {
convert_to_long(&val->u.constant);
CG(declarables).ticks = val->u.constant;
-#ifdef ZEND_MULTIBYTE
} else if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "encoding", sizeof("encoding")-1)) {
- zend_encoding *new_encoding, *old_encoding;
- zend_encoding_filter old_input_filter;
-
- if (Z_TYPE(val->u.constant) == IS_CONSTANT) {
- zend_error(E_COMPILE_ERROR, "Cannot use constants as encoding");
- }
- convert_to_string(&val->u.constant);
- new_encoding = zend_multibyte_fetch_encoding(val->u.constant.value.str.val);
- if (!new_encoding) {
- zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", val->u.constant.value.str.val);
- } else {
- old_input_filter = LANG_SCNG(input_filter);
- old_encoding = LANG_SCNG(script_encoding);
- zend_multibyte_set_filter(new_encoding TSRMLS_CC);
-
- /* need to re-scan if input filter changed */
- if (old_input_filter != LANG_SCNG(input_filter) ||
- ((old_input_filter == zend_multibyte_script_encoding_filter) &&
- (new_encoding != old_encoding))) {
- zend_multibyte_yyinput_again(old_input_filter, old_encoding TSRMLS_CC);
- }
- }
+ /* Do not generate any kind of warning for encoding declares */
+ /* zend_error(E_COMPILE_WARNING, "Declare encoding [%s] not supported", val->u.constant.value.str.val); */
efree(val->u.constant.value.str.val);
-#endif /* ZEND_MULTIBYTE */
} else {
+ zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", var->u.constant.value.str.val);
zval_dtor(&val->u.constant);
}
zval_dtor(&var->u.constant);
View
8 Zend/zend_compile.h
@@ -655,14 +655,6 @@ int zendlex(znode *zendlval TSRMLS_DC);
#define ZEND_CT (1<<0)
#define ZEND_RT (1<<1)
-
-#define ZEND_HANDLE_FILENAME 0
-#define ZEND_HANDLE_FD 1
-#define ZEND_HANDLE_FP 2
-#define ZEND_HANDLE_STDIOSTREAM 3
-#define ZEND_HANDLE_FSTREAM 4
-#define ZEND_HANDLE_STREAM 5
-
#define ZEND_FETCH_STANDARD 0
#define ZEND_FETCH_ADD_LOCK (1<<0)
#define ZEND_FETCH_MAKE_REF (1<<1)
View
82 Zend/zend_globals.h
@@ -35,10 +35,6 @@
#include "zend_objects_API.h"
#include "zend_modules.h"
-#ifdef ZEND_MULTIBYTE
-#include "zend_multibyte.h"
-#endif /* ZEND_MULTIBYTE */
-
/* Define ZTS if you want a thread-safe Zend */
/*#undef ZTS*/
@@ -134,19 +130,6 @@ struct _zend_compiler_globals {
zval *current_namespace;
HashTable *current_import;
-#ifdef ZEND_MULTIBYTE
- zend_encoding **script_encoding_list;
- int script_encoding_list_size;
- zend_bool detect_unicode;
-
- zend_encoding *internal_encoding;
-
- /* multibyte utility functions */
- zend_encoding_detector encoding_detector;
- zend_encoding_converter encoding_converter;
- zend_encoding_oddlen encoding_oddlen;
-#endif /* ZEND_MULTIBYTE */
-
#ifdef ZTS
HashTable **static_members;
int last_static_member;
@@ -251,47 +234,40 @@ struct _zend_executor_globals {
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};
-struct _zend_scanner_globals {
+struct _zend_ini_scanner_globals {
zend_file_handle *yy_in;
zend_file_handle *yy_out;
- int yy_leng;
- char *yy_text;
- struct yy_buffer_state *current_buffer;
- char *c_buf_p;
- int init;
- int start;
+
+ unsigned int yy_leng;
+ unsigned char *yy_start;
+ unsigned char *yy_text;
+ unsigned char *yy_cursor;
+ unsigned char *yy_marker;
+ unsigned char *yy_limit;
+ int yy_state;
+ zend_stack state_stack;
+
+ char *filename;
int lineno;
- char _yy_hold_char;
- int yy_n_chars;
- int _yy_did_buffer_switch_on_eof;
- int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
- * if for whatever reason it's no longer int!
- */
- char *_yy_last_accepting_cpos;
- int _yy_more_flag;
- int _yy_more_len;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
-
- /* For ini scanner. Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
+
+ /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
int scanner_mode;
+};
+
+struct _zend_php_scanner_globals {
+ zend_file_handle *yy_in;
+ zend_file_handle *yy_out;
-#ifdef ZEND_MULTIBYTE
- /* original (unfiltered) script */
- char *script_org;
- int script_org_size;
-
- /* filtered script */
- char *script_filtered;
- int script_filtered_size;
-
- /* input/ouput filters */
- zend_encoding_filter input_filter;
- zend_encoding_filter output_filter;
- zend_encoding *script_encoding;
- zend_encoding *internal_encoding;
-#endif /* ZEND_MULTIBYTE */
+ unsigned int yy_leng;
+ unsigned char *yy_start;
+ unsigned char *yy_text;
+ unsigned char *yy_cursor;
+ unsigned char *yy_marker;
+ unsigned char *yy_limit;
+ int yy_state;
+ zend_stack state_stack;
+
+ zend_llist used_state_stacks;
};
#endif /* ZEND_GLOBALS_H */
View
11 Zend/zend_globals_macros.h
@@ -24,7 +24,8 @@
typedef struct _zend_compiler_globals zend_compiler_globals;
typedef struct _zend_executor_globals zend_executor_globals;
-typedef struct _zend_scanner_globals zend_scanner_globals;
+typedef struct _zend_php_scanner_globals zend_php_scanner_globals;
+typedef struct _zend_ini_scanner_globals zend_ini_scanner_globals;
BEGIN_EXTERN_C()
@@ -49,21 +50,21 @@ extern ZEND_API zend_executor_globals executor_globals;
/* Language Scanner */
#ifdef ZTS
-# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_scanner_globals *, v)
+# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_php_scanner_globals *, v)
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
#else
# define LANG_SCNG(v) (language_scanner_globals.v)
-extern ZEND_API zend_scanner_globals language_scanner_globals;
+extern ZEND_API zend_php_scanner_globals language_scanner_globals;
#endif
/* INI Scanner */
#ifdef ZTS
-# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_scanner_globals *, v)
+# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_ini_scanner_globals *, v)
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
#else
# define INI_SCNG(v) (ini_scanner_globals.v)
-extern ZEND_API zend_scanner_globals ini_scanner_globals;
+extern ZEND_API zend_ini_scanner_globals ini_scanner_globals;
#endif
END_EXTERN_C()
View
22 Zend/zend_highlight.c
@@ -58,17 +58,6 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
{
const char *ptr=s, *end=s+len;
-#ifdef ZEND_MULTIBYTE
- char *filtered;
- int filtered_len;
-
- if (LANG_SCNG(output_filter)) {
- LANG_SCNG(output_filter)(&filtered, &filtered_len, s, len TSRMLS_CC);
- ptr = filtered;
- end = filtered + filtered_len;
- }
-#endif /* ZEND_MULTIBYTE */
-
while (ptr<end) {
if (*ptr==' ') {
do {
@@ -78,16 +67,9 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
zend_html_putc(*ptr++);
}
}
-
-#ifdef ZEND_MULTIBYTE
- if (LANG_SCNG(output_filter)) {
- efree(filtered);
- }
-#endif /* ZEND_MULTIBYTE */
}
-
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
{
zval token;
@@ -180,7 +162,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
}
/* handler for trailing comments, see bug #42767 */
- if (LANG_SCNG(yy_leng) && LANG_SCNG(_yy_more_len)) {
+ if (LANG_SCNG(yy_leng) && LANG_SCNG(yy_text) < LANG_SCNG(yy_limit)) {
if (last_color != syntax_highlighter_ini->highlight_comment) {
if (last_color != syntax_highlighter_ini->highlight_html) {
zend_printf("</span>");
@@ -189,7 +171,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
zend_printf("<span style=\"color: %s\">", syntax_highlighter_ini->highlight_comment);
}
}
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(_yy_more_len) TSRMLS_CC);
+ zend_html_puts(LANG_SCNG(yy_text), (LANG_SCNG(yy_limit) - LANG_SCNG(yy_text)) TSRMLS_CC);
}
done:
if (last_color != syntax_highlighter_ini->highlight_html) {
View
2  Zend/zend_ini_parser.y
@@ -204,7 +204,7 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
retval = ini_parse(TSRMLS_C);
- zend_ini_close_file(fh TSRMLS_CC);
+ zend_file_handle_dtor(fh TSRMLS_CC);
shutdown_ini_scanner(TSRMLS_C);
View
1  Zend/zend_ini_scanner.h
@@ -31,7 +31,6 @@ int zend_ini_scanner_get_lineno(TSRMLS_D);
char *zend_ini_scanner_get_filename(TSRMLS_D);
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC);
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC);
-void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC);
int ini_lex(zval *ini_lval TSRMLS_DC);
void shutdown_ini_scanner(TSRMLS_D);
END_EXTERN_C()
View
217 Zend/zend_ini_scanner.l
@@ -1,4 +1,3 @@
-%{
/*
+----------------------------------------------------------------------+
| Zend Engine |
@@ -15,18 +14,41 @@
+----------------------------------------------------------------------+
| Authors: Zeev Suraski <zeev@zend.com> |
| Jani Taskinen <jani@php.net> |
+ | Marcus Boerger <helly@php.net> |
+ | Nuno Lopes <nlopess@php.net> |
+ | Scott MacVicar <scottmac@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
-#define DEBUG_CFG_SCANNER 0
-#define yyleng SCNG(yy_leng)
-#define yytext SCNG(yy_text)
-#define yytext_ptr SCNG(yy_text)
-#define yyin SCNG(yy_in)
-#define yyout SCNG(yy_out)
+#if 0
+# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c)
+#else
+# define YYDEBUG(s, c)
+#endif
+
+#include "zend_ini_scanner_defs.h"
+
+#define YYCTYPE unsigned char
+#define YYFILL(n) { if (n == 1) return 0; }
+#define YYCURSOR SCNG(yy_cursor)
+#define YYLIMIT SCNG(yy_limit)
+#define YYMARKER SCNG(yy_marker)
+
+#define YYGETCONDITION() SCNG(yy_state)
+#define YYSETCONDITION(s) SCNG(yy_state) = s
+
+#define STATE(name) yyc##name
+
+/* emulate flex constructs */
+#define BEGIN(state) YYSETCONDITION(STATE(state))
+#define YYSTATE YYGETCONDITION()
+#define yytext ((char*)SCNG(yy_text))
+#define yyleng SCNG(yy_leng)
+#define yyless(x) YYCURSOR = yytext + x
+/* #define yymore() goto yymore_restart */
/* How it works (for the core ini directives):
* ===========================================
@@ -47,7 +69,7 @@
* 5. User defined ini files (like .htaccess for apache) are parsed for each request and
* stored in separate hash defined by SAPI.
*/
-
+
/* TODO: (ordered by importance :-)
* ===============================================================================
*
@@ -58,41 +80,18 @@
*
*/
-/* These are not needed when yymore() is not used */
-/*
-#define yy_last_accepting_state SCNG(_yy_last_accepting_state)
-#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos)
-#define yy_more_flag SCNG(_yy_more_flag)
-#define yy_more_len SCNG(_yy_more_len)
-*/
-
-%}
-
-%x ST_DOUBLE_QUOTES
-%x ST_OFFSET
-%x ST_RAW
-%x ST_SECTION_RAW
-%x ST_SECTION_VALUE
-%x ST_VALUE
-%x ST_VARNAME
-%option stack
-
-%{
-
#include <errno.h>
#include "zend.h"
#include "zend_globals.h"
#include <zend_ini_parser.h>
#include "zend_ini_scanner.h"
-#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC)
-
/* Globals Macros */
#define SCNG INI_SCNG
#ifdef ZTS
ZEND_API ts_rsrc_id ini_scanner_globals_id;
#else
-ZEND_API zend_scanner_globals ini_scanner_globals;
+ZEND_API zend_ini_scanner_globals ini_scanner_globals;
#endif
/* Eat trailing whitespace + extra char */
@@ -105,7 +104,6 @@ ZEND_API zend_scanner_globals ini_scanner_globals;
yytext[yyleng - 1] == ' ') \
) { \
yyleng--; \
- yytext[yyleng]=0; \
}
/* Eat trailing whitespace */
@@ -122,7 +120,30 @@ ZEND_API zend_scanner_globals ini_scanner_globals;
return type; \
}
-static char *ini_filename;
+static void _yy_push_state(int new_state TSRMLS_DC)
+{
+ zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int));
+ YYSETCONDITION(new_state);
+}
+
+#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
+
+static void yy_pop_state(TSRMLS_D)
+{
+ int *stack_state;
+ zend_stack_top(&SCNG(state_stack), (void **) &stack_state);
+ YYSETCONDITION(*stack_state);
+ zend_stack_del_top(&SCNG(state_stack));
+}
+
+static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
+{
+ YYCURSOR = (YYCTYPE*)str;
+ SCNG(yy_start) = YYCURSOR;
+ YYLIMIT = YYCURSOR + len;
+}
+
+#define ini_filename SCNG(filename)
/* {{{ init_ini_scanner()
*/
@@ -130,9 +151,8 @@ static void init_ini_scanner(TSRMLS_D)
{
SCNG(lineno) = 1;
SCNG(scanner_mode) = ZEND_INI_SCANNER_NORMAL;
- SCNG(yy_start_stack_ptr) = 0;
- SCNG(yy_start_stack_depth) = 0;
- SCNG(current_buffer) = NULL;
+ zend_stack_init(&SCNG(state_stack));
+ BEGIN(INITIAL);
}
/* }}} */
@@ -140,11 +160,7 @@ static void init_ini_scanner(TSRMLS_D)
*/
void shutdown_ini_scanner(TSRMLS_D)
{
- if (SCNG(yy_start_stack)) {
- yy_flex_free(SCNG(yy_start_stack));
- SCNG(yy_start_stack) = NULL;
- }
- yy_delete_buffer(SCNG(current_buffer) TSRMLS_CC);
+ zend_stack_destroy(&SCNG(state_stack));
if (ini_filename) {
free(ini_filename);
}
@@ -171,14 +187,17 @@ char *zend_ini_scanner_get_filename(TSRMLS_D)
*/
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC)
{
- if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) {
+ char *buf;
+ size_t size;
+
+ if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) {
return FAILURE;
}
init_ini_scanner(TSRMLS_C);
SCNG(scanner_mode) = scanner_mode;
- yyin = fh;
- yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
+ SCNG(yy_in) = fh;
+ yy_scan_buffer(buf, size TSRMLS_CC);
ini_filename = zend_strndup(fh->filename, strlen(fh->filename));
return SUCCESS;
}
@@ -192,21 +211,13 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
init_ini_scanner(TSRMLS_C);
SCNG(scanner_mode) = scanner_mode;
- yyin = NULL;
- yy_scan_buffer(str, len + 2 TSRMLS_CC);
+ SCNG(yy_in) = NULL;
+ yy_scan_buffer(str, len TSRMLS_CC);
ini_filename = NULL;
return SUCCESS;
}
/* }}} */
-/* {{{ zend_ini_close_file()
-*/
-void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
-{
- zend_stream_close(fh);
-}
-/* }}} */
-
/* {{{ zend_ini_escape_string()
*/
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
@@ -267,7 +278,22 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
}
/* }}} */
-%}
+int ini_lex(zval *ini_lval TSRMLS_DC)
+{
+restart:
+ SCNG(yy_text) = YYCURSOR;
+
+/* yymore_restart: */
+ /* detect EOF */
+ if (YYCURSOR >= YYLIMIT) {
+ if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
+ BEGIN(INITIAL);
+ return 0;
+ }
+ return 0;
+ }
+
+/*!re2c
LNUM [0-9]+
DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
@@ -286,21 +312,12 @@ SECTION_RAW_CHARS [^\]\n\r]
SINGLE_QUOTED_CHARS [^']
RAW_VALUE_CHARS [^=\n\r;]
-/* Allow using ${foobar} in sections, quoted strings and values */
-LITERAL_DOLLAR ("$"([^a-zA-Z0-9{]|("\\"{ANY_CHAR})))
-VALUE_CHARS ([^$= \t\n\r;&|~()!"']|{LITERAL_DOLLAR})
+LITERAL_DOLLAR ("$"([^a-zA-Z0-9{\000]|("\\"{ANY_CHAR})))
+VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})
SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
-/* " */
-
-%option nounput
-%option noyywrap
-%option noyylineno
-%option noyy_top_state
-%option never-interactive
-
-%%
+<!*> := yyleng = YYCURSOR - SCNG(yy_text);
<INITIAL>"[" { /* Section start */
/* Enter section data lookup state */
@@ -315,9 +332,8 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
<ST_VALUE,ST_SECTION_VALUE,ST_OFFSET>"'"{SINGLE_QUOTED_CHARS}+"'" { /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
- yytext++;
+ SCNG(yy_text)++;
yyleng = yyleng - 2;
- yytext[yyleng] = 0;
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
@@ -334,7 +350,7 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
/* Enter offset lookup state */
yy_push_state(ST_OFFSET TSRMLS_CC);
-
+
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
}
@@ -369,7 +385,7 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
RETURN_TOKEN(TC_LABEL, yytext, yyleng);
}
-<INITIAL>{TABS_AND_SPACES}*[=]{TABS_AND_SPACES}* { /* Start option value */
+<INITIAL>{TABS_AND_SPACES}*[=]{TABS_AND_SPACES}* { /* Start option value */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
yy_push_state(ST_RAW TSRMLS_CC);
} else {
@@ -381,9 +397,9 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
<ST_RAW>{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
/* Eat leading and trailing double quotes */
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
- yytext++;
+ SCNG(yy_text)++;
yyleng = yyleng - 2;
- yytext[yyleng] = 0;
+ yytext[yyleng] = 0;
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
@@ -415,7 +431,7 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
}
<ST_VALUE>[=] { /* Make = used in option value to trigger error */
- yyless(yyleng - 1);
+ yyless(0);
BEGIN(INITIAL);
return END_OF_LINE;
}