PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

Parle\RLexer::push - Add a lexer rule | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

Parle\RLexer::push

(PECL parle >= 0.5.1)

Parle\RLexer::pushAdd a lexer rule

説明

public void Parle\RLexer::push ( string $regex , integer $id )
public void Parle\RLexer::push ( string $state , string $regex , integer $id , string $newState )
public void Parle\RLexer::push ( string $state , string $regex , string $newState )

Push a pattern for lexeme recognition.

A 'start state' and 'exit state' can be specified by using a suitable signature.

パラメータ

regex

Regular expression used for token matching.

id

Token id. If the lexer instance is meant to be used standalone, this can be an arbitrary number. If the lexer instance is going to be passed to the parser, it has to be an id returned by Parle\RParser::tokenid().

state

State name. If '*' is used as start state, then the rule is applied to all lexer states.

newState

New state name, after the rule was applied.

If '.' is specified as the exit state, then the lexer state is unchanged when that rule matches. An exit state with '>' before the name means push. Use the signature without id for either continuation or to start matching, when a continuation or recursion is required.

If '<' is specified as exit state, it means pop. In that case, the signature containing the id can be used to identify the match. Note that even in the case an id is specified, the rule will finish first when all the previous pushes popped.

返り値

値を返しません。


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「Parle\RLexer::push - Add a lexer rule」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | Parle\RLexer::push - Add a lexer rule」をGoogle検索
copyright © 1997-2021 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: