Parent: [cbe364] (diff)

Child: [df0e18] (diff)

Download this file

PHP.rsc    37 lines (28 with data), 919 Bytes

module PHP

import lang::php::m3::Core;
import lang::php::m3::FillM3;
import lang::php::ast::AbstractSyntax;
import lang::php::util::Utils;
import org::ossmeter::metricprovider::ProjectDelta; 

import IO;

public data Language(str version="")
	= php();

public data AST(loc file = |file:///unknown|)
	= phpAST(Script script);


@M3Extractor{}
public rel[Language, loc, M3] extractM3sPHP(loc project, set[loc] roots, ProjectDelta delta)
{
	return { <php(), file, createM3forScript(file, script)> | <php(), file, phpAST(script)> <- extractASTsPHP(project, roots, delta) };
}

@ASTExtractor{}
@memo
public rel[Language, loc, AST] extractASTsPHP(loc project, set[loc] roots, ProjectDelta delta)
{
	rel[Language, loc, AST] result = {};
	
	for (root <- roots)
	{
		System sys = loadPHPFiles(root);
		result += { <php(), file, (errscript(m) := sys[file] ? noAST(m) : phpAST(sys[file]))> | file <- sys };
	}
	
	return result;
}