The goal of this diff is to clean up the current work-in-progress and check
it in so that others may contribute if they have time.
The program currently outputs the HHVM tree as well as the xhpast-like
json, for ease of debugging. There is a little helper program jsonpretty.py
to make the trees more readable, e.g.
_build/dbg/hphp/util/parser/xhpast/xhpast2 <some php file> | hphp/util/parser/xhpast/xhpast2/jsonpretty.py
XML comment syntax for XHP is one of the top wishlist items within the UIE group (+ some other people).
Currently, the only way to have comments inside XHP blocks is to use expressions and block comments, e.g.
<div>{/* comment */}</div>
After this change, you can use the more familiar syntax. This syntax is limited to XHP child contexts:
// Only single-line, doc, block comments work outside XHP
$xhp =
<div>
<!--XML comments only work within XHP children contexts-->
</div>;
Based on http://www.w3.org/TR/REC-xml/#sec-comments - except we ignore the rule about double hyphens ('--') within a comment because we don't care about SGML.
For generic constraints, the grammar (incorrectly) did not allow for
generic types on the right hand side of the "as" keyword. This diff fixes
the grammar appropriately.
A shebang allow a script to be run as an executable on UNIX
systems. PHP allows shebangs, but Hack does not. This
changeset allows Hack to have shebangs like in PHP.
A shebang allow a script to be run as an executable on UNIX
systems. PHP allows shebangs, but Hack does not. This
changeset allows Hack to have shebangs like in PHP.
My recent change to now/heredoc processing resulted in variables in heredocs mistakenly being tacked onto the end of the previous line in the output. This tends not to be a problem when emitting things that get parsed by something else, like emitting PHP. But it's noticable when emitting raw text.
Adds runtime support for non-class typehints. Typedefs are
introduced using type statements, and autoloaded via a new autoload
map entry. Shapes are parsed but the structure is currently thrown
away and treated as arrays at runtime. This extends the NamedEntity
structure to sometimes cache 'NameDefs', which are either Typedef*'s
or Class*'s. VerifyParamType now has to check for typedefs if an
object fails a class check, or when checking non-Object types against
a non-primitive type name that isn't a class.
Fixed a few issues in the lexer for heredocs and nowdocs. The source file is read in 64k chunks, and any time a doc was split across a buffer boundary the lexer would fail to consume the doc properly. Modified the lexer to refill the file buffer when it is used, or when more data is needed in a variety of cases. Also fixed a number of other corner cases where we'd fail to recognize the doc end label or other special characters. The old code was also a bit over- and under-flowy.
For "$obj->{__FUNCTION__}" and "$obj->{__CLASS__}", we currently don't
recognize __FUNCTION__ and __CLASS__ as "magic constants" and we just use
the literal strings "__FUNCTION__" and "__CLASS__" for the property names.
This is wrong. Same goes for object method calls (ex. "$obj->{..}(..)").
This diff fixes HipHop to recognize magic constants for properties names in
"$obj->{..}" expressions and method names in "$obj->{..}(..)" expressions.
Per @mwilliams' suggestion, this is the first stage in a staggered approach to replacing int64 with int64_t. More precisely I inserted "typedef ::int64_t int64;" in util/base.h and dealt with the consequences.
This change is mostly for FB internal organizational reasons.
Building is not effected beyond the fact that the target now
lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.