CloneableInstantiable
ExtendsPhpParser\Lexer
Constants
public PhpParser\Lexer\Emulative::FLEXIBLE_DOC_STRING_REGEX = '/<<<[ \t]*(['"]?)([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)\1\r?\n (?:.*\r?\n)*? (?\h*)\2(?![a-zA-Z0-9_\x80-\xff])(?(?:;?[\r\n])?)/x'
public PhpParser\Lexer\Emulative::PHP_7_3 = '7.3.0dev'
public PhpParser\Lexer\Emulative::PHP_7_4 = '7.4.0dev'
public PhpParser\Lexer\Emulative::T_COALESCE_EQUAL = 1007
public PhpParser\Lexer\Emulative::T_FN = 1008
Methods
public __construct(array $options = [])
 


    public PhpParser\Lexer::getNextToken( $value = NULL, $startAttributes = NULL, $endAttributes = NULL) : int
     
    Fetches the next token.

    The available attributes are determined by the 'usedAttributes' option, which can
    be specified in the constructor. The following attributes are supported:

    • 'comments' => Array of PhpParser\Comment or PhpParser\Comment\Doc instances,
                     representing all comments that occurred between the previous
                     non-discarded token and the current one.
      
    • 'startLine' => Line in which the node starts.
    • 'endLine' => Line in which the node ends.
    • 'startTokenPos' => Offset into the token array of the first token in the node.
    • 'endTokenPos' => Offset into the token array of the last token in the node.
    • 'startFilePos' => Offset into the code string of the first character that is part of the node.
    • 'endFilePos' => Offset into the code string of the last character that is part of the node.
    • return int Token id
    public PhpParser\Lexer::getTokens() : array
     
    Returns the token array for current code.

    The token array is in the same format as provided by the
    token_get_all() function and does not discard tokens (i.e.
    whitespace and comments are included). The token position
    attributes are against this token array.

    • return array Array of tokens in token_get_all() format
    public PhpParser\Lexer::handleHaltCompiler() : string
     
    Handles __halt_compiler() by returning the text after it.

    • return string Remaining text
    public startLexing(string $code, ?PhpParser\ErrorHandler $errorHandler = NULL)
    Properties
    protected PhpParser\Lexer::$code
    protected PhpParser\Lexer::$dropTokens
    protected PhpParser\Lexer::$filePos
    protected PhpParser\Lexer::$line
    protected PhpParser\Lexer::$pos
    protected PhpParser\Lexer::$prevCloseTagHasNewline
    protected PhpParser\Lexer::$tokenMap
    protected PhpParser\Lexer::$tokens
    Methods
    protected PhpParser\Lexer::createTokenMap() : array
     
    Creates the token map.

    The token map maps the PHP internal token identifiers
    to the identifiers used by the Parser. Additionally it
    maps T_OPEN_TAG_WITH_ECHO to T_ECHO and T_CLOSE_TAG to ';'.

    • return array The token map
    protected PhpParser\Lexer::handleErrors(PhpParser\ErrorHandler $errorHandler)
    Properties
    private $patches
     


    • var array Patches used to reverse changes introduced in the code
    private $tokenEmulators
     


    • var TokenEmulatorInterface[]
    Methods
    private PhpParser\Lexer::errorMayHaveOccurred() : bool
     
    Check whether an error *may* have occurred during tokenization.

    • return bool
    private fixupErrors(array $errors)
     
    Fixup line and position information in errors.

      private fixupTokens()
      private PhpParser\Lexer::handleInvalidCharacterRange( $start, $end, $line, PhpParser\ErrorHandler $errorHandler)
      private isEmulationNeeded(string $code) : bool
      private isHeredocNowdocEmulationNeeded(string $code) : bool
      private PhpParser\Lexer::isUnterminatedComment( $token) : bool
       
      Check whether comment token is unterminated.

      • return bool
      private processHeredocNowdoc(string $code) : string
      © 2020 Bruce Wells
      Search Namespaces \ Classes
      ConfigurationNumbers (0-9.) only