/** * @override */ function format_lines(&$line, array &$lines) { $Node = $this->reset(); do { $Node->format_lines($line, $lines); } while (($Node = $this->next()) && !$Node->is_symbol(J_FUNC_BODY)); // at body, break after "{" JNodeBase::format_newline('', $line, $lines); $funclines = array(); $Node->format_lines($line, $funclines); // indent function lines foreach ($funclines as $funcline) { $lines[] = "\t" . $funcline; } // close body // only break after declarations if ($this->is_symbol(J_FUNC_EXPR)) { $line .= '} '; } else { if ($line) { JNodeBase::format_newline('', $line, $lines); } JNodeBase::format_newline('}', $line, $lines); } }
/** * @override */ function format_lines(&$line, array &$lines) { foreach ($this->children as $Node) { if ($Node->is_symbol(':')) { $line = rtrim($line, ' '); JNodeBase::format_newline(':', $line, $lines); } else { $Node->format_lines($line, $lines); } } }
/** * @override */ function format_lines(&$line, array &$lines) { $Block = $this->get_child(1); if (!$Block->is_symbol(J_STATEMENT_LIST)) { JNodeBase::format_newline('{ }', $line, $lines); return; } // else collect block statement JNodeBase::format_newline('{', $line, $lines); $blocklines = array(); $Block->format_lines($line, $blocklines); // indent block foreach ($blocklines as $blockline) { $lines[] = "\t" . $blockline; } if ($line) { JNodeBase::format_newline('', $line, $lines); } JNodeBase::format_newline('}', $line, $lines); }
/** * @override */ function format_lines(&$line, array &$lines) { foreach ($this->children as $Node) { if ($Node->is_symbol('{')) { JNodeBase::format_newline('{', $line, $lines); } else { if ($Node->is_symbol('}')) { if ($line) { JNodeBase::format_newline('', $line, $lines); } JNodeBase::format_newline('}', $line, $lines); } else { // ident case blocks $blocklines = array(); $Node->format_lines($line, $blocklines); foreach ($blocklines as $blockline) { $lines[] = "\t" . $blockline; } } } } }