Parsing and lexing目次
The Parle\Lexer classはじめにSingle state lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with Parle\Parser, the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. This lexer can give a certain performance advantage over Parle\RLexer, if no multiple states are required. Note, that Parle\RParser is not compatible with this lexer. クラス概要Parle\Lexer
class Parle\Lexer
{
/* 定数 */
const
int
Parle\Lexer::ICASE = 1;
const
int
Parle\Lexer::DOT_NOT_LF = 2;
const
int
Parle\Lexer::DOT_NOT_CRLF = 4;
const
int
Parle\Lexer::SKIP_WS = 8;
const
int
Parle\Lexer::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 void advance()
public void build()
public void callout(int
$id , callable $callback )public void consume(string
$data )public void dump()
public Parle\Token getToken()
public void insertMacro(string
$name , string $regex )public void push(string
$regex , int $id )public void reset(int
}$pos )定義済み定数
プロパティ
The Parle\RLexer classはじめにMultistate lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with Parle\RParser, the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. Note, that Parle\Parser is not compatible with this lexer. クラス概要Parle\RLexer
class Parle\RLexer
{
/* 定数 */
const
int
Parle\RLexer::ICASE = 1;
const
int
Parle\RLexer::DOT_NOT_LF = 2;
const
int
Parle\RLexer::DOT_NOT_CRLF = 4;
const
int
Parle\RLexer::SKIP_WS = 8;
const
int
Parle\RLexer::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 void advance()
public void build()
public void callout(int
$id , callable $callback )public void consume(string
$data )public void dump()
public Parle\Token getToken()
public void insertMacro(string
$name , string $regex )public void push(string
$regex , int $id )public void push(
string $state ,string $regex ,int $id ,string $newState ) public void push(string
$state , string $regex , string $newState )public int pushState(string
$state )public void reset(int
}$pos )定義済み定数
プロパティ
The Parle\Parser classはじめにParser class. Rules can be defined on the fly. Once finalized, a Parle\Lexer instance is required to deliver the token stream. クラス概要Parle\Parser
class Parle\Parser
{
/* 定数 */
const
int
Parle\Parser::ACTION_ERROR = 0;
const
int
Parle\Parser::ACTION_SHIFT = 1;
const
int
Parle\Parser::ACTION_REDUCE = 2;
const
int
Parle\Parser::ACTION_GOTO = 3;
const
int
Parle\Parser::ACTION_ACCEPT = 4;
const
int
Parle\Parser::ERROR_SYNTAX = 0;
const
int
Parle\Parser::ERROR_NON_ASSOCIATIVE = 1;
const
int
Parle\Parser::ERROR_UNKNOWN_TOKEN = 2;
/* プロパティ */
public
int
$action = 0;
public
int
$reduceId = 0;
/* メソッド */
public void advance()
public void build()
public void consume(string
$data , Parle\Lexer $lexer )public void dump()
public Parle\ErrorInfo errorInfo()
public void left(string
$tok )public void nonassoc(string
$tok )public void precedence(string
$tok )public int push(string
$name , string $rule )public void reset(int
$tokenId = ?)public void right(string
$tok )public string sigil(int
$idx )public int sigilCount()
public string sigilName(int
$idx )public void token(string
$tok )public int tokenId(string
$tok )public string trace()
public bool validate(string
}$data , Parle\Lexer $lexer )定義済み定数
プロパティ
The Parle\RParser classはじめにParser class. Rules can be defined on the fly. Once finalized, a Parle\RLexer instance is required to deliver the token stream. クラス概要Parle\RParser
class Parle\RParser
{
/* 定数 */
const
int
Parle\RParser::ACTION_ERROR = 0;
const
int
Parle\RParser::ACTION_SHIFT = 1;
const
int
Parle\RParser::ACTION_REDUCE = 2;
const
int
Parle\RParser::ACTION_GOTO = 3;
const
int
Parle\RParser::ACTION_ACCEPT = 4;
const
int
Parle\RParser::ERROR_SYNTAX = 0;
const
int
Parle\RParser::ERROR_NON_ASSOCIATIVE = 1;
const
int
Parle\RParser::ERROR_UNKNOWN_TOKEN = 2;
/* プロパティ */
public
int
$action = 0;
public
int
$reduceId = 0;
/* メソッド */
public void advance()
public void build()
public void consume(string
$data , Parle\RLexer $rlexer )public void dump()
public Parle\ErrorInfo errorInfo()
public void left(string
$tok )public void nonassoc(string
$tok )public void precedence(string
$tok )public int push(string
$name , string $rule )public void reset(int
$tokenId = ?)public void right(string
$tok )public string sigil(int
$idx = ?)public int sigilCount()
public string sigilName(int
$idx )public void token(string
$tok )public int tokenId(string
$tok )public string trace()
public bool validate(string
}$data , Parle\RLexer $lexer )定義済み定数
プロパティ
The Parle\Stack classはじめにParle\Stack is a LIFO stack. The elements are inserted and removed only from one end. クラス概要Parle\Stack
class Parle\Stack
{
/* プロパティ */
public
bool
$empty =
true ;public
int
$size = 0;
public
mixed
$top;
/* メソッド */
public void pop()
public void push(mixed
}$item )プロパティ
The Parle\Token classはじめにThis class represents a token. Lexer returns instances of this class. クラス概要Parle\Token
class Parle\Token
{
/* 定数 */
const
int
Parle\Token::EOI = 0;
const
int
Parle\Token::UNKNOWN = -1;
const
int
Parle\Token::SKIP = -2;
/* プロパティ */
public
int
$id;
public
string
$value;
/* メソッド */
}プロパティ
定義済み定数
The Parle\ErrorInfo classはじめにThe class represents detailed error information as supplied by Parle\Parser::errorInfo クラス概要Parle\ErrorInfo
class Parle\ErrorInfo
{
/* プロパティ */
public
int
$id;
public
int
$position;
public
mixed
$token;
/* メソッド */
}プロパティ
The Parle\LexerException classはじめに
クラス概要Parle\LexerException
class Parle\LexerException
extends
Exception
implements
Throwable {
/* 継承したプロパティ */
protected
string
$message = "";
private
string
$string = "";
protected
int
$code;
protected
string
$file = "";
protected
int
$line;
private
array
$trace = [];
private
Throwablenull
$previous = null;
/* メソッド */
/* 継承したメソッド */
final public string Exception::getMessage()
final public Throwablenull Exception::getPrevious()
final public int Exception::getCode()
final public string Exception::getFile()
final public int Exception::getLine()
final public array Exception::getTrace()
final public string Exception::getTraceAsString()
public string Exception::__toString()
private void Exception::__clone()
}The Parle\ParserException classはじめに
クラス概要Parle\ParserException
class Parle\ParserException
extends
Exception
implements
Throwable {
/* 継承したプロパティ */
protected
string
$message = "";
private
string
$string = "";
protected
int
$code;
protected
string
$file = "";
protected
int
$line;
private
array
$trace = [];
private
Throwablenull
$previous = null;
/* メソッド */
/* 継承したメソッド */
final public string Exception::getMessage()
final public Throwablenull Exception::getPrevious()
final public int Exception::getCode()
final public string Exception::getFile()
final public int Exception::getLine()
final public array Exception::getTrace()
final public string Exception::getTraceAsString()
public string Exception::__toString()
private void Exception::__clone()
} |