Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b41dc61
Fix three typos involving backslash characters
Apr 28, 2016
1169aae
Add missing coalesce operator to grammar summary
Apr 28, 2016
c51025c
Fix lexical/syntactic grammar for namespace names
Apr 29, 2016
2ca8b0e
Add ellipses to lexical grammar
Apr 29, 2016
11ca48d
Small PHP difference clarifications
May 3, 2016
b4af0d1
Merge remote-tracking branch 'hhvm/master'
May 3, 2016
26053d7
Link to enum-declarations was wrong
May 4, 2016
f213234
Correct require-once-expression to require-once-directive
May 4, 2016
2516478
The ${} interpolation is invalid in strict Hack
May 4, 2016
438e332
Fixed missing hyphens in return-type
May 4, 2016
d1141f4
Fix broken cross references
May 4, 2016
3a85fb8
Merge remote-tracking branch 'hhvm/master'
May 6, 2016
e171132
Merge remote-tracking branch 'hhvm/master'
Jul 1, 2016
a7692f8
Namespaces contain declarations, not statements
Jul 1, 2016
1533990
Link to cast expressions is incorrect
Jul 1, 2016
473395b
Fix inconsistency between ch 22 and ch 10
Jul 5, 2016
18c4553
A better fix for anonymous function returns
Jul 7, 2016
13fc4fd
Fix grammar for enum bodies
Jul 12, 2016
a278908
Fix grammar for methods
Jul 14, 2016
3df0555
Fix omission in switch specification
Jul 14, 2016
47aacb2
Missing semis in require clause
Jul 18, 2016
2c09ddf
Add optional void annotations to constructors and destructors
Jul 20, 2016
ff13997
A parameter list may end in a comma
Jul 22, 2016
3ccd305
Fix parameter declaration in catch clause
Jul 25, 2016
7d0d3b3
Fix anonymous function / lambda parameter declaration grammar
Jul 25, 2016
802d550
Rename anonymous-function-body
Jul 26, 2016
b451a6e
Fix generic type argument lists
Jul 27, 2016
8cd7917
Argument lists may end in a comma
Jul 27, 2016
149978b
Optional trailing comma in generic type arg list
Aug 15, 2016
4b36c69
A type specifier list may end in a comma
Aug 15, 2016
cfe278b
Fix formatting of scope resolution qualifier
Aug 15, 2016
0b318b1
The scope resolution operator can have a variable name on the right
Aug 16, 2016
f52cd70
Add scope-qualified names to object creation expression grammar
Aug 17, 2016
730053d
More updates to object creation
Aug 18, 2016
0e1a675
Member selections can have a variable on the right
Aug 18, 2016
93db39c
Update namespace use declarations
Aug 29, 2016
c944669
A field specifier may be scope qualified
Aug 31, 2016
2b252ef
Shape definitions may have scope resolutions
Aug 31, 2016
8453655
A generic type parameter list may be comma-terminated
Sep 1, 2016
5ecf1a6
Fix up type aliases
Sep 1, 2016
54ada4d
An alias declaration may have an attribute
Sep 6, 2016
cab3047
Simplify inclusion directive grammar
Sep 7, 2016
538b28e
The use-clause variable list may have a trailing comma
Sep 8, 2016
2278ef9
Field initializers can have a trailing comma
Sep 8, 2016
337378d
The argument of a classname type can be generic
Sep 13, 2016
9a8257d
Merge remote-tracking branch 'hhvm/master'
Oct 19, 2016
c64eff2
Fix grammar for HEREDOC / NOWDOC string literals
Oct 19, 2016
d8039fd
Enum declarations can have an attribute specification
Oct 19, 2016
0c622e8
Describe heuristic for disambiguating casts
Oct 24, 2016
0efefcc
Remove byref assignment production
Oct 24, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions spec/09-lexical-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -719,14 +719,17 @@ echo "\$myC->p1 = >$myC->p1<\n"; // → $myC->p1 = >2<

<pre>
<i>heredoc-string-literal::</i>
&lt;&lt;&lt; <i>hd-start-identifier   new-line   hd-char-sequence<sub>opt</sub>  new-line hd-end-identifier</i> ;<i><sub>opt</sub>   new-line</i>
&lt;&lt;&lt; <i>hd-start-identifier   new-line   hd-body<sub>opt</sub>   hd-end-identifier</i> ;<i><sub>opt</sub>   new-line</i>

<i>hd-start-identifier::</i>
<i>name</i>

<i>hd-end-identifier::</i>
<i>name</i>

<i>hd-body::</i>
<i>hd-char-sequence</i><sub>opt</sub> new-line

<i>hd-char-sequence::</i>
<i>hd-char</i>
<i>hd-char-sequence   hd-char</i>
Expand Down Expand Up @@ -797,12 +800,12 @@ Some more text<

<pre>
<i>nowdoc-string-literal::</i>
&lt;&lt;&lt; ' <i>hd-start-identifier</i> ' <i>new-line  hd-char-sequence<sub>opt</sub>   new-line hd-end-identifier</i> ;<i><sub>opt</sub>   new-line</i>
&lt;&lt;&lt; ' <i>hd-start-identifier</i> ' <i>new-line  hd-body<sub>opt</sub>   hd-end-identifier</i> ;<i><sub>opt</sub>   new-line</i>
</pre>

