- Speed up by making null/false/true reserved word which allows to drop

an opcode (FETCH_CONSTANT) for every usage.
This commit is contained in:
Marcus Boerger 2004-07-16 06:50:57 +00:00
parent 381a3b234f
commit 86d46f7cc1
2 changed files with 22 additions and 0 deletions

View file

@ -142,6 +142,9 @@
%token T_DOLLAR_OPEN_CURLY_BRACES %token T_DOLLAR_OPEN_CURLY_BRACES
%token T_CURLY_OPEN %token T_CURLY_OPEN
%token T_PAAMAYIM_NEKUDOTAYIM %token T_PAAMAYIM_NEKUDOTAYIM
%token T_NULL
%token T_FALSE
%token T_TRUE
%% /* Rules */ %% /* Rules */
@ -675,6 +678,9 @@ common_scalar:
| T_CLASS_C { $$ = $1; } | T_CLASS_C { $$ = $1; }
| T_METHOD_C { $$ = $1; } | T_METHOD_C { $$ = $1; }
| T_FUNC_C { $$ = $1; } | T_FUNC_C { $$ = $1; }
| T_NULL { $$ = $1; }
| T_FALSE { $$ = $1; }
| T_TRUE { $$ = $1; }
; ;

View file

@ -57,6 +57,7 @@
#include "zend_constants.h" #include "zend_constants.h"
#include "zend_variables.h" #include "zend_variables.h"
#include "zend_operators.h" #include "zend_operators.h"
#include "zend_API.h"
#ifdef HAVE_STDARG_H #ifdef HAVE_STDARG_H
# include <stdarg.h> # include <stdarg.h>
@ -1303,6 +1304,21 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_FILE; return T_FILE;
} }
<ST_IN_SCRIPTING>"NULL" {
ZVAL_NULL(zendlval);
return T_NULL;
}
<ST_IN_SCRIPTING>"FALSE" {
ZVAL_FALSE(zendlval);
return T_FALSE;
}
<ST_IN_SCRIPTING>"TRUE" {
ZVAL_TRUE(zendlval);
return T_TRUE;
}
<INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" { <INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" {
#ifdef ZEND_MULTIBYTE #ifdef ZEND_MULTIBYTE
if (SCNG(output_filter)) { if (SCNG(output_filter)) {