/** * Draw the table of a part given in parameter * depending of the level * @param bnfPart $origine * @param integer $level * @return string */ function table(bnfPart &$origine, &$level) { //Specifics treatment if options are present in the first line if ($level === 0 && bnfSubParts::isOr($origine->parts) && $origine->type === bnf::RULE && bnfSubParts::$changeToSet === false) { bnfSubParts::$changeToSet = true; $t = ""; $clone = clone $origine; $set = new bnfPartSet($t, true); for ($i = 0; $i < count($clone->parts); $i++) { $set->parts[$i] = $clone->parts[$i]; } unset($clone->parts); $clone->parts[0] = $set; return bnfSubParts::tableAnd($clone, $level); } else { bnfSubParts::$changeToSet = false; //echo $origine->type; if (bnfSubParts::isOr($origine->parts)) { return bnfSubParts::tableOr($origine, $level); } return bnfSubParts::tableAnd($origine, $level); } }