PHP Класс PhpParser\ParserAbstract

Наследование: implements phpparser\Parser
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$YY2TBLSTATE
$YYNLSTATES
$action Table of actions. Indexed according to $actionBase comment.
$actionBase Map of states to a displacement into the $action table. The corresponding action for this state/symbol pair is $action[$actionBase[$state] + $symbol]. If $actionBase[$state] is 0, the action is defaulted, i.e. $actionDefault[$state] should be used instead.
$actionCheck Table indexed analogously to $action. If $actionCheck[$actionBase[$state] + $symbol] != $symbol then the action is defaulted, i.e. $actionDefault[$state] should be used instead.
$actionDefault Map of states to their default action
$actionTableSize Size of $action table
$defaultAction Action number signifying default action
$endAttributeStack End attribute stack
$endAttributes End attributes of last *shifted* token
$errorHandler Error handler
$errorState Error state, used to avoid error floods
$errorSymbol Symbol number of error recovery token
$errors Errors collected during last parse
$goto Table of states to goto after reduction. Indexed according to $gotoBase comment.
$gotoBase Map of non-terminals to a displacement into the $goto table. The corresponding goto state for this non-terminal/state pair is $goto[$gotoBase[$nonTerminal] + $state] (unless defaulted)
$gotoCheck Table indexed analogously to $goto. If $gotoCheck[$gotoBase[$nonTerminal] + $state] != $nonTerminal then the goto state is defaulted, i.e. $gotoDefault[$nonTerminal] should be used.
$gotoDefault Map of non-terminals to the default state to goto after their reduction
$gotoTableSize Size of $goto table
$invalidSymbol Symbol number signifying an invalid token
$lexer Lexer that is used when parsing
$lookaheadStartAttributes Start attributes of last *read* token
$productions Names of the production rules (only necessary for debugging)
$ruleToLength Map of rules to the length of their right-hand side, which is the number of elements that have to be popped from the stack(s) on reduction.
$ruleToNonTerminal Map of rules to the non-terminal on their left-hand side, i.e. the non-terminal to use for determining the state to goto after reduction.
$semStack Semantic value stack (contains values of tokens and semantic action results)
$semValue Temporary value containing the result of last semantic action (reduction)
$specialNames
$stackPos Position in stacks (state stack, semantic value stack, attribute stack)
$startAttributeStack Start attribute stack
$symbolToName Map of symbols to their names
$tokenToSymbol Map of lexer tokens to internal symbols
$tokenToSymbolMapSize Size of $tokenToSymbol map
$unexpectedTokenRule Rule number signifying that an unexpected token was encountered

Открытые методы

Метод Описание
__construct ( Lexer $lexer, array $options = [] ) Creates a parser instance.
parse ( string $code, phpparser\ErrorHandler $errorHandler = null ) : phpparser\Node[] | null Parses PHP code into a node tree.

Защищенные методы

Метод Описание
checkClass ( Class_ $node, $namePos )
checkClassConst ( ClassConst $node, $modifierPos )
checkClassMethod ( ClassMethod $node, $modifierPos )
checkInterface ( Interface_ $node, $namePos )
checkModifier ( $a, $b, $modifierPos )
checkNamespace ( Namespace_ $node )
checkParam ( Param $node )
checkProperty ( Property $node, $modifierPos )
checkTryCatch ( TryCatch $node )
checkUseUse ( UseUse $node, $namePos )
emitError ( Error $error )
getAttributesAt ( $pos )
getErrorMessage ( $symbol, $state )
getExpectedTokens ( $state )
handleBuiltinTypes ( Name $name )
handleNamespaces ( array $stmts ) : phpparser\Node[] Moves statements of semicolon-style namespaces into $ns->stmts and checks various error conditions.
parseLNumber ( $str, $attributes, $allowInvalidOctal = false )
parseNumString ( $str, $attributes )

Приватные методы

Метод Описание
getNamespacingStyle ( array $stmts )

Описание методов

__construct() публичный Метод

Creates a parser instance.
public __construct ( Lexer $lexer, array $options = [] )
$lexer Lexer A lexer
$options array Options array. Currently no options are supported.

checkClass() защищенный Метод

protected checkClass ( Class_ $node, $namePos )
$node PhpParser\Node\Stmt\Class_

checkClassConst() защищенный Метод

protected checkClassConst ( ClassConst $node, $modifierPos )
$node PhpParser\Node\Stmt\ClassConst

checkClassMethod() защищенный Метод

protected checkClassMethod ( ClassMethod $node, $modifierPos )
$node PhpParser\Node\Stmt\ClassMethod

checkInterface() защищенный Метод

protected checkInterface ( Interface_ $node, $namePos )
$node PhpParser\Node\Stmt\Interface_

checkModifier() защищенный Метод

protected checkModifier ( $a, $b, $modifierPos )

checkNamespace() защищенный Метод

protected checkNamespace ( Namespace_ $node )
$node PhpParser\Node\Stmt\Namespace_

checkParam() защищенный Метод

protected checkParam ( Param $node )
$node PhpParser\Node\Param

checkProperty() защищенный Метод

protected checkProperty ( Property $node, $modifierPos )
$node PhpParser\Node\Stmt\Property

checkTryCatch() защищенный Метод

protected checkTryCatch ( TryCatch $node )
$node PhpParser\Node\Stmt\TryCatch

checkUseUse() защищенный Метод

protected checkUseUse ( UseUse $node, $namePos )
$node PhpParser\Node\Stmt\UseUse

