Phpparser task

Phpparser task

Description

Task to process phpparser : php to ast (abstract syntax tree) (see: github.com/nikic/PHP-Parser/). PhpParser v4.0.0beta1 is embedded within ant4x.jar (see: releases).

PhpParser task parameters

Attribute Description Value Required
file the php input file yes, if no fileset
tofile the ast output file yes, if no fileset
fileset the php input files no
todir the ast output dir yes, if fileset

Examples

/!\ php must be installed on the system and set up in the PATH.

<project name="phpparser task"> 

  <taskdef name="phpparser" 
       classname="net.sourceforge.ant4x.taskdefs.php.PhpParserTask" 
       classpath="PATH/TO/ant4x.jar"/> 

    <target name="phpparser1"> 
        <phpparser file="file.php" tofile="file.ast" />
    </target> 
    
    <target name="phpparser1"> 
        <phpparser todir="ast/" />
            <fileset dir="dev/src/php">
                <include name="**/*.php"/>
            </fileset>
        </ant4x:phpparser>
    </target> 

</project>