Property | Type | Description | |
---|---|---|---|
$code | |||
$dropTokens | |||
$filePos | |||
$line | |||
$pos | |||
$prevCloseTagHasNewline | |||
$tokenMap | |||
$tokens | |||
$usedAttributes |
Method | Description | |
---|---|---|
__construct ( array $options = [] ) | Creates a Lexer. | |
getNextToken ( mixed &$value = null, mixed &$startAttributes = null, mixed &$endAttributes = null ) : integer | Fetches the next token. | |
getTokens ( ) : array | Returns the token array for current code. | |
handleHaltCompiler ( ) : string | Handles __halt_compiler() by returning the text after it. | |
startLexing ( string $code, phpparser\ErrorHandler $errorHandler = null ) | Initializes the lexer for lexing the provided source code. |
Method | Description | |
---|---|---|
createTokenMap ( ) : array | Creates the token map. | |
handleErrors ( phpparser\ErrorHandler $errorHandler ) | ||
resetErrors ( ) |
Method | Description | |
---|---|---|
errorMayHaveOccurred ( ) | ||
handleInvalidCharacterRange ( $start, $end, $line, phpparser\ErrorHandler $errorHandler ) | ||
isUnterminatedComment ( $token ) |
public __construct ( array $options = [] ) | ||
$options | array | Options array. Currently only the 'usedAttributes' option is supported, which is an array of attributes to add to the AST nodes. Possible attributes are: 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', 'startFilePos', 'endFilePos'. The option defaults to the first three. For more info see getNextToken() docs. |
protected createTokenMap ( ) : array | ||
return | array | The token map |
public getNextToken ( mixed &$value = null, mixed &$startAttributes = null, mixed &$endAttributes = null ) : integer | ||
$value | mixed | Variable to store token content in |
$startAttributes | mixed | Variable to store start attributes in |
$endAttributes | mixed | Variable to store end attributes in |
return | integer | Token id |
protected handleErrors ( phpparser\ErrorHandler $errorHandler ) | ||
$errorHandler | phpparser\ErrorHandler |
public handleHaltCompiler ( ) : string | ||
return | string | Remaining text |
public startLexing ( string $code, phpparser\ErrorHandler $errorHandler = null ) | ||
$code | string | The source code to lex |
$errorHandler | phpparser\ErrorHandler | Error handler to use for lexing errors. Defaults to ErrorHandler\Throwing |