Documentation

XParser_String extends XParser
in package

A Parser working on strings

Table of Contents

Properties

$debug  : mixed
$result  : UXMLDoc
$cut  : mixed
$l  : mixed
$p  : mixed
$s  : mixed
$syntax  : UXMLDoc

Methods

__construct()  : mixed
apply()  : UXMLElement
Applies syntax on input.
export()  : string
A megadott node tartalmát XML stringgé alakítja
filterNodes()  : void
Törli a megadott nevő gyermek node-okat.
getc()  : string
Must return a char or false on EOF
getPos()  : mixed
getSymbol()  : UXMLElement
Tries to read a symbol by named rule.
getTerm()  : mixed
joinAttr()  : void
Converts <_attr name>value</_attr> subnodes to attributes.
matchList()  : bool
'list' matches if sequence matches [min, max] times.
matchNode()  : bool
matches a node, and collects the result tree.
matchOr()  : bool
'or' matches if any of elements matches. (Use 'case' for group elements) Matching element terminates early.
matchRule()  : bool
tries to match a rule once (several rule versions or-ed)
matchSeq()  : bool
matches a sequence of patterns under the node, and collects the result tree.
setPos()  : mixed
toRegExp()  : string
Creates a delimited RegEx pattern from a bare pattern.
ungetc()  : mixed

Properties

Methods

__construct()

public __construct(mixed $s, mixed $syntax) : mixed
Parameters
$s : mixed
$syntax : mixed

apply()

Applies syntax on input.

public apply() : UXMLElement

Finds default match in syntax file and applies getSymbol(name) of it. Builds XML representation structure ... ...

Tags
throws
XParserException
Return values
UXMLElement

result node or null

export()

A megadott node tartalmát XML stringgé alakítja

public export(DOMElement $node[, int $ent = 0 ][, string $c = '' ]) : string
Parameters
$node : DOMElement
$ent : int = 0

-- 0:default, 1:htmlentities, 2:formatted

$c : string = ''

-- színes span-ben adja vissza

Tags
throws
Exception
Return values
string

-- az XML string

filterNodes()

Törli a megadott nevő gyermek node-okat.

public filterNodes(mixed $node, mixed $nodename) : void

Elsősorban az _attr node-ok eltávolítására szolgál, ahol a text tartalom kell csak.

Parameters
$node : mixed
$nodename : mixed

getc()

Must return a char or false on EOF

public getc() : string
Return values
string

getSymbol()

Tries to read a symbol by named rule.

public getSymbol(string $name) : UXMLElement

Inserts result into result structure. Returns result node or false on failure

Parameters
$name : string
Tags
throws
XParserException
Return values
UXMLElement

-- result node

getTerm()

public getTerm(mixed $term) : mixed
Parameters
$term : mixed

joinAttr()

Converts <_attr name>value</_attr> subnodes to attributes.

public joinAttr(DOMElement $node) : void

Duplicate attributes overwrite existing ones. <_attr> subnodes without name attribute are be ignored All other attributes and sub-subnodes are ignored All <_attr> subnodes will be completely removed (including the irregular ones)

Parameters
$node : DOMElement

matchList()

'list' matches if sequence matches [min, max] times.

public matchList(DOMElement $node, int $min, int $max, DOMElement $node_parent, bool $f) : bool

Zero match terminates first time.

Parameters
$node : DOMElement
$min : int
$max : int
$node_parent : DOMElement
$f : bool

-- add chars to result

Tags
throws
XParserException
Return values
bool

matchNode()

matches a node, and collects the result tree.

public matchNode(DOMElement $node, DOMElement|DOMDocumentFragment $resultFragment[, int $f = 0 ]) : bool

used in matchSequence and matchOr

Parameters
$node : DOMElement

-- syntax node

$resultFragment : DOMElement|DOMDocumentFragment

-- inserts results here

$f : int = 0

-- add chars to result

Tags
throws
XParserException
Return values
bool

-- false if failed

matchOr()

'or' matches if any of elements matches. (Use 'case' for group elements) Matching element terminates early.

public matchOr(DOMElement $node, DOMElement|DOMDocumentFragment $node_parent, bool $f) : bool
Parameters
$node : DOMElement
$node_parent : DOMElement|DOMDocumentFragment
$f : bool

-- add chars to result

Tags
throws
XParserException
Return values
bool

matchRule()

tries to match a rule once (several rule versions or-ed)

public matchRule(string $name, DOMElement|DOMDocumentFragment $node_parent) : bool
Parameters
$name : string

-- rule name

$node_parent : DOMElement|DOMDocumentFragment

-- inserts result tree here on success

Tags
throws
XParserException
Return values
bool

-- false on fail (tree result will be untouched)

matchSeq()

matches a sequence of patterns under the node, and collects the result tree.

public matchSeq(DOMElement $rule, DOMElement|DOMDocumentFragment $node_parent[, int $f = 0 ]) : bool

succeeds only if all of members suceeded consecutively

Parameters
$rule : DOMElement

-- evaluate all children of rule node

$node_parent : DOMElement|DOMDocumentFragment

-- inserts results here

$f : int = 0

-- add chars to result

Tags
throws
Exception
throws
XParserException
Return values
bool

-- false if failed

toRegExp()

Creates a delimited RegEx pattern from a bare pattern.

public static toRegExp( $pattern) : string
Parameters
$pattern :

-- pattern without delimiter

Return values
string

-- pattern with ~ delimiters and escaped inner ~s

ungetc()

public ungetc([mixed $c = '' ]) : mixed
Parameters
$c : mixed = ''

        
On this page

Search results