diff --git a/spec/09-lexical-structure.md b/spec/09-lexical-structure.md index 2612e8c..47900dc 100644 --- a/spec/09-lexical-structure.md +++ b/spec/09-lexical-structure.md @@ -719,7 +719,7 @@ echo "\$myC->p1 = >$myC->p1<\n"; // → $myC->p1 = >2<
heredoc-string-literal::
- <<< hd-start-identifier new-line hd-char-sequenceopt new-line hd-end-identifier ;opt new-line
+ <<< hd-start-identifier new-line hd-bodyopt hd-end-identifier ;opt new-line
hd-start-identifier::
name
@@ -727,6 +727,9 @@ echo "\$myC->p1 = >$myC->p1<\n"; // → $myC->p1 = >2<
hd-end-identifier::
name
+ hd-body::
+ hd-char-sequenceopt new-line
+
hd-char-sequence::
hd-char
hd-char-sequence hd-char
@@ -797,12 +800,12 @@ Some more text<
nowdoc-string-literal::
- <<< ' hd-start-identifier ' new-line hd-char-sequenceopt new-line hd-end-identifier ;opt new-line
+ <<< ' hd-start-identifier ' new-line hd-bodyopt hd-end-identifier ;opt new-line
**Defined elsewhere**
-* [*hd-char-sequence*](09-lexical-structure.md#heredoc-string-literals)
+* [*hd-body*](09-lexical-structure.md#heredoc-string-literals)
* [*hd-end-identifier*](09-lexical-structure.md#heredoc-string-literals)
* [*hd-start-identifier*](09-lexical-structure.md#heredoc-string-literals)
* [*new-line*](09-lexical-structure.md#comments)
diff --git a/spec/10-expressions.md b/spec/10-expressions.md
index 1b88207..18c969e 100644
--- a/spec/10-expressions.md
+++ b/spec/10-expressions.md
@@ -848,7 +848,7 @@ The *class-type-designator* must not designate an [abstract class](16-classes.md
The *class-type-designator* must not be a [generic type parameter](14-generic-types-methods-and-functions.md#type-parameters).
-The *object-creation-expression* will invoke the constructor of the class designated by the *class-type-designator*.
+The *object-creation-expression* will invoke the constructor of the class designated by the *class-type-designator*.
*argument-expression-list* must contain an argument for each parameter in the
[constructor's definition](15-functions.md#function-definitions) not having a default value, and each
@@ -1300,7 +1300,7 @@ $anon(); // call the anonymous function
method of the class designated by *postfix-expression*.
*variable-name* must name a variable which when evaluated produces a string
-containing an instance property or an instance method of the class
+containing an instance property or an instance method of the class
designated by *postfix-expression*.
@@ -1352,14 +1352,14 @@ $p1->move(3, 9); // calls public instance method move by name
*name* must designate an instance property or an instance method of the class designated by *postfix-expression*.
*variable-name* must name a variable which when evaluated produces a string
-containing an instance property or an instance method of the class
+containing an instance property or an instance method of the class
designated by *postfix-expression*.
**Semantics**
-If *postfix-expression* is `null`, no property or method is selected and the
-resulting value is `null`. Otherwise, the behavior is like that of the
-[member-selection operator `->`](10-expressions.md#member-selection-operator),
+If *postfix-expression* is `null`, no property or method is selected and the
+resulting value is `null`. Otherwise, the behavior is like that of the
+[member-selection operator `->`](10-expressions.md#member-selection-operator),
except that the resulting value is not an lvalue.
###Postfix Increment and Decrement Operators
@@ -1730,14 +1730,41 @@ error message displayed.
cast-expression:
( cast-type ) unary-expression
- cast-type: one of
- bool int float string
+ cast-type:
+ array
+ bool
+ double
+ float
+ int
+ object
+ string
+ name
**Defined elsewhere**
+* [*name*](09-lexical-structure.md#names)
* [*unary-expression*](10-expressions.md#general-4)
+**Constraints**
+
+The grammar for the cast-expression introduces certain syntactic
+ambiguities. For example, the expression `(x)-y` could be interpreted as a
+cast of `-y` to type `x`, or as the arithmetical computation of `x-y`.
+
+This ambiguity is resolved as follows:
+
+* If the token inside the parentheses is `array`, `bool`, `double`,
+`float`, `int`, `object` or `string` then the expression is a
+*cast-expression*.
+* Otherwise, if the token following the right parenthesis is `as` or
+`instanceof` then `(` *name* `)` is a parenthesized expression, not a cast operator.
+* Otherwise, if the token following the right parenthesis is is
+`$$`, `@`, `~`, `!`, `(`, `+`, `-`, `++`, `--`, or any *name*, *qualified-name*,
+or *variable-name*, or any numeric, string, Boolean or null literal, or any keyword
+then the expression is a *cast-expression*.
+* Otherwise, `(` *name* `)` is a parenthesized expression, not a cast operator.
+
**Semantics**
The
diff --git a/spec/13-enums.md b/spec/13-enums.md
index 8cc1bb1..583c887 100644
--- a/spec/13-enums.md
+++ b/spec/13-enums.md
@@ -9,7 +9,7 @@ An *enumeration* consists of a set of zero or more named, constant values called
**Syntax**
enum-declaration:
- enum name enum-base type-constraintopt { enumerator-listopt }
+ attribute-specificationopt enum name enum-base type-constraintopt { enumerator-listopt }
enum-base:
: int
: string
@@ -22,7 +22,12 @@ An *enumeration* consists of a set of zero or more named, constant values called
name
-*name* is defined in [§§](09-lexical-structure.md#names); *type-constraint* is defined in [§§](05-types.md#general); and *constant-expression* is defined in [§§](10-expressions.md#constant-expressions).
+**Defined elsewhere**
+
+* [*attribute-specification*](21-attributes.md#attribute-specification)
+* [*constant-expression*](10-expressions.md#constant-expressions)
+* [*name*](09-lexical-structure.md#names)
+* [*type-constraint*](05-types.md#general)
**Constraints**
diff --git a/spec/22-grammar.md b/spec/22-grammar.md
index a53598e..9a0aa0b 100644
--- a/spec/22-grammar.md
+++ b/spec/22-grammar.md
@@ -252,7 +252,7 @@ octal-digit
\X hexadecimal-digit hexadecimal-digitopt
heredoc-string-literal::
- <<< hd-start-identifier new-line hd-char-sequenceopt new-line hd-end-identifier ;opt new-line
+ <<< hd-start-identifier new-line hd-bodyopt hd-end-identifier ;opt new-line
hd-start-identifier::
name
@@ -260,6 +260,9 @@ octal-digit
hd-end-identifier::
name
+ hd-body::
+ hd-char-sequenceopt new-line
+
hd-char-sequence::
hd-char
hd-char-sequence hd-char
@@ -278,9 +281,8 @@ octal-digit
hd-simple-escape-sequence:: one of
\\ \$ \e \f \n \r \t \v
-
nowdoc-string-literal::
- <<< ' hd-start-identifier ' new-line hd-char-sequenceopt new-line hd-end-identifier ;opt new-line
+ <<< ' hd-start-identifier ' new-line hd-bodyopt hd-end-identifier ;opt new-line
####The Null Literal
@@ -576,7 +578,7 @@ octal-digit
anonymous-function-parameter-declaration-list
anonymous-function-parameter-declaration-list ,
anonymous-function-parameter-declaration-list , ...
-
+
anonymous-function-parameter-declaration-list:
anonymous-function-parameter-declaration
anonymous-function-parameter-declaration-list , anonymous-function-parameter-declaration
@@ -732,8 +734,15 @@ octal-digit
cast-expression:
( cast-type ) unary-expression
- cast-type: one of
- bool int float string
+ cast-type:
+ array
+ bool
+ double
+ float
+ int
+ object
+ string
+ name
await-expression:
await expression
@@ -877,9 +886,6 @@ octal-digit
simple-assignment-expression:
unary-expression = assignment-expression
- byref-assignment-expression:
- unary-expression = & assignment-expression
-
compound-assignment-expression:
unary-expression compound-assignment-operator assignment-expression
@@ -1086,7 +1092,7 @@ octal-digit
enum-declaration:
- enum name enum-base type-constraintopt { enumerator-listopt }
+ attribute-specificationopt enum name enum-base type-constraintopt { enumerator-listopt }
enum-base:
: int
@@ -1274,7 +1280,7 @@ octal-digit
attribute-specificationopt visibility-modifier function __destruct ( ) void-returnopt compound-statement
void-return:
- : void
+ : void
type-constant-declaration:
abstract-type-constant-declaration