function(lexer, ast) {
  this.lexer = lexer;
  this.ast = ast;
  this.tok = lexer.tok;
  this.EOF = lexer.EOF;
  this.token = null;
  this.prev = null;
  this.debug = false;
  this.php7 = true;
  this.extractDoc = false;
  this.extractTokens = false;
  this.suppressErrors = false;
  const mapIt = function(item) {
    return [item, null];
  };
  this.entries = {
    IDENTIFIER: new Map(
      [
        this.tok.T_ABSTRACT,
        this.tok.T_ARRAY,
        this.tok.T_AS,
        this.tok.T_BREAK,
        this.tok.T_CALLABLE,
        this.tok.T_CASE,
        this.tok.T_CATCH,
        this.tok.T_CLASS,
        this.tok.T_CLASS_C,
        this.tok.T_CLONE,
        this.tok.T_CONST,
        this.tok.T_CONTINUE,
        this.tok.T_DECLARE,
        this.tok.T_DEFAULT,
        this.tok.T_DIR,
        this.tok.T_DO,
        this.tok.T_ECHO,
        this.tok.T_ELSE,
        this.tok.T_ELSEIF,
        this.tok.T_EMPTY,
        this.tok.T_ENDDECLARE,
        this.tok.T_ENDFOR,
        this.tok.T_ENDFOREACH,
        this.tok.T_ENDIF,
        this.tok.T_ENDSWITCH,
        this.tok.T_ENDWHILE,
        this.tok.T_EVAL,
        this.tok.T_EXIT,
        this.tok.T_EXTENDS,
        this.tok.T_FILE,
        this.tok.T_FINAL,
        this.tok.T_FINALLY,
        this.tok.T_FUNC_C,
        this.tok.T_FOR,
        this.tok.T_FOREACH,
        this.tok.T_FUNCTION,
        this.tok.T_GLOBAL,
        this.tok.T_GOTO,
        this.tok.T_IF,
        this.tok.T_IMPLEMENTS,
        this.tok.T_INCLUDE,
        this.tok.T_INCLUDE_ONCE,
        this.tok.T_INSTANCEOF,
        this.tok.T_INSTEADOF,
        this.tok.T_INTERFACE,
        this.tok.T_ISSET,
        this.tok.T_LINE,
        this.tok.T_LIST,
        this.tok.T_LOGICAL_AND,
        this.tok.T_LOGICAL_OR,
        this.tok.T_LOGICAL_XOR,
        this.tok.T_METHOD_C,
        this.tok.T_NAMESPACE,
        this.tok.T_NEW,
        this.tok.T_NS_C,
        this.tok.T_PRINT,
        this.tok.T_PRIVATE,
        this.tok.T_PROTECTED,
        this.tok.T_PUBLIC,
        this.tok.T_REQUIRE,
        this.tok.T_REQUIRE_ONCE,
        this.tok.T_RETURN,
        this.tok.T_STATIC,
        this.tok.T_SWITCH,
        this.tok.T_THROW,
        this.tok.T_TRAIT,
        this.tok.T_TRY,
        this.tok.T_UNSET,
        this.tok.T_USE,
        this.tok.T_VAR,
        this.tok.T_WHILE,
        this.tok.T_YIELD
      ].map(mapIt)
    ),
    VARIABLE: new Map(
      [
        this.tok.T_VARIABLE,
        "$",
        "&",
        this.tok.T_NS_SEPARATOR,
        this.tok.T_STRING,
        this.tok.T_NAMESPACE,
        this.tok.T_STATIC
      ].map(mapIt)
    ),
    SCALAR: new Map(
      [
        this.tok.T_CONSTANT_ENCAPSED_STRING,
        this.tok.T_START_HEREDOC,
        this.tok.T_LNUMBER,
        this.tok.T_DNUMBER,
        this.tok.T_ARRAY,
        "[",
        this.tok.T_CLASS_C,
        this.tok.T_TRAIT_C,
        this.tok.T_FUNC_C,
        this.tok.T_METHOD_C,
        this.tok.T_LINE,
        this.tok.T_FILE,
        this.tok.T_DIR,
        this.tok.T_NS_C,
        '"',
        'b"',
        'B"',
        "-",
        this.tok.T_NS_SEPARATOR
      ].map(mapIt)
    ),
    T_MAGIC_CONST: new Map(
      [
        this.tok.T_CLASS_C,
        this.tok.T_TRAIT_C,
        this.tok.T_FUNC_C,
        this.tok.T_METHOD_C,
        this.tok.T_LINE,
        this.tok.T_FILE,
        this.tok.T_DIR,
        this.tok.T_NS_C
      ].map(mapIt)
    ),
    T_MEMBER_FLAGS: new Map(
      [
        this.tok.T_PUBLIC,
        this.tok.T_PRIVATE,
        this.tok.T_PROTECTED,
        this.tok.T_STATIC,
        this.tok.T_ABSTRACT,
        this.tok.T_FINAL
      ].map(mapIt)
    ),
    EOS: new Map([";", this.EOF, this.tok.T_INLINE_HTML].map(mapIt)),
    EXPR: new Map(
      [
        "@",
        "-",
        "+",
        "!",
        "~",
        "(",
        "`",
        this.tok.T_LIST,
        this.tok.T_CLONE,
        this.tok.T_INC,
        this.tok.T_DEC,
        this.tok.T_NEW,
        this.tok.T_ISSET,
        this.tok.T_EMPTY,
        this.tok.T_INCLUDE,
        this.tok.T_INCLUDE_ONCE,
        this.tok.T_REQUIRE,
        this.tok.T_REQUIRE_ONCE,
        this.tok.T_EVAL,
        this.tok.T_INT_CAST,
        this.tok.T_DOUBLE_CAST,
        this.tok.T_STRING_CAST,
        this.tok.T_ARRAY_CAST,
        this.tok.T_OBJECT_CAST,
        this.tok.T_BOOL_CAST,
        this.tok.T_UNSET_CAST,
        this.tok.T_EXIT,
        this.tok.T_PRINT,
        this.tok.T_YIELD,
        this.tok.T_STATIC,
        this.tok.T_FUNCTION,
        // using VARIABLES :
        this.tok.T_VARIABLE,
        "$",
        this.tok.T_NS_SEPARATOR,
        this.tok.T_STRING,
        // using SCALAR :
        this.tok.T_STRING, // @see variable.js line 45 > conflict with variable = shift/reduce :)
        this.tok.T_CONSTANT_ENCAPSED_STRING,
        this.tok.T_START_HEREDOC,
        this.tok.T_LNUMBER,
        this.tok.T_DNUMBER,
        this.tok.T_ARRAY,
        "[",
        this.tok.T_CLASS_C,
        this.tok.T_TRAIT_C,
        this.tok.T_FUNC_C,
        this.tok.T_METHOD_C,
        this.tok.T_LINE,
        this.tok.T_FILE,
        this.tok.T_DIR,
        this.tok.T_NS_C
      ].map(mapIt)
    )
  };
}
function(lexer, ast) {
  this.lexer = lexer;
  this.ast = ast;
  this.tok = lexer.tok;
  this.EOF = lexer.EOF;
  this.token = null;
  this.prev = null;
  this.debug = false;
  this.php7 = true;
  this.extractDoc = false;
  this.extractTokens = false;
  this.suppressErrors = false;
  const mapIt = function(item) {
    return [item, null];
  };
  this.entries = {
    IDENTIFIER: new Map(
      [
        this.tok.T_ABSTRACT,
        this.tok.T_ARRAY,
        this.tok.T_AS,
        this.tok.T_BREAK,
        this.tok.T_CALLABLE,
        this.tok.T_CASE,
        this.tok.T_CATCH,
        this.tok.T_CLASS,
        this.tok.T_CLASS_C,
        this.tok.T_CLONE,
        this.tok.T_CONST,
        this.tok.T_CONTINUE,
        this.tok.T_DECLARE,
        this.tok.T_DEFAULT,
        this.tok.T_DIR,
        this.tok.T_DO,
        this.tok.T_ECHO,
        this.tok.T_ELSE,
        this.tok.T_ELSEIF,
        this.tok.T_EMPTY,
        this.tok.T_ENDDECLARE,
        this.tok.T_ENDFOR,
        this.tok.T_ENDFOREACH,
        this.tok.T_ENDIF,
        this.tok.T_ENDSWITCH,
        this.tok.T_ENDWHILE,
        this.tok.T_EVAL,
        this.tok.T_EXIT,
        this.tok.T_EXTENDS,
        this.tok.T_FILE,
        this.tok.T_FINAL,
        this.tok.T_FINALLY,
        this.tok.T_FUNC_C,
        this.tok.T_FOR,
        this.tok.T_FOREACH,
        this.tok.T_FUNCTION,
        this.tok.T_GLOBAL,
        this.tok.T_GOTO,
        this.tok.T_IF,
        this.tok.T_IMPLEMENTS,
        this.tok.T_INCLUDE,
        this.tok.T_INCLUDE_ONCE,
        this.tok.T_INSTANCEOF,
        this.tok.T_INSTEADOF,
        this.tok.T_INTERFACE,
        this.tok.T_ISSET,
        this.tok.T_LINE,
        this.tok.T_LIST,
        this.tok.T_LOGICAL_AND,
        this.tok.T_LOGICAL_OR,
        this.tok.T_LOGICAL_XOR,
        this.tok.T_METHOD_C,
        this.tok.T_NAMESPACE,
        this.tok.T_NEW,
        this.tok.T_NS_C,
        this.tok.T_PRINT,
        this.tok.T_PRIVATE,
        this.tok.T_PROTECTED,
        this.tok.T_PUBLIC,
        this.tok.T_REQUIRE,
        this.tok.T_REQUIRE_ONCE,
        this.tok.T_RETURN,
        this.tok.T_STATIC,
        this.tok.T_SWITCH,
        this.tok.T_THROW,
        this.tok.T_TRAIT,
        this.tok.T_TRY,
        this.tok.T_UNSET,
        this.tok.T_USE,
        this.tok.T_VAR,
        this.tok.T_WHILE,
        this.tok.T_YIELD
      ].map(mapIt)
    ),
    VARIABLE: new Map(
      [
        this.tok.T_VARIABLE,
        "$",
        "&",
        this.tok.T_NS_SEPARATOR,
        this.tok.T_STRING,
        this.tok.T_NAMESPACE,
        this.tok.T_STATIC
      ].map(mapIt)
    ),
    SCALAR: new Map(
      [
        this.tok.T_CONSTANT_ENCAPSED_STRING,
        this.tok.T_START_HEREDOC,
        this.tok.T_LNUMBER,
        this.tok.T_DNUMBER,
        this.tok.T_ARRAY,
        "[",
        this.tok.T_CLASS_C,
        this.tok.T_TRAIT_C,
        this.tok.T_FUNC_C,
        this.tok.T_METHOD_C,
        this.tok.T_LINE,
        this.tok.T_FILE,
        this.tok.T_DIR,
        this.tok.T_NS_C,
        '"',
        'b"',
        'B"',
        "-",
        this.tok.T_NS_SEPARATOR
      ].map(mapIt)
    ),
    T_MAGIC_CONST: new Map(
      [
        this.tok.T_CLASS_C,
        this.tok.T_TRAIT_C,
        this.tok.T_FUNC_C,
        this.tok.T_METHOD_C,
        this.tok.T_LINE,
        this.tok.T_FILE,
        this.tok.T_DIR,
        this.tok.T_NS_C
      ].map(mapIt)
    ),
    T_MEMBER_FLAGS: new Map(
      [
        this.tok.T_PUBLIC,
        this.tok.T_PRIVATE,
        this.tok.T_PROTECTED,
        this.tok.T_STATIC,
        this.tok.T_ABSTRACT,
        this.tok.T_FINAL
      ].map(mapIt)
    ),
    EOS: new Map([";", this.EOF, this.tok.T_INLINE_HTML].map(mapIt)),
    EXPR: new Map(
      [
        "@",
        "-",
        "+",
        "!",
        "~",
        "(",
        "`",
        this.tok.T_LIST,
        this.tok.T_CLONE,
        this.tok.T_INC,
        this.tok.T_DEC,
        this.tok.T_NEW,
        this.tok.T_ISSET,
        this.tok.T_EMPTY,
        this.tok.T_INCLUDE,
        this.tok.T_INCLUDE_ONCE,
        this.tok.T_REQUIRE,
        this.tok.T_REQUIRE_ONCE,
        this.tok.T_EVAL,
        this.tok.T_INT_CAST,
        this.tok.T_DOUBLE_CAST,
        this.tok.T_STRING_CAST,
        this.tok.T_ARRAY_CAST,
        this.tok.T_OBJECT_CAST,
        this.tok.T_BOOL_CAST,
        this.tok.T_UNSET_CAST,
        this.tok.T_EXIT,
        this.tok.T_PRINT,
        this.tok.T_YIELD,
        this.tok.T_STATIC,
        this.tok.T_FUNCTION,
        
        this.tok.T_VARIABLE,
        "$",
        this.tok.T_NS_SEPARATOR,
        this.tok.T_STRING,
        
        this.tok.T_STRING, 
        this.tok.T_CONSTANT_ENCAPSED_STRING,
        this.tok.T_START_HEREDOC,
        this.tok.T_LNUMBER,
        this.tok.T_DNUMBER,
        this.tok.T_ARRAY,
        "[",
        this.tok.T_CLASS_C,
        this.tok.T_TRAIT_C,
        this.tok.T_FUNC_C,
        this.tok.T_METHOD_C,
        this.tok.T_LINE,
        this.tok.T_FILE,
        this.tok.T_DIR,
        this.tok.T_NS_C
      ].map(mapIt)
    )
  };
}
function ( lexer , ast ) { this . lexer = lexer ; this . ast = ast ; this . tok = lexer . tok ; this . EOF = lexer . EOF ; this . token = null ; this . prev = null ; this . debug = false ; this . php7 = true ; this . extractDoc = false ; this . extractTokens = false ; this . suppressErrors = false ; const mapIt = function ( item ) { return [ item , null ] ; } ; this . entries = { IDENTIFIER : new Map ( [ this . tok . T_ABSTRACT , this . tok . T_ARRAY , this . tok . T_AS , this . tok . T_BREAK , this . tok . T_CALLABLE , this . tok . T_CASE , this . tok . T_CATCH , this . tok . T_CLASS , this . tok . T_CLASS_C , this . tok . T_CLONE , this . tok . T_CONST , this . tok . T_CONTINUE , this . tok . T_DECLARE , this . tok . T_DEFAULT , this . tok . T_DIR , this . tok . T_DO , this . tok . T_ECHO , this . tok . T_ELSE , this . tok . T_ELSEIF , this . tok . T_EMPTY , this . tok . T_ENDDECLARE , this . tok . T_ENDFOR , this . tok . T_ENDFOREACH , this . tok . T_ENDIF , this . tok . T_ENDSWITCH , this . tok . T_ENDWHILE , this . tok . T_EVAL , this . tok . T_EXIT , this . tok . T_EXTENDS , this . tok . T_FILE , this . tok . T_FINAL , this . tok . T_FINALLY , this . tok . T_FUNC_C , this . tok . T_FOR , this . tok . T_FOREACH , this . tok . T_FUNCTION , this . tok . T_GLOBAL , this . tok . T_GOTO , this . tok . T_IF , this . tok . T_IMPLEMENTS , this . tok . T_INCLUDE , this . tok . T_INCLUDE_ONCE , this . tok . T_INSTANCEOF , this . tok . T_INSTEADOF , this . tok . T_INTERFACE , this . tok . T_ISSET , this . tok . T_LINE , this . tok . T_LIST , this . tok . T_LOGICAL_AND , this . tok . T_LOGICAL_OR , this . tok . T_LOGICAL_XOR , this . tok . T_METHOD_C , this . tok . T_NAMESPACE , this . tok . T_NEW , this . tok . T_NS_C , this . tok . T_PRINT , this . tok . T_PRIVATE , this . tok . T_PROTECTED , this . tok . T_PUBLIC , this . tok . T_REQUIRE , this . tok . T_REQUIRE_ONCE , this . tok . T_RETURN , this . tok . T_STATIC , this . tok . T_SWITCH , this . tok . T_THROW , this . tok . T_TRAIT , this . tok . T_TRY , this . tok . T_UNSET , this . tok . T_USE , this . tok . T_VAR , this . tok . T_WHILE , this . tok . T_YIELD ] . map ( mapIt ) ) , VARIABLE : new Map ( [ this . tok . T_VARIABLE , "$" , "&" , this . tok . T_NS_SEPARATOR , this . tok . T_STRING , this . tok . T_NAMESPACE , this . tok . T_STATIC ] . map ( mapIt ) ) , SCALAR : new Map ( [ this . tok . T_CONSTANT_ENCAPSED_STRING , this . tok . T_START_HEREDOC , this . tok . T_LNUMBER , this . tok . T_DNUMBER , this . tok . T_ARRAY , "[" , this . tok . T_CLASS_C , this . tok . T_TRAIT_C , this . tok . T_FUNC_C , this . tok . T_METHOD_C , this . tok . T_LINE , this . tok . T_FILE , this . tok . T_DIR , this . tok . T_NS_C , '"' , 'b"' , 'B"' , "-" , this . tok . T_NS_SEPARATOR ] . map ( mapIt ) ) , T_MAGIC_CONST : new Map ( [ this . tok . T_CLASS_C , this . tok . T_TRAIT_C , this . tok . T_FUNC_C , this . tok . T_METHOD_C , this . tok . T_LINE , this . tok . T_FILE , this . tok . T_DIR , this . tok . T_NS_C ] . map ( mapIt ) ) , T_MEMBER_FLAGS : new Map ( [ this . tok . T_PUBLIC , this . tok . T_PRIVATE , this . tok . T_PROTECTED , this . tok . T_STATIC , this . tok . T_ABSTRACT , this . tok . T_FINAL ] . map ( mapIt ) ) , EOS : new Map ( [ ";" , this . EOF , this . tok . T_INLINE_HTML ] . map ( mapIt ) ) , EXPR : new Map ( [ "@" , "-" , "+" , "!" , "~" , "(" , "`" , this . tok . T_LIST , this . tok . T_CLONE , this . tok . T_INC , this . tok . T_DEC , this . tok . T_NEW , this . tok . T_ISSET , this . tok . T_EMPTY , this . tok . T_INCLUDE , this . tok . T_INCLUDE_ONCE , this . tok . T_REQUIRE , this . tok . T_REQUIRE_ONCE , this . tok . T_EVAL , this . tok . T_INT_CAST , this . tok . T_DOUBLE_CAST , this . tok . T_STRING_CAST , this . tok . T_ARRAY_CAST , this . tok . T_OBJECT_CAST , this . tok . T_BOOL_CAST , this . tok . T_UNSET_CAST , this . tok . T_EXIT , this . tok . T_PRINT , this . tok . T_YIELD , this . tok . T_STATIC , this . tok . T_FUNCTION , // using VARIABLES : this . tok . T_VARIABLE , "$" , this . tok . T_NS_SEPARATOR , this . tok . T_STRING , // using SCALAR : this . tok . T_STRING , // @see variable.js line 45 > conflict with variable = shift/reduce :) this . tok . T_CONSTANT_ENCAPSED_STRING , this . tok . T_START_HEREDOC , this . tok . T_LNUMBER , this . tok . T_DNUMBER , this . tok . T_ARRAY , "[" , this . tok . T_CLASS_C , this . tok . T_TRAIT_C , this . tok . T_FUNC_C , this . tok . T_METHOD_C , this . tok . T_LINE , this . tok . T_FILE , this . tok . T_DIR , this . tok . T_NS_C ] . map ( mapIt ) ) } ; }
The PHP Parser class that build the AST tree from the lexer

@class
@tutorial Parser
@property {Lexer} lexer - current lexer instance
@property {AST} ast - the AST factory instance
@property {Integer|String} token - current token
@property {Boolean} extractDoc - should extract documentation as AST node
@property {Boolean} extractTokens - should extract each token
@property {Boolean} suppressErrors - should ignore parsing errors and continue
@property {Boolean} debug - should output debug informations
The PHP Parser class that build the AST tree from the lexer