2024 日本 PHP 研討會

Parle\RLexer 類別

(PECL parle >= 0.5.1)

簡介

多狀態詞法分析器類別。詞彙可以動態定義。如果特定的詞法分析器實例打算與 Parle\RParser 一起使用,則需要從那裡取得權杖 ID。否則,可以提供任意權杖 ID。請注意,Parle\Parser 與此詞法分析器不相容。

類別概要

類別 Parle\RLexer {
/* 常數 */
const int ICASE = 1;
const int DOT_NOT_LF = 2;
const int DOT_NOT_CRLF = 4;
const int SKIP_WS = 8;
const int MATCH_ZERO_LEN = 16;
/* 屬性 */
public bool $bol = false;
public int $flags = 0;
public int $state = 0;
public int $marker = 0;
public int $cursor = 0;
/* 方法 */
public advance(): void
public build(): void
public callout(int $id, callable $callback): void
public consume(string $data): void
public dump(): void
公開 insertMacro(字串 $name, 字串 $regex):
公開 push(字串 $regex, 整數 $id):
公開 push(
    字串 $state,
    字串 $regex,
    整數 $id,
    字串 $newState
):
公開 push(字串 $state, 字串 $regex, 字串 $newState):
公開 pushState(字串 $state): 整數
公開 reset(整數 $pos):
}

屬性

bol

輸入開頭旗標。

flags

Lexer 旗標。

state

目前的 lexer 狀態,唯讀。

marker

最新 token 匹配的位置,唯讀。

cursor

目前的輸入偏移量,唯讀。

目錄

新增註記

使用者提供的註記

此頁面沒有使用者提供的註記。
To Top