Skip to content

Commit c2b0fe1

Browse files
Blast off to space.
1 parent 6c5b3df commit c2b0fe1

12 files changed

+3256
-2956
lines changed

‎NEWS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
context. (Nikita)
3939
. Removed support for #-style comments in ini files. (Nikita)
4040
. Invalid octal literals in source code now produce compile errors, fixes PHPSadness #31. (Andrea)
41+
. Added <=> operator. (Andrea)
4142

4243
- Date:
4344
. Fixed day_of_week function as it could sometimes return negative values

‎UPGRADING‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ PHP X.Y UPGRADE NOTES
9898
. Added \u{xxxxxx} Unicode Codepoint Escape Syntax for double-quoted strings
9999
and heredocs.
100100
. define() now supports arrays as constant values, fixing an oversight where define() did not support arrays yet const syntax did.
101+
. Added the comparison operator (<=>), aka the spaceship operator.
101102

102103
========================================
103104
3. Changes in SAPI modules

‎Zend/zend_language_parser.y‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
7676
%left '^'
7777
%left '&'
7878
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
79-
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
79+
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL T_SPACESHIP
8080
%left T_SL T_SR
8181
%left '+' '-' '.'
8282
%left '*' '/' '%'
@@ -131,6 +131,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
131131
%token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)"
132132
%token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)"
133133
%token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)"
134+
%token T_SPACESHIP "<=> (T_SPACESHIP)"
134135
%token T_SL "<< (T_SL)"
135136
%token T_SR ">> (T_SR)"
136137
%token T_INSTANCEOF "instanceof (T_INSTANCEOF)"
@@ -842,6 +843,8 @@ expr_without_variable:
842843
{ $$ = zend_ast_create(ZEND_AST_GREATER, $1, $3); }
843844
| expr T_IS_GREATER_OR_EQUAL expr
844845
{ $$ = zend_ast_create(ZEND_AST_GREATER_EQUAL, $1, $3); }
846+
| expr T_SPACESHIP expr
847+
{ $$ = zend_ast_create_binary_op(ZEND_SPACESHIP, $1, $3); }
845848
| expr T_INSTANCEOF class_name_reference
846849
{ $$ = zend_ast_create(ZEND_AST_INSTANCEOF, $1, $3); }
847850
| '(' expr ')' { $$ = $2; }

0 commit comments

Comments
 (0)