Skip to main content

module lang::php::util::Utils

rascal-0.34.0
php-analysis-0.2.3

Usage

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

Source code

http://github.com/cwi-swat/php-analysis/blob/main/src/main/rascal/lang/php/util/Utils.rsc

Dependencies

import lang::php::util::Corpus;
import lang::php::ast::System;
import lang::php::ast::AbstractSyntax;
import lang::php::util::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) throws AssertionFailed

Script loadPHPFile(loc l, bool addLocationAnnotations, bool addUniqueIds) throws AssertionFailed

Load a single PHP file with location annotations.

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)