Permalink
Commits on Mar 9, 2010
  1. Adding float attribute type to XHP.

    Nora Mullaney
    Nora Mullaney committed Mar 8, 2010
    Summary:
    Add a new type for attributes in XHP for float (AKA double).
    
    Reviewed By: marcel
    
    Test Plan:
    Added a new test for float attributes.
  2. Bump to 1.3.8

    laverdet committed Mar 9, 2010
  3. Fix parser glitch

    laverdet committed Mar 9, 2010
    Summary:
    http://github.com/facebook/xhp/issues/issue/10
    
    XHP's flagrant misuse of scanner states is catching up now with this ridiculous parser bug. I'm taking the easy way out by forbidding clients to use reserved words in XHP class constants which is probably less bad than the existing bug.
    
    Reviewed By: dweatherford
    
    Test Plan:
    Ran tests. Added new test for the broken case, and another random case I wanted to add for the hell of it.
  4. Fix broken test

    laverdet committed Mar 9, 2010
    Summary:
    The behavior of this actually changed in PHP 5.3 so I guess the unit test needs to work with both 5.2 and 5.3.
    
    Reviewed By: dweatherford
    
    Test Plan:
    Ran test on 5.2 and 5.3 (actually just 5.2).
  5. Fix XHP build on gcc 4.1

    laverdet committed Mar 9, 2010
    Summary:
    There is an undefined function that I don't even know how it gets defined, but it does in gcc > 4.1. Collocating this function in ext.cpp so older versions of gcc can build XHP.
    
    Reviewed By: dweatherford
    
    Test Plan:
    Build using gcc 4.1.2 and php 5.3.2
  6. Add support for PHP 5.3 namespaces

    laverdet committed Mar 9, 2010
    Summary:
    http://github.com/facebook/xhp/issues/issue/6
    
    Currently if you use `namespace` anywhere in your client code you can no longer use XHP. This is because of the new semantics introduced to PHP 5.3. Unfortunately XHP has its own namespace structure which conflicts with PHP's. So if we detect PHP 5.3 we will embrace namespaces by sticking all our classes in the global namespace.
    
    Reviewed By: dweatherford
    
    Test Plan:
    Build and run tests. No new tests since we don't run PHP 5.3.
Commits on Feb 21, 2010
Commits on Feb 17, 2010
  1. fix for ZTS in dist_compile_string call

    metagoto authored and laverdet committed Feb 10, 2010
Commits on Feb 8, 2010
  1. Fix include orders

    laverdet committed Feb 8, 2010
    Summary:
    There was some misuse here between string.h and string. I went ahead and cleared
    that up to make the build work on more correct platforms.
  2. Documentation update

    laverdet committed Feb 8, 2010
    Summary:
    In the releases we will include generated code so that bison, flex, and re2c are
    only required for developers. Updating documentation to reflect this.
  3. Update license to 2010

    laverdet committed Feb 8, 2010
