From 694b0290a6ec0722820d2db848cc510104623e5d Mon Sep 17 00:00:00 2001 From: Rodion Efremov Date: Sat, 15 Jun 2019 15:16:14 +0300 Subject: [PATCH 01/10] Fixed the leftwards diagram arrows from < to <. Some arrow diagrams are rendered as `<--` instead of `<--`. --- spec/04-basic-concepts.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/04-basic-concepts.md b/spec/04-basic-concepts.md index bdb84eb0..bfc81b60 100644 --- a/spec/04-basic-concepts.md +++ b/spec/04-basic-concepts.md @@ -516,12 +516,12 @@ We can remove all these handles using `$a = NULL` and `$b = NULL`: ``` [VSlot $a *]-->[VStore null] [HStore Point [VSlot $x *] [VSlot $y *] (dead)] | | -[VSlot $b *]-->[VStore null] [VStore int 2 (dead)]<--+ V +[VSlot $b *]-->[VStore null] [VStore int 2 (dead)]<--+ V [VStore int 1 (dead)] [HStore Point [VSlot $x *] [VSlot $y *] (dead)] | | - [VStore int 4 (dead)]<--+ V + [VStore int 4 (dead)]<--+ V [VStore int 6 (dead)] ``` @@ -750,7 +750,7 @@ assignment of other types. Recall the `Point` class from [the examples](#value-a V V [VStore int 10] [VStore Obj *] | - [HStore Point [VSlot $x *] [VSlot $y *]]<----+ + [HStore Point [VSlot $x *] [VSlot $y *]]<----+ | | V V [VStore int 1] [VStore int 3] @@ -782,7 +782,7 @@ the value assignment `$b = $a`: | | | +---------+ +---------+ | V V | -[VStore int 10] [VStore object *]-->[HStore Point [VSlot $x *] [VSlot $y *]]<---+ +[VStore int 10] [VStore object *]-->[HStore Point [VSlot $x *] [VSlot $y *]]<---+ | | V V [VStore int 1] [VStore int 3] @@ -830,7 +830,7 @@ implementation. Here is the first possible outcome: ``` [VSlot $a *]---->[VStore array *]---->[HStore Array [VSlot 0 *]] | -[VSlot $x *]-------------------------+ [VStore array *]<---+ +[VSlot $x *]-------------------------+ [VStore array *]<---+ | | [VSlot $b *]-->[VStore array *] | V | | [HStore Array [VSlot 0 *][VSlot 1 *]] @@ -852,7 +852,7 @@ Here is the second possible outcome: ``` [VSlot $a *]---->[VStore array *]---->[HStore Array [VSlot 0 *]] | -[VSlot $x *]-------------------------+ [VStore array *]<----+ +[VSlot $x *]-------------------------+ [VStore array *]<----+ | | [VSlot $b *]-->[VStore array *] | V | | [HStore Array [VSlot 0 *] [VSlot 1 *]] @@ -939,7 +939,7 @@ $b = $a; ``` [VSlot $a *]--->[VStore array *]--->[HStore Array [VSlot 0 *]] ^ | - | [VStore array *]<--+ + | [VStore array *]<--+ [VSlot $b *]--->[VStore Arr-D *]------+ | V [HStore Array [VSlot 0 *] [VSlot 1 *]] @@ -1036,7 +1036,7 @@ possible outcome: ``` [VSlot $a *]---->[VStore array *]---->[HStore Array [VSlot 0 *]] | -[VSlot $b *]-->[VStore array *] [VStore array *]<---+ +[VSlot $b *]-->[VStore array *] [VStore array *]<---+ | | V V [HStore Array [VSlot 0 *] [VSlot 1 *]] [HStore Array [VSlot 0 *] [VSlot 1 *]] @@ -1057,8 +1057,8 @@ Here is the third possible outcome: ``` [VSlot $a *]---->[VStore array *-]---->[HStore Array [VSlot 0 *]] - | -[VSlot $b *]-->[VStore array *] [VStore array *]<---+ + | +[VSlot $b *]-->[VStore array *] [VStore array *]<---+ | | V V [HStore Array [VSlot 0 *] [VSlot 1 *]] [HStore Array [VSlot 0 *] [VSlot 1 *]] @@ -1204,7 +1204,7 @@ Will result in: | | | V V | [VStore int 1] [VStore int 3] | -[VSlot $b *]---------------->[VStore int 123]<---------------------------------------+ +[VSlot $b *]---------------->[VStore int 123]<---------------------------------------+ ``` ### Argument Passing @@ -1267,7 +1267,7 @@ some type(s) or to an instance of some other type. V V [VStore int 10] [VStore object *] | - [HStore ...]<---------+ + [HStore ...]<---------+ ``` Let us consider the result of `$b = clone $a`: @@ -1279,7 +1279,7 @@ Let us consider the result of `$b = clone $a`: | [VStore int 10] [VStore object *] +-----------------------+ | V | - [HStore Widget [VSlot $p1 *] [VSlot $p2 *]] +--->[HStore ...]<-+ + [HStore Widget [VSlot $p1 *] [VSlot $p2 *]] +--->[HStore ...]<-+ | | | V V | [VStore int 10] [VStore object *]----------+ From 8a7e96736ac18cdd159b7af2e7d1e4c666c9c822 Mon Sep 17 00:00:00 2001 From: Rodion Efremov Date: Sat, 15 Jun 2019 15:11:13 +0300 Subject: [PATCH 02/10] Added missing $ to &colors. Line 257 reads "$b = &colors[100];", but should be "$b = &$colors[100];". --- spec/07-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/07-variables.md b/spec/07-variables.md index cfb17ff1..b280fda8 100644 --- a/spec/07-variables.md +++ b/spec/07-variables.md @@ -254,7 +254,7 @@ echo $colors[100]; // element with offset 100 is still undefined and NULL // is used as substitution value instead. Another // notice is emitted. -$b = &colors[100]; // a VSlot for $b is created which points to the array +$b = &$colors[100]; // a VSlot for $b is created which points to the array // element with the offset 100. An array element with // offset 100 was undefined but implicitly defined // because the assignment is byRef. Thus a VSlot for From 6e288468b63910d0e5f9ec06fd35b2d0b2e52327 Mon Sep 17 00:00:00 2001 From: Tiffany Date: Thu, 6 May 2021 20:19:38 -0500 Subject: [PATCH 03/10] Fix encoding for < to < --- spec/04-basic-concepts.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/04-basic-concepts.md b/spec/04-basic-concepts.md index bfc81b60..6f99d468 100644 --- a/spec/04-basic-concepts.md +++ b/spec/04-basic-concepts.md @@ -1001,7 +1001,7 @@ outcomes: ``` [VSlot $a *]---->[VStore array *]---->[HStore Array [VSlot 0 *]] | -[VSlot $b *]-->[VStore array *] [VStore Arr *]<---+ +[VSlot $b *]-->[VStore array *] [VStore Arr *]<---+ | | +----------------------+ +----------+ V V @@ -1050,7 +1050,7 @@ possible outcome: | V | | [VStore string 'hi'] | V | - [VSlot $x *]--------------------->[VStore int 123]<--------+ + [VSlot $x *]--------------------->[VStore int 123]<--------+ ``` Here is the third possible outcome: @@ -1068,11 +1068,11 @@ Here is the third possible outcome: V | V [VStore Arr-D *]-->[HStore Array [VSlot 0 *] [VSlot 1 *]] | [VStore string 'hi'] | | | - [VStore int 123]<-------+ | | + [VStore int 123]<-------+ | | V | [VStore string 'hi'] | | - [VSlot $x *]--------------------->[VStore int 123]<---------+ + [VSlot $x *]--------------------->[VStore int 123]<---------+ ``` The second and third possible outcomes show what can possibly happen if From f9d4f7480aae28805c5be13a26ac8d193dea21b1 Mon Sep 17 00:00:00 2001 From: David Findley Date: Sat, 5 Feb 2022 13:57:00 -0600 Subject: [PATCH 04/10] Namespace definition grammar fix (#254) * Fix the `namespace-definition` production The `namespace-definition` production was changed to use `name` instead of `namespace-name` in c1ac5314798f6740f and a6520fb35b746a6e6c275. This appears to be a mistake, since `name` can not produce a `\`. The spec was originally using `namespace-name` for `namespace-definition`. This commit restores that grammar production. * Regenerate using `tools/pre-commit` It appears that the pre-commit scripts were not used to properly regenerate the spec recently. This caused some small styling changes (using html entities for some chars). It also caused a bigger change due to `print` being moved out of the intrinsics section in 63d72a6df5d2c7b1b7a8a. It's not completely clear if this was intentional or not, since `print` is a language intrinsic. --- spec/00-specification-for-php.md | 2 +- spec/09-lexical-structure.md | 8 ++++---- spec/11-statements.md | 2 +- spec/18-namespaces.md | 8 ++++---- spec/19-grammar.md | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/00-specification-for-php.md b/spec/00-specification-for-php.md index a99db747..19e5b3d2 100644 --- a/spec/00-specification-for-php.md +++ b/spec/00-specification-for-php.md @@ -109,7 +109,6 @@ is distributed without any warranty. - [eval](10-expressions.md#eval) - [exit/die](10-expressions.md#exitdie) - [isset](10-expressions.md#isset) - - [print](10-expressions.md#print) - [Anonymous Function Creation](10-expressions.md#anonymous-function-creation) - [The `new` Operator](10-expressions.md#the-new-operator) - [Array Creation Operator](10-expressions.md#array-creation-operator) @@ -149,6 +148,7 @@ is distributed without any warranty. - [byRef Assignment](10-expressions.md#byref-assignment) - [Compound Assignment](10-expressions.md#compound-assignment) - [`yield` Operator](10-expressions.md#yield-operator) + - [Print expression](10-expressions.md#print-expression) - [Logical AND Operator (form 2)](10-expressions.md#logical-and-operator-form-2) - [Logical Exclusive OR Operator](10-expressions.md#logical-exclusive-or-operator) - [Logical Inclusive OR Operator (form 2)](10-expressions.md#logical-inclusive-or-operator-form-2) diff --git a/spec/09-lexical-structure.md b/spec/09-lexical-structure.md index 4a25908c..537c9936 100644 --- a/spec/09-lexical-structure.md +++ b/spec/09-lexical-structure.md @@ -683,7 +683,7 @@ b-prefix:: one of
 single-quoted-string-literal::
-   b-prefixopt   '   sq-char-sequenceopt   '
+   b-prefixopt   '   sq-char-sequenceopt   '
 
 sq-char-sequence::
    sq-char
@@ -691,10 +691,10 @@ b-prefix:: one of
 
 sq-char::
    sq-escape-sequence
-   \opt   any member of the source character set except single-quote (') or backslash (\)
+   \opt   any member of the source character set except single-quote (') or backslash (\)
 
 sq-escape-sequence:: one of
-   \'   \\
+   \'   \\
 
 b-prefix:: one of
    b   B
@@ -1065,7 +1065,7 @@ nowdoc-string-literal::
 
 
 nowdoc-string-literal::
-   b-prefixopt   <<<   '   name   '   new-line   hd-bodyopt   name   ;opt   new-line
+   b-prefixopt   <<<   '   name   '   new-line   hd-bodyopt   name   ;opt   new-line
 
**Constraints** diff --git a/spec/11-statements.md b/spec/11-statements.md index 39bd0ce1..d9eb5d1d 100644 --- a/spec/11-statements.md +++ b/spec/11-statements.md @@ -1337,7 +1337,7 @@ a [`__toString` method](14-classes.md#method-__tostring). After converting each of its *expression*s' values to strings, if necessary, `echo` concatenates them in order given, and writes the -resulting string to [`STDOUT`](06-constants.md#core-predefined-constants). Unlike [`print`](10-expressions.md#print), it does +resulting string to [`STDOUT`](06-constants.md#core-predefined-constants). Unlike [`print`](10-expressions.md#print-expression), it does not produce a result. See also: [double quoted strings](09-lexical-structure.md#double-quoted-string-literals) and diff --git a/spec/18-namespaces.md b/spec/18-namespaces.md index 76d473af..715dff62 100644 --- a/spec/18-namespaces.md +++ b/spec/18-namespaces.md @@ -38,14 +38,14 @@ prefixes are reserved for use by PHP.
 namespace-definition:
-   namespace   name   ;
-   namespace   nameopt   compound-statement
+   namespace   namespace-name   ;
+   namespace   namespace-nameopt   compound-statement
 
**Constraints** diff --git a/spec/19-grammar.md b/spec/19-grammar.md index 1ebc1927..e52237c2 100644 --- a/spec/19-grammar.md +++ b/spec/19-grammar.md @@ -170,7 +170,7 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md# nowdoc-string-literal single-quoted-string-literal:: - b-prefixopt ' sq-char-sequenceopt ' + b-prefixopt ' sq-char-sequenceopt ' sq-char-sequence:: sq-char @@ -178,10 +178,10 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md# sq-char:: sq-escape-sequence - \opt any member of the source character set except single-quote (') or backslash (\) + \opt any member of the source character set except single-quote (') or backslash (\) sq-escape-sequence:: one of - \' \\ + \' \\ b-prefix:: one of b B @@ -271,7 +271,7 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md# \\ \$ \e \f \n \r \t \v nowdoc-string-literal:: - b-prefixopt <<< ' name ' new-line hd-bodyopt name ;opt new-line + b-prefixopt <<< ' name ' new-line hd-bodyopt name ;opt new-line operator-or-punctuator:: one of [ ] ( ) { } . -> ++ -- ** * + - ~ ! @@ -1119,8 +1119,8 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md#
 namespace-definition:
-   namespace   name   ;
-   namespace   nameopt   compound-statement
+   namespace   namespace-name   ;
+   namespace   namespace-nameopt   compound-statement
 
 namespace-use-declaration:
    use   namespace-function-or-constopt   namespace-use-clauses   ;

From f268abd41944313b606b007caf177919f4ab4fe7 Mon Sep 17 00:00:00 2001
From: Carter Snook 
Date: Mon, 12 Dec 2022 06:35:09 -0600
Subject: [PATCH 05/10] fix(constants): remove duplicate E_USER_DEPRECATED def

Closes GH-256.
---
 spec/06-constants.md | 1 -
 1 file changed, 1 deletion(-)

diff --git a/spec/06-constants.md b/spec/06-constants.md
index 06217185..8b23a2af 100644
--- a/spec/06-constants.md
+++ b/spec/06-constants.md
@@ -73,7 +73,6 @@ Constant Name | Description
 `E_USER_NOTICE` | `int`; User-generated warning message. This is like an `E_NOTICE`, except that `E_USER_NOTICE` is generated in PHP code by using the library function [`trigger_error`](http://www.php.net/trigger_error).
 `E_USER_WARNING` |  `int`; User-generated warning message. This is like an `E_WARNING`, except that  `E_USER_WARNING` is generated in PHP code by using the library function [`trigger_error`](http://www.php.net/trigger_error).
 `E_WARNING` | `int`; Run-time warnings (non-fatal errors). Execution of the script is not halted.
-`E_USER_DEPRECATED` | `int`; User-generated warning message. This is like an `E_DEPRECATED`, except that `E_USER_DEPRECATED` is generated in PHP code by using the library function [`trigger_error`](http://www.php.net/trigger_error).
 `FALSE` |   `bool`; the case-insensitive Boolean value `FALSE`.
 `INF` | `float`; Infinity
 `M_1_PI` |  `float`; 1/pi

From ffa3fa58a1062aed7c85f04d10e340677364ce48 Mon Sep 17 00:00:00 2001
From: Peter Kokot 
Date: Fri, 3 Feb 2023 21:43:24 +0100
Subject: [PATCH 06/10] Mention GitHub upstream instead of obsolete git.php.net

---
 README.md | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 5c35b654..14f780c2 100644
--- a/README.md
+++ b/README.md
@@ -10,11 +10,7 @@ Bug reports can be filed at:
 
 > [https://github.com/php/php-langspec/issues](https://github.com/php/php-langspec/issues)
 
-The upstream url of this repo is:
-
-    git@git.php.net:/php-langspec.git
-
-It is also mirrored on GitHub:
+The upstream URL of this repo is:
 
 > [https://github.com/php/php-langspec](https://github.com/php/php-langspec)
 

From 4c19272d1f832faba8c7bc808bf4a2db4412a6c4 Mon Sep 17 00:00:00 2001
From: Superkooka 
Date: Fri, 24 Feb 2023 00:43:29 +0100
Subject: [PATCH 07/10] Fix markdown typo in spec/ (#249)

---
 spec/08-conversions.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spec/08-conversions.md b/spec/08-conversions.md
index e93183d3..069676d6 100644
--- a/spec/08-conversions.md
+++ b/spec/08-conversions.md
@@ -14,7 +14,7 @@ Conversions to `resource` and `null` types can not be performed.
 
 ## Converting to Boolean Type
 
-The [result type] (http://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting) is [`bool`](05-types.md#the-boolean-type).
+The [result type](http://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting) is [`bool`](05-types.md#the-boolean-type).
 
 If the source type is `int` or `float`, then if the source value tests equal
 to 0, the result value is `FALSE`; otherwise, the result value is `TRUE`.

From bf7423a820247f6584c329b5a75ca0e61b7e2940 Mon Sep 17 00:00:00 2001
From: Sergey Panteleev 
Date: Sat, 24 Feb 2024 18:48:02 +0300
Subject: [PATCH 08/10] Update ML instructions

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 14f780c2..5875ef0e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ This repo contains the WIP PHP Language Specifications.
 
 To join the conversation, send a blank email to:
 
-> [standards-subscribe@lists.php.net](mailto:standards-subscribe@lists.php.net)
+> [standards+subscribe@lists.php.net](mailto:standards+subscribe@lists.php.net)
 
 Bug reports can be filed at:
 

From 287f3d0e12391be858d6623a4bec035d2647c621 Mon Sep 17 00:00:00 2001
From: Ben Ramsey 
Date: Sat, 24 Feb 2024 17:08:39 -0600
Subject: [PATCH 09/10] Indicate space is allowed between "endswitch" and ";"

---
 spec/11-statements.md | 4 ++--
 spec/19-grammar.md    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/spec/11-statements.md b/spec/11-statements.md
index d9eb5d1d..61af9cc8 100644
--- a/spec/11-statements.md
+++ b/spec/11-statements.md
@@ -314,7 +314,7 @@ else  // this else does go with the outer if