The Parle\RParser class

(PECL parle >= 0.7.0)

简介

Parser class. Rules can be defined on the fly. Once finalized, a Parle\RLexer instance is required to deliver the token stream.

类摘要

Parle\RParser {
/* Constants */
const integer ACTION_ERROR = 0 ;
const integer ACTION_SHIFT = 1 ;
const integer ACTION_REDUCE = 2 ;
const integer ACTION_GOTO = 3 ;
const integer ACTION_ACCEPT = 4 ;
const integer ERROR_SYNTAX = 0 ;
const integer ERROR_NON_ASSOCIATIVE = 1 ;
const integer ERROR_UNKOWN_TOKEN = 2 ;
/* 属性 */
public integer $action = 0 ;
public integer $reduceId = 0 ;
/* 方法 */
public advance ( void ) : void
public build ( void ) : void
public consume ( string $data , Parle\RLexer $rlexer ) : void
public dump ( void ) : void
public errorInfo ( void ) : Parle\ErrorInfo
public left ( string $tok ) : void
public nonassoc ( string $tok ) : void
public precedence ( string $tok ) : void
public push ( string $name , string $rule ) : int
public reset ([ int $tokenId ] ) : void
public right ( string $tok ) : void
public sigil ([ int $idx ] ) : string
public token ( string $tok ) : void
public tokenId ( string $tok ) : int
public trace ( void ) : string
public validate ( string $data , Parle\RLexer $lexer ) : bool
}

预定义常量

Parle\RParser::ACTION_ERROR

Parle\RParser::ACTION_SHIFT

Parle\RParser::ACTION_REDUCE

Parle\RParser::ACTION_GOTO

Parle\RParser::ACTION_ACCEPT

Parle\RParser::ERROR_SYNTAX

Parle\RParser::ERROR_NON_ASSOCIATIVE

Parle\RParser::ERROR_UNKOWN_TOKEN

属性

action

Current parser action that matches one of the action class constants, readonly.

reduceId

Grammar rule id just processed in the reduce action. The value corresponds either to a token or to a production id. Readonly.

Table of Contents