[php-langspec] master: Namespace definition grammar fix (#254)

[email protected] (David Findley via GitHub) Sat, 5 Feb 2022 19:57:55 +0000
Newsgroups php.standards.cvs
Message-ID <[email protected]>
Author: David Findley (tortis)
Committer: GitHub (web-flow)
Pusher: nikic
Date: 2022-02-05T20:57:00+01:00

Commit: https://github.com/php/php-langspec/commit/f9d4f7480aae28805c5be13a26ac8d193dea21b1
Raw diff: https://github.com/php/php-langspec/commit/f9d4f7480aae28805c5be13a26ac8d193dea21b1.diff

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.

Changed paths:
  M  spec/00-specification-for-php.md
  M  spec/09-lexical-structure.md
  M  spec/11-statements.md
  M  spec/18-namespaces.md
  M  spec/19-grammar.md


Diff:

diff --git a/spec/00-specification-for-php.md b/spec/00-specification-for-php.md
index a99db74..19e5b3d 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 4a25908..537c993 100644
--- a/spec/09-lexical-structure.md
+++ b/spec/09-lexical-structure.md
@@ -683,7 +683,7 @@ b-prefix:: one of
 
 <pre>
 <i id="grammar-single-quoted-string-literal">single-quoted-string-literal::</i>
-   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   '   <i><a href="#grammar-sq-char-sequence">sq-char-sequence</a></i><sub>opt</sub>   '
+   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   &#039;   <i><a href="#grammar-sq-char-sequence">sq-char-sequence</a></i><sub>opt</sub>   &#039;
 
 <i id="grammar-sq-char-sequence">sq-char-sequence::</i>
    <i><a href="#grammar-sq-char">sq-char</a></i>
@@ -691,10 +691,10 @@ b-prefix:: one of
 
 <i id="grammar-sq-char">sq-char::</i>
    <i><a href="#grammar-sq-escape-sequence">sq-escape-sequence</a></i>
-   \<sub>opt</sub>   any member of the source character set except single-quote (') or backslash (\)
+   \<sub>opt</sub>   any member of the source character set except single-quote (&#039;) or backslash (\)
 
 <i id="grammar-sq-escape-sequence">sq-escape-sequence:: one of</i>
-   \'   \\
+   \&#039;   \\
 
 <i id="grammar-b-prefix">b-prefix:: one of</i>
    b   B
@@ -1065,7 +1065,7 @@ nowdoc-string-literal::
 
 <pre>
 <i id="grammar-nowdoc-string-literal">nowdoc-string-literal::</i>
-   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   &lt;&lt;&lt;   '   <i><a href="#grammar-name">name</a></i>   '   <i><a href="#grammar-new-line">new-line</a></i>   <i><a href="#grammar-hd-body">hd-body</a></i><sub>opt</sub>   <i><a href="#grammar-name">name</a></i>   ;<sub>opt</sub>   <i><a href="#grammar-new-line">new-line</a></i>
+   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   &lt;&lt;&lt;   &#039;   <i><a href="#grammar-name">name</a></i>   &#039;   <i><a href="#grammar-new-line">new-line</a></i>   <i><a href="#grammar-hd-body">hd-body</a></i><sub>opt</sub>   <i><a href="#grammar-name">name</a></i>   ;<sub>opt</sub>   <i><a href="#grammar-new-line">new-line</a></i>
 </pre>
 
 **Constraints**
diff --git a/spec/11-statements.md b/spec/11-statements.md
index 39bd0ce..d9eb5d1 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 76d473a..715dff6 100644
--- a/spec/18-namespaces.md
+++ b/spec/18-namespaces.md
@@ -38,14 +38,14 @@ prefixes are reserved for use by PHP.
 
 <!-- GRAMMAR
 namespace-definition:
-  'namespace' name ';'
-  'namespace' name? compound-statement
+  'namespace' namespace-name ';'
+  'namespace' namespace-name? compound-statement
 -->
 
 <pre>
 <i id="grammar-namespace-definition">namespace-definition:</i>
-   namespace   <i><a href="09-lexical-structure.md#grammar-name">name</a></i>   ;
-   namespace   <i><a href="09-lexical-structure.md#grammar-name">name</a></i><sub>opt</sub>   <i><a href="11-statements.md#grammar-compound-statement">compound-statement</a></i>
+   namespace   <i><a href="09-lexical-structure.md#grammar-namespace-name">namespace-name</a></i>   ;
+   namespace   <i><a href="09-lexical-structure.md#grammar-namespace-name">namespace-name</a></i><sub>opt</sub>   <i><a href="11-statements.md#grammar-compound-statement">compound-statement</a></i>
 </pre>
 
 **Constraints**
diff --git a/spec/19-grammar.md b/spec/19-grammar.md
index 1ebc192..e52237c 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#
    <i><a href="#grammar-nowdoc-string-literal">nowdoc-string-literal</a></i>
 
 <i id="grammar-single-quoted-string-literal">single-quoted-string-literal::</i>
-   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   '   <i><a href="#grammar-sq-char-sequence">sq-char-sequence</a></i><sub>opt</sub>   '
+   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   &#039;   <i><a href="#grammar-sq-char-sequence">sq-char-sequence</a></i><sub>opt</sub>   &#039;
 
 <i id="grammar-sq-char-sequence">sq-char-sequence::</i>
    <i><a href="#grammar-sq-char">sq-char</a></i>
@@ -178,10 +178,10 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md#
 
 <i id="grammar-sq-char">sq-char::</i>
    <i><a href="#grammar-sq-escape-sequence">sq-escape-sequence</a></i>
-   \<sub>opt</sub>   any member of the source character set except single-quote (') or backslash (\)
+   \<sub>opt</sub>   any member of the source character set except single-quote (&#039;) or backslash (\)
 
 <i id="grammar-sq-escape-sequence">sq-escape-sequence:: one of</i>
-   \'   \\
+   \&#039;   \\
 
 <i id="grammar-b-prefix">b-prefix:: one of</i>
    b   B
@@ -271,7 +271,7 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md#
    \\   \$   \e   \f   \n   \r   \t   \v
 
 <i id="grammar-nowdoc-string-literal">nowdoc-string-literal::</i>
-   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   &lt;&lt;&lt;   '   <i><a href="#grammar-name">name</a></i>   '   <i><a href="#grammar-new-line">new-line</a></i>   <i><a href="#grammar-hd-body">hd-body</a></i><sub>opt</sub>   <i><a href="#grammar-name">name</a></i>   ;<sub>opt</sub>   <i><a href="#grammar-new-line">new-line</a></i>
+   <i><a href="#grammar-b-prefix">b-prefix</a></i><sub>opt</sub>   &lt;&lt;&lt;   &#039;   <i><a href="#grammar-name">name</a></i>   &#039;   <i><a href="#grammar-new-line">new-line</a></i>   <i><a href="#grammar-hd-body">hd-body</a></i><sub>opt</sub>   <i><a href="#grammar-name">name</a></i>   ;<sub>opt</sub>   <i><a href="#grammar-new-line">new-line</a></i>
 
 <i id="grammar-operator-or-punctuator">operator-or-punctuator:: one of</i>
    [   ]   (   )   {   }   .   -&gt;   ++   --   **   *   +   -   ~   !
@@ -1119,8 +1119,8 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md#
 
 <pre>
 <i id="grammar-namespace-definition">namespace-definition:</i>
-   namespace   <i><a href="#grammar-name">name</a></i>   ;
-   namespace   <i><a href="#grammar-name">name</a></i><sub>opt</sub>   <i><a href="#grammar-compound-statement">compound-statement</a></i>
+   namespace   <i><a href="#grammar-namespace-name">namespace-name</a></i>   ;
+   namespace   <i><a href="#grammar-namespace-name">namespace-name</a></i><sub>opt</sub>   <i><a href="#grammar-compound-statement">compound-statement</a></i>
 
 <i id="grammar-namespace-use-declaration">namespace-use-declaration:</i>
    use   <i><a href="#grammar-namespace-function-or-const">namespace-function-or-const</a></i><sub>opt</sub>   <i><a href="#grammar-namespace-use-clauses">namespace-use-clauses</a></i>   ;