our %counters;
sub new { my ($class, $ele, $ins, $val, $aid) = @_;
- my $priority = ($val =~ s/$meta_has_priority/""/sexi)?2:($val =~ s/$meta_process_last/""/sexi)?5:3;
+ my $priority;
+ if($val =~ s/$meta_has_priority/""/sexi){
+ $priority = 2
+ }elsif($val =~ s/$meta_process_last/""/sexi){
+ $priority = 3
+ }else{
+ $priority = 5;
+ }
$val =~ s/$meta_priority/""/sexi;
$priority = $2 if $2;
my $dataItemCounter;
if(!$p){
$p = $itm;
}else{
- $itm =~ s/^\s*(['"])(.*)\g{1}$/$2/g if $itm;
+ $itm =~ s/^\s*(['"])(.*)\g{1}$/$2/g if $itm; $itm =~ s/\s*$//;
$self->{$p}=$itm;
undef $p;
}
}
$includes[@includes] = {script=>$v,local=>$CUR_SCRIPT,loaded=>0, prc_last=>$prc_last};
}elsif($t eq 'TREE'){
- my $tree = 0;
+ my $tree = 0;
if( !$v ){
$v = $e;
$e = CNFMeta::ANN();
}
}
elsif($t eq 'MACRO'){
- $instructs{$e}=$v;
+ $instructs{$e}= "$v"; #Forcing into an string type by purpose.
}
elsif($t eq APP_STS){
$self->instructPlugin(InstructedDataItem -> new($e, APP_STS, $v));
$struct = $$struct;
$type = ref($struct);
}
- if($type eq 'String'){
+ if($type eq 'String'||$type eq ''){
my $v = $struct;
my @arr = ($v =~ m/(\$\$\$.+?\$\$\$)/gm);
foreach my $find(@arr) {# <- MACRO TAG translate. ->
}
@items = sort {$a->{'^'} <=> $b->{'^'}} @items; #sort by priority;
-
- for my $idx(0..$#items-1) {
+ my @splice;
+ for my $idx(0..$#items) {
my $struct = $items[$idx];
my $type = ref($struct);
if(not $type){
CNFParserException->throw("Illegal struct encountered->$struct") if $struct
}else{
my $priority = $struct-> {'^'};
- if($type eq 'CNFNode' && $priority > 0){
+ if($type eq 'CNFNode' && $priority > 0 && $priority < 5){
$struct->validate() if $self->{ENABLE_WARNINGS};
if($struct->name() eq CNFMeta::ANN()){
my $anode = $struct->process($self, $struct->script());
$anechoic ->{$struct->name()} = $struct->process($self, $struct->script());
$self->log("Processed -> ".$struct->name()) if $self->{DEBUG}
}
- splice @items, $idx, 1
+ $splice[@splice] = $idx - @splice;
}elsif($type eq 'InstructedDataItem' && $priority > 0 && $priority < 5){
my $t = $struct->{ins};
if($t eq 'PLUGIN'){
- instructPlugin($self, $struct);
- splice @items, $idx, 1
+ instructPlugin($self, $struct);
+ $splice[@splice] = $idx - @splice;
}
}
}
}
+
+ foreach my $i(@splice){ splice(@items, $i, 1) }
+
#Now only what is left instructed data items or plugins, and nodes that have assigned last priority, if any.
for my $idx(0..$#items) {
my $struct = $items[$idx];
1. Reserved words relate to instructions, that are specially treated, and interpreted by the parser to perform extra or specifically processing on the current value.
2. Reserved instructions can't be used for future custom ones, and also not recommended tag or property names.
3. Current Reserved words list is.
- - CONST - Concentrated list of constances, or individaly tagged name and its value.
- - VARIABLE - Concentrated list of anons, or individaly tagged name and its value.
+ - CONST - Concentrated list of constances, or individally tagged name and its value.
+ - VARIABLE - Concentrated list of anons, or individually tagged name and its value.
- DATA - CNF scripted delimited data property, having uniform table data rows.
- DATE - Translate PerlCNF date representation to DateTime object. Returns now() on empty property value.
- FILE - CNF scripted delimited data property is in a separate file.
- %LOG - Log settings property, i.e. enabled=>1, console=>1.
- TABLE - SQL related.
- - TREE - Property is a CNFNode tree containing multiple debth nested children nodes.
+ - TREE - Property is a CNFNode tree containing multiple depth nested children nodes.
- INCLUDE - Include properties from another file to this repository.
- INDEX - SQL related.
- INSTRUCT - Provides custom new anonymous instruction.
2. Parsing abruptly stops if this abstract property specified is not found.
3. Macro format specifications, have been aforementioned in this document. However make sure that your macro an constant also including the *$* signifier if desired.
- APP_SETTINGS - Provides external expected application settings defaults to the configuration.
- 1. These are added and processed in place as they appear sequentionaly in the script.
+ 1. These are added and processed in place as they appear sequentially in the script.
1. It can be made possible in the future, to meta instruct to run APP_SETTING at the processing or post processing stages of CNF parsing.
2. These can be externally added constance type CNF items if are found missing or not specified in current cnf file or from includes.
3. An application usually obtains its settings object as an CNF property. Decoupling the CNF from handling this, making it abstract to the parser.
}
my $macro_instructions = $self -> {instructions};
if($macro_instructions){
- my $tree = $parser->anon($macro_instructions);
+ my $tree = $parser->anon($macro_instructions);
+ MarkdownPluginException->throw(qq("Tree for instructions not visible or missing for:
+ $macro_instructions in -> $parser->{CNF_CONTENT})) if not $tree;
my $links = $tree->node('links');
foreach my $link($links->nodes()){
my $tag = $link->name();
$script =~ s/\[\$\$\$\[\s*$tag\s*\]\$\$\$\]/$rep/gex
}
- my $images = $tree->node('links');
+ my $images = $tree->node('images');
foreach my $img($images->nodes()){
my $tag = $img->name();
my $rep = "";
$script =~ s/\[\$\$\$\[\s*$tag\s*\]\$\$\$\]/$rep/gex
}
+ my $particulars = $tree->node('particulars');
+ foreach my $item(@{$particulars->list()}){
+ my $tag = $item->{tag};
+ MarkdownPluginException->throw(qq("Instructions particular not visible or missing for:
+ $item->name() in -> $parser->{CNF_CONTENT})) if not $tag;
+ my $rep = $parser->collections()->{$tag}; $rep = $$rep->val();
+ $script =~ s/\[\$\$\$\[\s*$tag\s*\]\$\$\$\]/$rep/gex
+ }
+
my $val = $tree->val();
if($val){