**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)
Expand Down
43 changes: 35 additions & 8 deletions spec/10-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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*.


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1730,14 +1730,41 @@ error message displayed.
<i>cast-expression:</i>
(  <i>cast-type</i>  ) <i>unary-expression</i>

<i>cast-type: one of</i>
bool int float string
<i>cast-type:</i>
array
bool
double
float
int
object
string
<i>name</i>
</pre>

**Defined elsewhere**

* [*name*](09-lexical-structure.md#names)
* [*unary-expression*](10-expressions.md#general-4)

**Constraints**

The grammar for the <i>cast-expression</i> 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
Expand Down
9 changes: 7 additions & 2 deletions spec/13-enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ An *enumeration* consists of a set of zero or more named, constant values called
**Syntax**
<pre>
<i>enum-declaration:</i>
enum <i>name</i> <i>enum-base</i> <i>type-constraint<sub>opt</sub></i> { <i>enumerator-list<sub>opt</sub></i> }
<i>attribute-specification</i><sub>opt</sub> enum <i>name</i> <i>enum-base</i> <i>type-constraint<sub>opt</sub></i> { <i>enumerator-list<sub>opt</sub></i> }
<i>enum-base:</i>
: int
: string
Expand All @@ -22,7 +22,12 @@ An *enumeration* consists of a set of zero or more named, constant values called
<i>name</i>
</pre>

*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**

Expand Down
28 changes: 17 additions & 11 deletions spec/22-grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,17 @@ octal-digit
\X <i>hexadecimal-digit hexadecimal-digit<sub>opt</sub></i>

<i>heredoc-string-literal::</i>
&lt;&lt;&lt; <i>hd-start-identifier new-line hd-char-sequence<sub>opt</sub> new-line hd-end-identifier</i> ;<i><sub>opt</sub> new-line</i>
&lt;&lt;&lt; <i>hd-start-identifier new-line hd-body<sub>opt</sub> hd-end-identifier</i> ;<i><sub>opt</sub> new-line</i>

<i>hd-start-identifier::</i>
<i>name</i>

<i>hd-end-identifier::</i>
<i>name</i>

<i>hd-body::</i>
<i>hd-char-sequence</i><sub>opt</sub> new-line

<i>hd-char-sequence::</i>
<i>hd-char</i>
<i>hd-char-sequence hd-char</i>
Expand All @@ -278,9 +281,8 @@ octal-digit
<i>hd-simple-escape-sequence:: one of</i>
\\ \$ \e \f \n \r \t \v


<i>nowdoc-string-literal::</i>
&lt;&lt;&lt; ' <i>hd-start-identifier</i> ' <i>new-line hd-char-sequence<sub>opt</sub> new-line hd-end-identifier</i> ;<i><sub>opt</sub> new-line</i>
&lt;&lt;&lt; ' <i>hd-start-identifier</i> ' <i>new-line hd-body<sub>opt</sub> hd-end-identifier</i> ;<i><sub>opt</sub> new-line</i>
</pre>

####The Null Literal
Expand Down Expand Up @@ -576,7 +578,7 @@ octal-digit
<i>anonymous-function-parameter-declaration-list</i>
<i>anonymous-function-parameter-declaration-list</i> ,
<i>anonymous-function-parameter-declaration-list</i> , ...

<i>anonymous-function-parameter-declaration-list:</i>
<i>anonymous-function-parameter-declaration</i>
<i>anonymous-function-parameter-declaration-list</i> , <i>anonymous-function-parameter-declaration</i>
Expand Down Expand Up @@ -732,8 +734,15 @@ octal-digit
<i>cast-expression:</i>
( <i>cast-type</i> ) <i>unary-expression</i>

<i>cast-type: one of</i>
bool int float string
<i>cast-type:</i>
array
bool
double
float
int
object
string
<i>name</i>

<i>await-expression:</i>
await <i>expression</i>
Expand Down Expand Up @@ -877,9 +886,6 @@ octal-digit
<i>simple-assignment-expression:</i>
<i>unary-expression</i> = <i>assignment-expression</i>

<i>byref-assignment-expression:</i>
<i>unary-expression</i> = & <i>assignment-expression</i>

<i>compound-assignment-expression:</i>
<i>unary-expression compound-assignment-operator assignment-expression</i>

Expand Down Expand Up @@ -1086,7 +1092,7 @@ octal-digit

<pre>
<i>enum-declaration:</i>
enum <i>name</i> <i>enum-base</i> <i>type-constraint<sub>opt</sub></i> { <i>enumerator-list<sub>opt</sub></i> }
<i>attribute-specification</i><sub>opt</sub> enum <i>name</i> <i>enum-base</i> <i>type-constraint<sub>opt</sub></i> { <i>enumerator-list<sub>opt</sub></i> }

<i>enum-base:</i>
: int
Expand Down Expand Up @@ -1274,7 +1280,7 @@ octal-digit
<i>attribute-specification<sub>opt</sub></i> <i>visibility-modifier</i> function __destruct ( ) <i>void-return<sub>opt</sub></i> <i>compound-statement</i>

<i>void-return</i>:
: void
: void

<i>type-constant-declaration:</i>
<i>abstract-type-constant-declaration</i>
Expand Down