1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +01:00

Make Node_Scalar instanceof Node_Expr

This commit is contained in:
nikic 2011-05-30 18:01:38 +02:00
parent 9aed651d51
commit 22ea3d6a70
4 changed files with 6 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<?php
abstract class Node_Scalar extends NodeAbstract
abstract class Node_Scalar extends Node_Expr
{
}

View File

@ -324,7 +324,7 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract
public function pExpr_StaticCall(Node_Expr_StaticCall $node) {
return $this->pClassName($node->class) . '::'
. ($node->func instanceof NodeAbstract ? $this->p($node->func) : $node->func)
. ($node->func instanceof Node_Expr ? $this->p($node->func) : $node->func)
. '(' . $this->pCommaSeparated($node->args) . ')';
}
@ -606,7 +606,7 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract
public function pObjectProperty($node) {
if ($node instanceof Node_Variable || $node instanceof Node_Expr_ArrayDimFetch) {
return $this->p($node);
} elseif ($node instanceof NodeAbstract) {
} elseif ($node instanceof Node_Expr) {
return '{' . $this->p($node) . '}';
} else {
return $node;
@ -635,12 +635,8 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract
foreach ($encapsList as $element) {
if (is_string($element)) {
$return .= addcslashes($element, "\n\r\t\f\v$\"\\");
} elseif ($element instanceof Node_Variable) {
if (is_string($element->name)) {
$return .= '$' . $element->name;
} else {
$return .= '{' . $this->p($element->name). '}';
}
} elseif ($element instanceof Node_Variable && is_string($element->name)) {
$return .= '$' . $element->name;
} else {
$return .= '{' . $this->p($element) . '}';
}

View File

@ -35,7 +35,7 @@ $prettyPrinter = new PrettyPrinter_Zend;
$code = $prettyPrinter->pStmts(
$parser->yyparse(
new Lexer(file_get_contents(
__FILE__
'../symfonySandbox\src\vendor\symfony\src\Symfony\Components\Console\Input\InputDefinition.php'
)),
function ($msg) {
echo $msg;

View File

@ -7,7 +7,6 @@ function __autoload($class) {
}
$parser = new Parser();
$parser->yydebug = false;
$prettyPrinter = new PrettyPrinter_Zend;