Changeset 233

Show
Ignore:
Timestamp:
08/06/06 11:40:08 (2 years ago)
Author:
laurentj
Message:

preprocesseur : ajout de #includephp

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/preprocessor.lib.php

    r232 r233  
    198198                    $source[$nb]=false; 
    199199                } 
    200             }elseif(preg_match('/^\#include\s+([\w\/\.\:]+)\s*$/m',$line,$m)){ 
     200            }elseif(preg_match('/^\#include(php)?\s+([\w\/\.\:]+)\s*$/m',$line,$m)){ 
    201201                if($isOpen){ 
    202                     $path = $m[1]; 
     202                    $path = $m[2]; 
    203203                    if(!($path{0} == '/' || preg_match('/^\w\:\\.+$/',$path))){ 
    204204                        $path = realpath(dirname($filename).'/'.$path); 
     
    216216                        throw new jExceptionPreProc($filename,$nb,self::ERR_INVALID_FILENAME); 
    217217                    } 
     218                    if($m[1] == 'php'){ 
     219                        if(preg_match('/^\s*\<\?(?:php)?((?:.|\n)*)\?\>\s*$/m',$source[$nb],$ms)){ 
     220                            $source[$nb] = $ms[1]; 
     221                        } 
     222                    } 
    218223               }else{ 
    219224                    $source[$nb]=false; 
  • trunk/build/tests/ppdatas/result_include1.txt

    r232 r233  
    77dddddd 
    88 
     9<?php 
    910kkkkk 
    1011 
     
    1314 
    1415mmmmm 
     16?> 
    1517 
    1618 
     
    1921hhhhhh 
    2022 
    21 kkkkkkk 
     23jooooba 
    2224popopqsd 
    2325mlmlml 
  • trunk/build/tests/ppdatas/source_inc1.txt

    r232 r233  
    1  
     1<?php 
    22kkkkk 
    33 
     
    77 
    88mmmmm 
     9?> 
  • trunk/build/tests/ppdatas/subdir/inc_err.txt

    r232 r233  
    88#endif 
    99 
    10 kkkkkkk 
     10jooooba 
    1111#include foo.txt 
  • trunk/build/tests/ppdatas/subdir/source_inc.txt

    r232 r233  
    88#endif 
    99 
    10 kkkkkkk 
     10jooooba 
    1111#include ../source_inc2.txt 
  • trunk/build/tests/testpreprocess.php

    r232 r233  
    6464      'source_include1.txt'=>array( 
    6565            'result_include1.txt'=>array('FOO'=>'ok'), 
     66          ), 
     67      'source_include2.txt'=>array( 
     68            'result_include2.txt'=>array('FOO'=>'ok'), 
    6669          ), 
    6770 
Download in other formats: Unified Diff Zip Archive