Commits on Jan 7, 2010
  1. Adding .gitignore

    laverdet committed Jan 7, 2010
    Summary:
    This is my local exclude file. It hides all the garbage that phpize puts into your directory in addition to bison, flex, and re2c generated files.
  2. Update PHP libraries

    laverdet committed Jan 7, 2010
    Summary:
    These have been seeing a lot of iteration in tfb, so I want to update them in
    XHP (seeing as how the current versions won't even work).
Commits on Dec 19, 2009
  1. Fix multiple attribute stealing

    laverdet committed Dec 19, 2009
    Summary:
    There's a bug right now where if you steal attributes you have to do them all on the same line or there's a parse error. This isn't a parse error in XHP, but a problem with the generated code. Stripping line number information from the identifier fixes this, which is the desired behavior anyway because __xhpAttributeDeclaration should be one 1 line.
    
    Reviewed By: kdelong
    
    Test Plan:
    attributes.phpt
    
    Revert: OK
    
    DiffCamp Revision: 80761
  2. Fix bugs with markup attributes

    laverdet committed Dec 19, 2009
    Summary:
    - Blank attributes <div style="" /> are valid
    - Entities may be used in attributes
    - &#...; attributes always work now
    - Invalid entity errors are sane
    
    Reviewed By: kdelong
    
    Test Plan:
    attr-blank.phpt now passes
    
    Revert: OK
    
    DiffCamp Revision: 80760
Commits on Dec 18, 2009
  1. Tons of entities

    laverdet committed Dec 18, 2009
    Summary:
    This adds all XML and HTML entities to XHP. Now you can do <div>&Agrave;</div> if you want, I guess.
    
    I removed all the chess piece entities because those were crazy, but I kept the clouds and snowmans.
    
    Reviewed By: kdelong
    
    Test Plan:
    Confirmed that compile time of scanner.lex.cpp is like 4 times longer than it used to be.
    
    Revert: OK
    
    DiffCamp Revision: 80759
  2. Add a bunch of tests

    laverdet committed Dec 18, 2009
    Summary:
    These tests are mostly worthless but it might motivate me to make more in the future.
    
    Reviewed By: kdelong
    
    Test Plan:
    HA!
    
    Revert: OK
    
    DiffCamp Revision: 80705
Commits on Nov 30, 2009
  1. Fix build error on newer gcc

    laverdet committed Nov 30, 2009
    Summary:
    Our ancient copy of gcc lets this through but older versions do not.
    
    Reviewed By: epriestley
    
    Test Plan: build
Commits on Nov 29, 2009
  1. Allow ArrayAccess in __xhp_idx

    laverdet committed Nov 29, 2009
    Summary:
    __xhp_idx doesn't work with FBObject right now because it's not aware of ArrayAccess. This diff adds some more functionality to that so hopefully now it'll work just like ##function idx($a, $b) { return $a[$b]; }##.
    
    I'm not aware of any function available to PHP extensions that does this for you, and my research has led me nowhere either. Seems like every extension just has to implement their own terrible versions of zval-mangling utility functions.
    
    Reviewed By: epriestley
    
    Other Commenters: mcslee
    
    Test Plan:
    Ran this guy and verified __xhp_idx and idx behave the same.
    
      <?php
      class foo implements ArrayAccess {
        public function offsetExists($offset) { return true; }
        public function offsetGet($offset) { return $offset; }
        public function offsetSet($offset, $data) {}
        public function offsetUnset($offset) {}
      }
    
      $array = array();
      $array[0] = 'zero';
      $array['key'] = 'value';
      $string = 'foobar';
      $object = new foo;
    
      function idx($a, $b) {
        return $a[$b];
      }
    
      foreach (array('idx', '__xhp_idx') as $fn) {
        var_dump($fn($array, 0));
        var_dump($fn($array, '0'));
        var_dump($fn($array, NULL));
        var_dump($fn($array, true));
        var_dump($fn($array, false));
        var_dump($fn($array, 'key'));
        var_dump($fn($array, 'other_key'));
        echo "---\n";
    
        var_dump($fn($string, 0));
        var_dump($fn($string, '0'));
        var_dump($fn($string, NULL));
        var_dump($fn($string, true));
        var_dump($fn($string, false));
        var_dump($fn($string, 'honk'));
        echo "---\n";
    
        var_dump($fn($object, 0));
        var_dump($fn($object, NULL));
        var_dump($fn($object, true));
        var_dump($fn($object, false));
        var_dump($fn($object, 'key'));
        echo "------------------------\n";
    }
    
    Revert: OK
    
    DiffCamp Revision: 76249
Commits on Nov 24, 2009
  1. Fix static variable access from XHP classes

    laverdet committed Nov 24, 2009
    Summary:
    Currently you can't access static variables in an XHP class. "echo :$foo" is
    a syntax error.
    
    Reviewed By: epriestley
    
    Test Plan:
      marcel@dev050 ~/xhp $ cat test.php
      <?php
      class :fb:thing {
        public static $TEST = 1;
      }
    
      echo :fb:thing::$TEST."\n";
      (:fb:thing::$TEST = 2);
      echo :fb:thing::$TEST."\n";
    
      marcel@dev050 ~/xhp $ php test.php
      1
      2
    
    Revert: OK
Commits on Oct 28, 2009
  1. Fix bug with duped __xhpAttributeDeclaration

    laverdet committed Oct 28, 2009
    Summary:
    Currently XHP will define __xhpAttributeDeclaration on any class that uses the
    leading-colon scheme. This is annoying because we can't define a base
    implementation or __xhpAttributeDeclaration. So now it only defines
    __xhpAttributeDeclaration if you define attributes.
    
    Reviewed By: epriestley
    
    Test Plan: xhpize
    
    Revert: OK
Commits on Oct 27, 2009
  1. Include debug info in element construction

    laverdet committed Oct 27, 2009
    Summary:
    Right now XHP errors are difficult to debug because many errors aren't surfaced until toString() is called which is probably very far away from where the element was actually constructed. We've solved this in trunk by calling debug_backtrace() in every construction but that's pretty ridiculous.
    
    So I'm adding information to each construction which will pass to the element about where it came from.
    
    Reviewed By: epriestley
    
    Test Plan:
    xhpized a few files
    
    Revert: OK
    
    DiffCamp Revision: 71252
Commits on Oct 26, 2009
  1. Add support for empty closing tags

    laverdet committed Oct 26, 2009
    Summary:
    <foo>bar</> is now valid syntax. "</>" will just close whatever tag happens to
    be open at the time. This mimics the behavior of a subset of SGML's SHORTTAG
    directive.
    
    Reviewed By: dcorson
    
    Test Plan: xhpize + various clients of XHP
    
    Revert: OK
  2. Remove support for "element" keyword

    laverdet committed Oct 26, 2009
    Summary:
    Don't need it anymore, it has been replaced with the leading-colon syntax.
    
    Reviewed By: epriestley
    
    Test Plan: xhpize
    
    Revert: OK
  3. Fix attribute keyword in class body

    laverdet committed Oct 26, 2009
    Summary:
    The `attribute` keyword would not work if it didn't appear before any functions
    in the class. You would can a syntax error like unexpected T_STRING. You can now
    put your attributes anywhere in the class, just like you can variables, though
    you probably shouldn't.
    
    Reviewed By: epriestley
    
    Test Plan: xhpize
    
    Revert: OK
Commits on Oct 20, 2009
  1. Fix missing rewrites

    laverdet committed Oct 20, 2009
    Summary:
    There's a potential issue where if the only XHP in a file is at the very end it
    won't get rewritten.
    
    The issue was that T_RETURN expects a expr_without_variable which is a subset of
    expr. Changes to fastpath.re fixes a potential issue where if XHP appears at the
    VERY end of a file it won't get picked up.
    
    Reviewed By: dcorson
    
    Test Plan:
    The usual inadequate testing of very sensitive code changes. `make test` would be useful.
    
    Revert: OK
    
    DiffCamp Revision: 69833
Commits on Oct 18, 2009
  1. Default idx_expr to true in xhp_preprocess

    laverdet committed Oct 18, 2009
    Summary:
    Clients using the old non-flags version of xhp_preprocess should get the
    idx_expr rule by default. This does not include the PHP extension, there's
    an ini option for that.
    
    Reviewed By: dweatherford
    
    Test Plan: xhpize
    
    Revert: OK
  2. Finish hooking up ini options

    laverdet committed Oct 18, 2009
    Summary:
    My first commit where I setup the ini stuff didn't actually work, but now it
    does.
    
    Test Plan:
    Set xhp.idx_expr to 1 and tested it
    
    Reviewed By: epriestley
    
    Revert: OK
  3. Make startup a lot faster

    laverdet committed Oct 18, 2009
    Summary:
    This greatly decreases startup time for the codebase by making the non-XHP fastpath a lot more sophisticated.
    
    One of the biggest fastpath false positive was markup in strings. The new fastpath correctly scans past strings which means we don't have to double parse nearly as many files.
    
    I implemented the fastpath in re2c which is the lightest weight scanner I could find. Basically the only thing it does is convert lists of regular expressions to huge state machines. Everything else you might expect from a scanner has to be implemented from scratch, which is just what I want.
    
    I implemented just enough of PHP's grammar to know when we're looking at actual code. Then I use the same XHP clues as I had in the old scanner.
    
    Reviewed By: dcorson
    
    Test Plan:
    Browsed around the lite site, etc.
    
    Revert: OK
    
    DiffCamp Revision: 69583
Commits on Oct 15, 2009
  1. Fix bad fail fast

    laverdet committed Oct 15, 2009
    Summary:
    Prescanner has a bug, syntax errors ahoy.
Commits on Oct 14, 2009
  1. Configuation for parser options

    laverdet committed Oct 14, 2009
    Summary:
    Hook up short_tags and asp_tags flags to match PHP settings. Also add
    xhp.idx_expr ini setting to enable or disable [] operator on expressions.
    
    Reviewed By: epriestley
    
    Test Plan: trunk
    
    Revert: OK
  2. Reduce false positives in preparser

    laverdet committed Oct 14, 2009
    Summary:
    Reduce cost of parsing by parsing fewer files
    
    Reviewed By: dweatherford
    
    Test Plan: lib/init/script.php
    
    Revert: OK