Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Oct 18, 2009
  1. @laverdet

    Finish hooking up ini options

    laverdet authored
    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
Commits on Oct 14, 2009
  1. @laverdet

    Configuation for parser options

    laverdet authored
    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. @laverdet

    Reduce false positives in preparser

    laverdet authored
    Summary:
    Reduce cost of parsing by parsing fewer files
    
    Reviewed By: dweatherford
    
    Test Plan: lib/init/script.php
    
    Revert: OK
Commits on Oct 13, 2009
  1. @laverdet

    Fix xhp_preprocess_code in centos

    laverdet authored
    zend_parse_parameters gives you an int, not a size_t. f u Zend.
    
    Reviewed By: bill
    
    Test Plan: build
Commits on Oct 7, 2009
  1. @laverdet

    Surface ability to parse XHP in PHP extension

    laverdet authored
    Summary:
    This creates a function xhp_preprocess_code() which will parse code with or without XHP extensions and return some kind of result.
    
    The function should always return an array unless you pass it invalid arguments. The only parameter this function takes is a string of code. There are three possible cases:
    
    - The code contained XHP and was rewritten to straight PHP; a key "new_code" is set with the new code.
    - The code contains no XHP; the array is totally empty.
    - The code contains a syntax error; keys "error" and "error_line" are with with the error encountered and on what line
    
    Reviewed By: mcslee
    
    Test Plan:
    Tested the 3 cases in a short PHP script.
    
    Revert: OK
    
    DiffCamp Revision: 67802
Commits on Oct 2, 2009
  1. @laverdet

    Allow index chaining

    laverdet authored
    Summary:
    This fixes the "bug" in PHP's grammar where you aren't allowed to use the [...] operator on the return value of a function. It rewrites all instances which would be syntax errors into ##__xhp_idx($arr, $index)##. __xhp_idx is implemented in ext.cpp in C and is probably faster than the idx we made in PHP.
    
    It behaves exactly as the [...] operator would.
    
    If you want to ignore undefined index warnings you can do ##@foo()['etc']## and the @ will only apply to the __xhp_idx call.
    
    One thing to watch out for is that each chained [...] on the end of a function is a function call. So if you're doing something like ##foo()['bar']['etc']['muk']## you get 3 calls to __xhp_idx.
    
    TODO: Add ini entry to disable this feature (only need to set a flag).
    
    Reviewed By: dweatherford
    
    Test Plan:
    marcel@dev050 ~/xhp $ cat honk.php
      <?php
      error_reporting(E_ALL);
      function foo() {
        return array(
          'bar' => 'etc',
        );
      }
    
      echo foo()['bar'] . "\n";
      echo foo()['etc'];
      echo @foo()['etc'];
      marcel@dev050 ~/xhp $ php honk.php
      etc
      PHP Notice:  Undefined index: etc in /home/marcel/xhp/honk.php on line 10
    
    I also ran the whole codebase through xhpize to make sure no lines were getting rewritten that didn't need it.
    
    Revert: OK
    
    DiffCamp Revision: 66576
Commits on Sep 19, 2009
  1. @laverdet

    Complete rewrite; version 1.1.0

    laverdet authored
    Summary: I deleted most of XHP and started over. Points of interest:
             - Compatibility with at least PHP 5.3, likely up to PHP 6.0.
             - Uses PHP's parser instead the one I wrote
             - Rewritten scanner. The scanner now returns code_rope's with the
             actual code that was scanned, along with line numbers.
             - Separate the XHP parser and extension code
             - Further improved build process
             - No new features
    
    Reviewed By: epriestley
    
    Other Commenters: iproctor
    
    Test Plan: marcel@dev050 ~/alpaca $ php ./lib/init/script.php 
               marcel@dev050 ~/alpaca
               
               More testing will be done before committing this to APE.
    
    Revert: OK
    
    DiffCamp Revision: 64717
Commits on Jul 18, 2009
  1. @laverdet

    Fixes and stuff

    laverdet authored
    Summary: Fixes some bugs in the grammar.
             
             Move ext.cpp over to the shared function in xhp_preprocess.cpp.
             
             Most of this code is probably pretty bad... So let me know if you
             hate me or not.
    
    Reviewed By: epriestley
    
    Test Plan: valgrind doesn't show any terrible leaks
    
    Revert: OK
    
    DiffCamp Revision: 55388
Commits on Jun 26, 2009
  1. @laverdet

    More parser gliches

    laverdet authored
    Summary:
    Interesting programs and their outputs:
    
    <?php
    //?????>hello
    ---
    hello
    
    <?php
    $foo->if();
    ---
    <works>
    
    <?php
    $foo-> if()
    ---
    <syntax error>
    
    Anyway, PHP's parser is a huge mess.
    
    Reviewed By: no one
    
    Test Plan: Disabled "maybe_xhp" check, then `find . | grep php$ | xargs -n1 php -l`. No errors!
    
    Revert Plan: ok
Commits on Jun 25, 2009
  1. @laverdet

    Fix glitches and stuff

    laverdet authored
    Summary:
    - abstract elements are now allowed
    - fix `element` keyword if no markup appears in the file
    - allow <a\nhref="..." />; where \n is an actualy linebreak
    - fix certain heredocs
    
    Reviewed By: no one
    
    Test Plan: master_include.php \ test cases from evan
    
    Revert Plan: ok
Commits on Jun 24, 2009
  1. @laverdet

    Balance tags

    laverdet authored
    Summary:
    Syntax error when tags don't match.
    
    Also this fixes array typehints
    
    Reviewed By: no one
    
    Test Plan: master_include.php
    
    Revert Plan: ok
  2. @laverdet

    Bug fixes and rewrites

    laverdet authored
    Summary:
    Progress on cleaning up the parser rules to bring XHP more in sync with Zend. This also fixes some bugs in the XHP grammar Evan pointed out.
    
    Reviewed By: no one
    
    Test Plan: ran master_include.php
    
    Revert Plan: ok
Commits on Jun 22, 2009
  1. @laverdet

    Quick checkin

    laverdet authored
    Summary: I just want a checkin of this somewhere that's not my dev server.
    
    Test Plan: None
Something went wrong with that request. Please try again.