Gráfico de Commits

21 Commits

Autor SHA1 Mensagem Data
Sanjeev Singh 75397a10c7 Initial rough draft of xhpast2, a replacement for xhpast
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
2013-07-15 15:46:32 -07:00
Kyle Delong 9108d3523d XHP comment syntax
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.
2013-07-06 11:12:26 -07:00
Alok Menghrajani 7a9769a95b Fix HPHP's parser when handling generics
We need to allow any type after the AS keyword, including xhp class names.
2013-07-02 11:46:25 -07:00
Jordan DeLong 62dd2e2aae Allow type constraints on opaque type aliases
Allows some syntax that is ignored at runtime; only used
ahead of time by the type checker.
2013-06-27 10:50:12 -07:00
Drew Paroski a41fb387a7 Fix parsing for generic constraints with the "as" keyword
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.
2013-06-03 23:54:38 -07:00
Tim Starling 998951619f update copyright date
We did not intend to imply our copyrights last forever

Closes #759
2013-06-03 12:43:56 -07:00
Matt Glazar d6d9955136 Allow shebang/hashbang (#!) as first line in Hack files
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.
2013-05-20 13:52:27 -07:00
mwilliams 27601d53fd Revert "Allow shebang/hashbang (#!) as first line of Hack files"
This reverts commit d1f3c9e03d4eed7a3262bcdb461b77bbd661e5d6.

Its breaking tests
2013-05-15 13:05:09 -07:00
Matt Glazar eb6eb3f495 Allow shebang/hashbang (#!) as first line of Hack files
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.
2013-05-15 13:05:08 -07:00
Drew Paroski a8d84e2f21 Refactor HipHopSyntax and HackMode to play nice 2013-05-15 13:05:04 -07:00
Alok Menghrajani db9577b140 Rename strict with Hack
Strict mode was the old name. Let's avoid any confusion in the future and rename things.
2013-05-15 13:05:03 -07:00
Sara Golemon 38f9fab773 Fix __HALT_COMPILER() support
Actually halt the compiler, and set __COMPILER_HALT_OFFSET__ constant
2013-05-01 20:59:44 -07:00
Owen Yamauchi 05b6e5be7d Rename lexer source and add generator rule 2013-04-25 00:50:00 -07:00
mikemag b677c776df Fix bug in heredoc processing
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.
2013-04-17 08:54:58 -07:00
jdelong 6faa7cbea1 @override-unit-failures Initial support for <?hh typedefs and shapes
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.
2013-04-09 13:01:46 -07:00
mikemag e8c06b0312 Fix heredoc/nowdoc bugs with large docs, docs crossing buffer boundaries
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.
2013-04-02 15:00:45 -07:00
ptarjan 27d247e976 Make hphp.y closer to zend
I'm going through the zend parser file and they are quite similar to ours:

https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y

It seems having our parser file being closer to theirs would help us keep parity. I also prefer less copy and pasting when possible.
2013-03-05 22:07:49 -08:00
aalexandre b3b41e08bb Replaced NULL with nullptr 2013-02-19 06:57:54 -08:00
andrewparoski f7dd399bd6 Fix handling of "$obj->{__FUNCTION__}" and "$obj->{__CLASS__}"
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.
2013-02-11 06:07:22 -08:00
aalexandre d09fd3e421 inttypes conversion broken down by steps.
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.
2013-02-11 06:07:07 -08:00
Jordan Delong 363d1bb20f Code move src/ -> hphp/
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.
2013-02-11 02:10:41 -08:00