Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

PHPTAL_Parser Class Reference

Inheritance diagram for PHPTAL_Parser:

Inheritance graph
[legend]
Collaboration diagram for PHPTAL_Parser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 parse ($file, $src)
 generateCode ($func_name)
 toString ()
 _initRoot ()
 _push (&$tag)
 _pushChild (&$tag)
 _pop ()
 _outputMode ($mode=false)
 onElementStart ($name, $attributes)
 extendZptBlockAttributes ($domain, $attributes)
 onElementData ($data)
 onSpecific ($data)
 onElementClose ($name)
 _raiseAttributeNotFound ($att, $class)
 _raiseUnknownAttribute ($att)
 _raiseUnexpectedTagClosure ($name)
 _raiseNoTagExpected ($name)
 _raiseAttConflict ($a2, $a1)

Static Public Member Functions

 TemplateAttributes ($attrs)
 OrderTemplateAttributes (&$phptal)

Public Attributes

 $_root
 $_headers = false
 $_started = false
 $_docType
 $_inDocType
 $_current
 $_file
 $_outputFormat = PHPTAL_XHTML
 $_keepXMLNS = false

Detailed Description

PHPTAL template parser.

This object implements PHPTAL_XML_Parser interface and will accept only well formed xml templates.

Parser object has two aims :

Once this job is accomplished, the parser object should be destroyed and MUST NOT be used to parse another template. It's a one time and drop object.

Note about code generation :

The final source code is ready to write into a php file.

The code generation process requires a function name which should represent the template unique id (Template class makes an md5 over the source file path to create this id).

Version:
0.1
Author:
Laurent Bedubourg <laurent.bedubourg@free.fr>

Definition at line 86 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.


Member Function Documentation

PHPTAL_Parser::_initRoot  ) 
 

Initialize root node.

private

Definition at line 175 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

Referenced by parse().

PHPTAL_Parser::_outputMode mode = false  ) 
 

Definition at line 229 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _outputMode().

Referenced by _outputMode().

PHPTAL_Parser::_pop  ) 
 

Pop the last node (go up a level in tree).

private

Definition at line 212 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

Referenced by onElementClose().

PHPTAL_Parser::_push &$  tag  ) 
 

Push a node as the current one.

Parameters:
PHPTAL_Node tag private

Definition at line 189 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _push().

Referenced by _push().

PHPTAL_Parser::_pushChild &$  tag  ) 
 

Push a node into the current one.

Parameters:
PHPTAL_Node tag private

Definition at line 202 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _pushChild().

Referenced by _pushChild().

PHPTAL_Parser::_raiseAttConflict a2,
a1
 

Definition at line 488 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _raiseAttConflict().

Referenced by _raiseAttConflict(), and OrderTemplateAttributes().

PHPTAL_Parser::_raiseAttributeNotFound att,
class
 

Definition at line 452 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _raiseAttributeNotFound().

Referenced by _raiseAttributeNotFound(), and OrderTemplateAttributes().

PHPTAL_Parser::_raiseNoTagExpected name  ) 
 

Definition at line 479 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _raiseNoTagExpected().

Referenced by _raiseNoTagExpected(), and onElementClose().

PHPTAL_Parser::_raiseUnexpectedTagClosure name  ) 
 

Definition at line 469 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _raiseUnexpectedTagClosure(), and name.

Referenced by _raiseUnexpectedTagClosure(), and onElementClose().

PHPTAL_Parser::_raiseUnknownAttribute att  ) 
 

Definition at line 461 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _raiseUnknownAttribute().

Referenced by _raiseUnknownAttribute(), and TemplateAttributes().

PHPTAL_Parser::extendZptBlockAttributes domain,
attributes
 

Extends ZPT attributes withing a *:block element so these attributes can be used by phptal parser.

private

Definition at line 293 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References $_phptal_dictionary, and extendZptBlockAttributes().

Referenced by extendZptBlockAttributes(), and onElementStart().

PHPTAL_Parser::generateCode func_name  ) 
 

Generate php code.

After template parsing, this method must be called to generate php code from the template tree.

Parameters:
string func_name The template function name
private
Returns:
string

Definition at line 138 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References generateCode().

Referenced by generateCode().

PHPTAL_Parser::onElementClose name  ) 
 

xml callback

private

Reimplemented from PHPTAL_XML_Parser.

Definition at line 345 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _pop(), _raiseNoTagExpected(), _raiseUnexpectedTagClosure(), name, and onElementClose().

Referenced by onElementClose().

PHPTAL_Parser::onElementData data  ) 
 

xml callback

private

Reimplemented from PHPTAL_XML_Parser.

Definition at line 311 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References data, and onElementData().

Referenced by onElementData().

PHPTAL_Parser::onElementStart name,
attributes
 

xml callback

private

Reimplemented from PHPTAL_XML_Parser.

Definition at line 246 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References $_phptal_namespaces, extendZptBlockAttributes(), PHPTAL_XML_Parser::getLineNumber(), name, onElementStart(), OrderTemplateAttributes(), and TemplateAttributes().

Referenced by onElementStart().

PHPTAL_Parser::onSpecific data  ) 
 

xml callback

private

Reimplemented from PHPTAL_XML_Parser.

Definition at line 326 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References data, and onSpecific().

Referenced by onSpecific().

PHPTAL_Parser::OrderTemplateAttributes &$  phptal  )  [static]
 

Order phptal attributes array using $_phptal_rules_order array.

1 private

Parameters:
array phptal Array of phptal attributes (will be modified)

Definition at line 416 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References $_phptal_dictionary, $_phptal_rules_order, _raiseAttConflict(), _raiseAttributeNotFound(), name, and OrderTemplateAttributes().

Referenced by onElementStart(), and OrderTemplateAttributes().

PHPTAL_Parser::parse file,
src
 

Parse a template string.

Parameters:
string $file The template source file.
string $src The template source.
Exceptions:
PHPTAL_ParseError 

Definition at line 119 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References _initRoot(), and parse().

Referenced by parse().

PHPTAL_Parser::TemplateAttributes attrs  )  [static]
 

Lookup template attributes in given hashtable.

This method separate xml attributes from template attributes and return an array composed of the array of formers and the array of laters.

private 1

Parameters:
hashtable attrs Attributes hash
Returns:
array

Definition at line 375 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

References $_phptal_aliases, $_phptal_dictionary, $_phptal_namespaces, _raiseUnknownAttribute(), sns(), and TemplateAttributes().

Referenced by onElementStart(), and TemplateAttributes().

PHPTAL_Parser::toString  ) 
 

Return a string representation of the underlying xhtml tree.

This method is for debug purpose.

private

Returns:
string

Definition at line 157 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.


Member Data Documentation

PHPTAL_Parser::$_current
 

Definition at line 98 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_docType
 

Definition at line 94 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_file
 

Reimplemented from PHPTAL_XML_Parser.

Definition at line 101 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_headers = false
 

Definition at line 91 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_inDocType
 

Definition at line 95 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_keepXMLNS = false
 

Definition at line 107 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_outputFormat = PHPTAL_XHTML
 

Definition at line 104 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_root
 

Definition at line 89 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.

PHPTAL_Parser::$_started = false
 

Definition at line 92 of file PHPTAL-NP-0.7.0/libs/PHPTAL/Parser.php.


The documentation for this class was generated from the following file:
Generated on Tue Jun 29 23:40:59 2004 for Mediawiki by doxygen 1.3.7