emitError() защищенный Метод

protected emitError ( Error $error )
$error Error

getAttributesAt() защищенный Метод

protected getAttributesAt ( $pos )

getErrorMessage() защищенный Метод

protected getErrorMessage ( $symbol, $state )

getExpectedTokens() защищенный Метод

protected getExpectedTokens ( $state )

handleBuiltinTypes() защищенный Метод

protected handleBuiltinTypes ( Name $name )
$name PhpParser\Node\Name

handleNamespaces() защищенный Метод

Moves statements of semicolon-style namespaces into $ns->stmts and checks various error conditions.
protected handleNamespaces ( array $stmts ) : phpparser\Node[]
$stmts array
Результат phpparser\Node[]

parse() публичный Метод

If a non-throwing error handler is used, the parser will continue parsing after an error occurred and attempt to build a partial AST.
public parse ( string $code, phpparser\ErrorHandler $errorHandler = null ) : phpparser\Node[] | null
$code string The source code to parse
$errorHandler phpparser\ErrorHandler Error handler to use for lexer/parser errors, defaults to ErrorHandler\Throwing.
Результат phpparser\Node[] | null Array of statements (or null if the 'throwOnError' option is disabled and the parser was unable to recover from an error).

parseLNumber() защищенный Метод

protected parseLNumber ( $str, $attributes, $allowInvalidOctal = false )

parseNumString() защищенный Метод

protected parseNumString ( $str, $attributes )

Описание свойств

$YY2TBLSTATE защищенное свойство

protected $YY2TBLSTATE

$YYNLSTATES защищенное свойство

protected $YYNLSTATES

$action защищенное свойство

Table of actions. Indexed according to $actionBase comment.
protected $action

$actionBase защищенное свойство

Map of states to a displacement into the $action table. The corresponding action for this state/symbol pair is $action[$actionBase[$state] + $symbol]. If $actionBase[$state] is 0, the action is defaulted, i.e. $actionDefault[$state] should be used instead.
protected $actionBase

$actionCheck защищенное свойство

Table indexed analogously to $action. If $actionCheck[$actionBase[$state] + $symbol] != $symbol then the action is defaulted, i.e. $actionDefault[$state] should be used instead.
protected $actionCheck

$actionDefault защищенное свойство

Map of states to their default action
protected $actionDefault

$actionTableSize защищенное свойство

Size of $action table
protected $actionTableSize

$defaultAction защищенное свойство

Action number signifying default action
protected $defaultAction

$endAttributeStack защищенное свойство

End attribute stack
protected $endAttributeStack

$endAttributes защищенное свойство

End attributes of last *shifted* token
protected $endAttributes

$errorHandler защищенное свойство

Error handler
protected $errorHandler

$errorState защищенное свойство

Error state, used to avoid error floods
protected $errorState

$errorSymbol защищенное свойство

Symbol number of error recovery token
protected $errorSymbol

$errors защищенное свойство

Errors collected during last parse
protected $errors

$goto защищенное свойство

Table of states to goto after reduction. Indexed according to $gotoBase comment.
protected $goto

$gotoBase защищенное свойство

Map of non-terminals to a displacement into the $goto table. The corresponding goto state for this non-terminal/state pair is $goto[$gotoBase[$nonTerminal] + $state] (unless defaulted)
protected $gotoBase

$gotoCheck защищенное свойство

Table indexed analogously to $goto. If $gotoCheck[$gotoBase[$nonTerminal] + $state] != $nonTerminal then the goto state is defaulted, i.e. $gotoDefault[$nonTerminal] should be used.
protected $gotoCheck

$gotoDefault защищенное свойство

Map of non-terminals to the default state to goto after their reduction
protected $gotoDefault

$gotoTableSize защищенное свойство

Size of $goto table
protected $gotoTableSize

$invalidSymbol защищенное свойство

Symbol number signifying an invalid token
protected $invalidSymbol

$lexer защищенное свойство

Lexer that is used when parsing
protected $lexer

$lookaheadStartAttributes защищенное свойство

Start attributes of last *read* token
protected $lookaheadStartAttributes

$productions защищенное свойство

Names of the production rules (only necessary for debugging)
protected $productions

$ruleToLength защищенное свойство

Map of rules to the length of their right-hand side, which is the number of elements that have to be popped from the stack(s) on reduction.
protected $ruleToLength

$ruleToNonTerminal защищенное свойство

Map of rules to the non-terminal on their left-hand side, i.e. the non-terminal to use for determining the state to goto after reduction.
protected $ruleToNonTerminal

$semStack защищенное свойство

Semantic value stack (contains values of tokens and semantic action results)
protected $semStack

$semValue защищенное свойство

Temporary value containing the result of last semantic action (reduction)
protected $semValue

$specialNames защищенное статическое свойство

protected static $specialNames

$stackPos защищенное свойство

Position in stacks (state stack, semantic value stack, attribute stack)
protected $stackPos

$startAttributeStack защищенное свойство

Start attribute stack
protected $startAttributeStack

$symbolToName защищенное свойство

Map of symbols to their names
protected $symbolToName

$tokenToSymbol защищенное свойство

Map of lexer tokens to internal symbols
protected $tokenToSymbol

$tokenToSymbolMapSize защищенное свойство

Size of $tokenToSymbol map
protected $tokenToSymbolMapSize

$unexpectedTokenRule защищенное свойство

Rule number signifying that an unexpected token was encountered
protected $unexpectedTokenRule