2019-08-24 09:48:20 +00:00
|
|
|
<?php
|
|
|
|
|
2020-12-03 22:22:43 +00:00
|
|
|
namespace MediaWiki\Extension\AbuseFilter\Parser;
|
|
|
|
|
2019-08-24 09:48:20 +00:00
|
|
|
/**
|
2019-09-09 17:20:47 +00:00
|
|
|
* A class representing a whole AST generated by AFPTreeParser, holding AFPTreeNode's. This wrapper
|
|
|
|
* could be expanded in the future. For now, it's mostly useful for typehints, and to have an
|
|
|
|
* evalTree function in the CachingParser.
|
2019-08-24 09:48:20 +00:00
|
|
|
*/
|
|
|
|
class AFPSyntaxTree {
|
|
|
|
/**
|
|
|
|
* @var AFPTreeNode|null
|
|
|
|
*/
|
|
|
|
private $rootNode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AFPTreeNode|null $root
|
|
|
|
*/
|
2019-09-09 17:20:47 +00:00
|
|
|
public function __construct( AFPTreeNode $root = null ) {
|
2019-08-24 09:48:20 +00:00
|
|
|
$this->rootNode = $root;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return AFPTreeNode|null
|
|
|
|
*/
|
|
|
|
public function getRoot() {
|
|
|
|
return $this->rootNode;
|
|
|
|
}
|
|
|
|
}
|