Skip to main content

module lang::php::util::Utils

rascal-0.43.0
org.rascalmpl.php-analysis-0.3.6

Usage​

import lang::php::util::Utils;

Dependencies​

import lang::php::util::Corpus;
import lang::php::ast::System;
import lang::php::ast::AbstractSyntax;
import lang::php::config::Config;
import IO;
import ValueIO;
import String;
import Set;
import List;
import Exception;
import DateTime;
import util::ShellExec;
import Map;
import lang::php::pp::PrettyPrinter;

function executePHP​

str executePHP(list[str] opts, loc cwd)

function parsePHPfile​

Script parsePHPfile(loc f, list[str] opts, Script error)

function testPHPInstallation​

bool testPHPInstallation()

Test if a running version php is available on the path

function parsePHPStatement​

Stmt parsePHPStatement(str s)

Parse an individual PHP statement using the external parser, returning the associated AST.

function parsePHPExpression​

Expr parsePHPExpression(str s)

Parse an individual PHP expression using the external parser, returning the associated AST.

function loadPHPFile​

Script loadPHPFile(loc l, bool addLocationAnnotations = true, bool addUniqueIds = false, bool includeLocationInfo = false, bool includePhpDocs = false) throws AssertionFailed

Load a single PHP file, with options for location annotations and unique node ids.

function loadPHPFiles​

System loadPHPFiles(loc l, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }) throws AssertionFailed

Load all PHP files at a given directory location, with options for which extensions are PHP files, location annotations, and unique node ids.

function loadProduct​

System loadProduct(str product, str version, bool addLocationAnnotations = true, bool addUniqueIds = false)

Load a specific system from the corpus

function buildBinaries​

void buildBinaries(str product, str version, loc l, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

Build the serialized ASTs for a specific system at a specific location

function buildAndCheckBinaries​

void buildAndCheckBinaries(str product, str version, loc l, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

Build the serialized ASTs for a specific system at a specific location

function buildBinaries​

void buildBinaries(str product, str version, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

void buildBinaries(str product, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

void buildBinaries(bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

Build the serialized ASTs for a specific system at the default location

function buildCurrent​

void buildCurrent(str product, loc l, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

void buildCurrent(loc systemLoc, bool addLocationAnnotations = true, bool addUniqueIds = false, set[str] extensions = { "php", "inc" }, bool overwrite = true)

Build the serialized ASTs for the current version specific system at a specific location

function buildMissingBinaries​

void buildMissingBinaries(str product, str version, bool addLocationAnnotations = true, bool addUniqueIds = false)

void buildMissingBinaries(str product, bool addLocationAnnotations = true, bool addUniqueIds = false)

void buildMissingBinaries(bool addLocationAnnotations = true, bool addUniqueIds = false)

Build the serialized ASTs for a specific system if they have not been built already

function buildNewestBinaries​

void buildNewestBinaries(bool addLocationAnnotations = true, bool addUniqueIds = false)

Build the serialized ASTs only for the newest version of each system in the corpus.

function loadBinary​

System loadBinary(str product, str version)

System loadBinary(str name)

Load the serialized ASTs for a specific system in the corpus.

function binaryExists​

bool binaryExists(str product, str version)

function getLatestTrees​

map[tuple[str product, str version], System] getLatestTrees()

function increaseFolderCounter​

void increaseFolderCounter()

function resetCounters​

void resetCounters()

function setFolderTotal​

void setFolderTotal(loc baseDir)

function countFolders​

int countFolders(loc d)

function logMessage​

void logMessage(str message, int level)
Log level 0 => no logging;
Log level 1 => main logging;
Log level 2 => debug logging;

function checkConfiguration​

void checkConfiguration()

function convertCorpusItemToNamedSystem​

void convertCorpusItemToNamedSystem(str product, str version)

function convertCorpusToNamedSystems​

void convertCorpusToNamedSystems()

function unparsedFiles​

rel[str systemName, str systemVersion, loc fileLoc] unparsedFiles()

function reparseLocations​

void reparseLocations(str systemName, str systemVersion, set[loc] locs)

function removeNonFileLocs​

void removeNonFileLocs(str systemName, str systemVersion)

function patchBinaries​

void patchBinaries()

void patchBinaries(str systemName)

void patchBinaries(str systemName, str systemVersion)