Embperl
view release on metacpan or search on metacpan
Embperl/Syntax.pm view on Meta::CPAN
Defines the default type for text nodes. Without any specification the type
is CDATA, which mean no escaping takes places. With C<ntypText> all special
characters are escaped.
=item '-rootnode'
Name for a root node to insert always.
=item <name> => \%tokendescription
All items which does not start with a slash are treated as names. The name
of a token is only descriptive and is used in error messages. The item must
contain a hashref which describes the token.
=back
=head2 Tokendescription
Each token can have the following members:
=over 4
=item 'text' => '<'
Start text
=item 'end' => '>'
End text
=item 'matchall'
when set to 1 new token starts at next character, when set to -1 new token
starts at next character, but only if it is the first token inside another one.
=item 'nodename'
Text that should be outputed when node is stringifyed. Defaults to text.
If the first character is a ':' you can specify the sourounding delimiters for this
tag with :<start>:<end>:<text>:<endtag>. Example: ':{:}:NAME' .
If the nodename starts with a '!' a unique internal id is generated, so two or more
nodename of the same text, can have different meaning in different contexts.
=item 'contains' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789'
Token consists of the following characters. Either C<start> and C<end> B<or> C<contains>
could be specified.
NOTE: If a item that only specfifies contains but no text should be compiled, you must
specfify a nodname.
=item 'unescape' => 1
If C<optRawInput> isn't set unescape the data of the inside the node
=item 'nodetype' => ntypEndTag
Type of the node
=item 'cdatatype' => ntypAttrValue
Type of nodes for data (which is not matched by 'inside' definitions) inside
this node. Set to zero to not generate any nodes for text inside of this node,
other then these that are matched by a 'inside' definition.
=item 'endtag'
Name of the tag that marks the end of a block. This is used by the parser
to track correct nesting.
=item 'follow' => \%tokenlist
Hashref that specifices one or more tokens that must follow this token.
=item 'inside' => \%tokenlist
Hashref that specifices one or more tokens that could occur inside
a node that is started with this token.
=item exitinside
when the token found, the parser stop searching in the current level and continues
with the tokens that are defined in the hash from there the current one was "called"
via inside
=item donteat
set to 1 to don't eat the start text, so it will be matched again, by any tokens
set under C<inside>. Set 2 to don't the end text. Set to 3 for both.
=item 'procinfo' =>
Processor info. Hashref with information how to process this token.
=back
=head2 Processor info
The processor info gives information how to compile this token to valid
code that can be executed later on by the processor. There could be
information for multiple processors. At the moment only the I<embperl>
processor is defined. Normally you must not worry about different
processor, because the syntax object knows inside that all procinfo is
for the I<embperl> processor. I<procinfo> is a parameter to many methods,
it is a hashref and can take the following items:
=over 4
=item perlcode => <string> or <arrayref>
Code to generate. You can also specify a arrayref of strings.
The first string which contains matching attributes are used.
The following special strings are replaced:
=over 4
=item %#<N>%
Embperl/Syntax.pm view on Meta::CPAN
=item 5
Remove all spaces and tabs but one before tag
=item 6
Remove all whihe space after text inside of tag
=item 7
Remove spaces and tabs after text inside of tag
=back
=item mayjump => 0/1
If set, tells the compiler that this code may jump to another program location.
(e.g. if, while, goto etc.).
Could also be a condition as described under perlcode.
=item compilechilds => 0/1
Compile child nodes. Default: 1
=item stackname => <name>
Name of stack for C<push>, C<stackmatch>
=item stackname2 => <name>
Name of stack for C<push2>
=item push => <value>
Push value on stack which name is given with C<stackname>. Value could
include the same specical values as C<perlcode>
=item push2 => <value>
Push value on stack which name is given with C<stackname2>. Value could
include the same specical values as C<perlcode>
=item stackmatch => <value>
Check if value on stack which name is given with C<stackname> is the
same as the given value. If not give a error message about tag mismatch. Value could
include the same specical values as C<perlcode>
=item switchcodetype => <1/2>
1 means put the following code into normal code which is executed every time the page is
requested
2 means put the following code put into code which is executed direct after compilation.
This is mainly for defining subs, or using modules etc.
=item addflags
=item cdatatype
=item forcetype
=item insidemustexist
=item matchall
=item exitinside
=item addfirstchild
=item starttag
=item endtag
=item parsetimeperlcode
=item contains
=back
( run in 1.160 second using v1.01-cache-2.11-cpan-39bf76dae61 )