Skip to content
This repository

Oct 18, 2009

  1. Marcel Laverdet

    Finish hooking up ini options

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

Oct 14, 2009

  1. Marcel Laverdet

    Configuation for parser options

    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
    laverdet authored
  2. Marcel Laverdet

    Reduce false positives in preparser

    Summary:
    Reduce cost of parsing by parsing fewer files
    
    Reviewed By: dweatherford
    
    Test Plan: lib/init/script.php
    
    Revert: OK
    laverdet authored

Oct 13, 2009

  1. Marcel Laverdet

    Fix xhp_preprocess_code in centos

    zend_parse_parameters gives you an int, not a size_t. f u Zend.
    
    Reviewed By: bill
    
    Test Plan: build
    laverdet authored

Oct 07, 2009

  1. Marcel Laverdet

    Surface ability to parse XHP in PHP extension

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

Oct 02, 2009

  1. Marcel Laverdet

    Allow index chaining

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

Sep 19, 2009

  1. Marcel Laverdet

    Complete rewrite; version 1.1.0

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

Jul 18, 2009

  1. Marcel Laverdet

    Fixes and stuff

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

Jun 26, 2009

  1. Marcel Laverdet

    More parser gliches

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

Jun 25, 2009

  1. Marcel Laverdet

    Fix glitches and stuff

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

Jun 24, 2009

  1. Marcel Laverdet

    Balance tags

    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
    laverdet authored
  2. Marcel Laverdet

    Bug fixes and rewrites

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

Jun 22, 2009

  1. Marcel Laverdet

    Quick checkin

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