From: Will Budic Date: Fri, 6 Mar 2026 02:14:56 +0000 (+1100) Subject: v.3.3.7 Update and new dev. for CNF type for constance's transitioning started. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=2a459e9a15be60612669d3b1c0468b14c17354b9;p=PerlCNF.git v.3.3.7 Update and new dev. for CNF type for constance's transitioning started. --- diff --git a/system/modules/CNFParser.pm b/system/modules/CNFParser.pm index 44f22fb..f3e82fe 100644 --- a/system/modules/CNFParser.pm +++ b/system/modules/CNFParser.pm @@ -10,7 +10,7 @@ use strict;use warnings; no warnings 'once'; use Hash::Util qw(lock_hash unlock_hash); -use constant VERSION => '3.3.6'; +use constant VERSION => '3.3.7'; use constant APP_STS => 'APP_SETTINGS'; use constant APP_ARGS => 'ARGUMENTS'; @@ -319,14 +319,16 @@ sub anon { my ($self, $n, $args)=@_; ### # Validates and returns a constant named value as part of this configs instance. -# Returns undef if it doesn't exist, and exception if constant required is set; +# Returns undef if it doesn't exist, or empty and an exception +# if constant required argument is set for this repository. +### sub const { my ($self,$c)=@_; - return $self->{$c} if exists $self->{$c}; + return $self->{$c} if exists $self->{$c} && $self->{$c} !~ m/\s*/s ; if ($CONSTREQ){CNFParserException->throw("Required constants variable ' $c ' not defined in config!")} # Let's try to resolve. As old convention makes constants have a '$' prefix all upprercase. $c = '$'.$c; return $self->{$c} if exists $self->{$c}; - return; + return undef; } ### # Validates if this repository contains expected and required constant. @@ -433,13 +435,12 @@ sub addENVList { my ($self, @vars) = @_; }return; } - # #private to parser sub. sub doProcessCollection{ my($self,$e,$t,$v) = @_; my $isArray = $t=~ m/^@/; my $IsConstant = ($v =~ s/$meta_const/""/sexi); - my @lst = ($v =~ s/$meta_delimited// && $isArray?split(DELIMITER(), $v):split('\n', $v)); + my @lst = ($v =~ s/$meta_delimited// || $isArray?split(DELIMITER(), $v):split('\n', $v)); my @props = map { s/^\s+|\s+$//; # strip unwanted spaces s/^\s*["']|['"]$//g;#strip quotes @@ -473,10 +474,10 @@ sub doProcessCollection{ my($self,$e,$t,$v) = @_; foreach my $p(@props){ if($p && $p eq 'MACRO'){$macro=1} elsif( $p && length($p)>0 ){ - my @pair = ($p=~/\s*([-+_\w]*)\s*[=:]\s*(.*)/s);#split(/\s*=\s*/, $p); + my @pair = ($p=~ m/\s*(^[.]\w*|[-+_\w]*)\s*[=:]\s*(.*)\s*/);#($p=~/\s*([-+_\w]*)\s*[=:]\s*(.*)/s); next if (@pair != 2 || $pair[0] =~ m/^[#\\\/]+/m);#skip, it is a comment or not '=' delimited line. my $name = $pair[0]; - my $value = $pair[1]; $value =~ s/^\s*["']|['"]$//g;#strip quotes + my $value = $pair[1]; $value =~ s/^\s*["']|['" ]$//;#strip quotes and trailing space if($IsConstant && $p =~ m/\$[A-Z]+/){# if meta constant we check $p if signified to transfer into a CNF constance. if(not exists $self->{$name}){ $self->{$name} = $value; @@ -864,7 +865,7 @@ sub parse { my ($self, $cnf_file, $content, $del_keys) = @_; $line =~ s/^\s+|\s+$//; # strip unwanted spaces $line =~ s/\s*#.*$//; #strip comment for end of line. $line =~ s/\s*>$//; - $line =~ m/([\$\w]*)(\s*=\s*)(.*)/g; + $line =~ m/([\$\w<>]*)(\s*=\s*)(.*)/; my $name = $1; $line = $3; @@ -874,12 +875,15 @@ sub parse { my ($self, $cnf_file, $content, $del_keys) = @_; if($isVar && not $isMETAConst){ $anechoic ->{$name} = $line if $line }else{ - $name =~ s/^\$// if $isMETAConst; + $name =~ s/^\$// if $isMETAConst; + if($name =~ m/^<(.*)>$/){ + $name = $1; $line = CNF::_isTrue($line); + } # It is NOT allowed to overwrite a constant, so check and issue warning. if(not exists $self->{$name}){ $self->{$name} = $line; }else{ - $self->warn("Skipped constant reassignment for '$name'."); + $self->warn("Skipped constant reassignment for '$name' previous exists."); } } } diff --git a/tests/stagging/test.css b/tests/stagging/test.css new file mode 100644 index 0000000..11d98b6 --- /dev/null +++ b/tests/stagging/test.css @@ -0,0 +1,65 @@ +.window-list-item-box { + padding: 0 6px; + color: #ffffffcc; + background-color: #e0d3d3; + background-gradient-start: #e0d3d3; + background-gradient-end: #3c2e2e; +} + +.window-list-item-box.top, +.window-list-item-box.bottom { + border-bottom-width: 2px; +} + +.window-list-item-box.top StLabel, +.window-list-item-box.bottom StLabel { + padding-left: 2px; +} + +.window-list-item-box.right { + padding-left: 0; + padding-right: 0; + border-right-width: 2px; +} + +.window-list-item-box.right StBin { + padding-right: 0; + padding-left: 5px; +} + +.window-list-item-box.left { + padding-left: 0; + padding-right: 0; + border-left-width: 2px; +} + +.window-list-item-box.left StBin { + padding-left: 0; + padding-right: 5px; +} + +.window-list-item-box:hover { + background-color: #393939; +} + +.window-list-item-box:focus { + border-color: #3584e4; + background-color: ` +} + +.window-list-item-box .progress { + background-color: rgba(143, 240, 164, 0.8); +} + +.window-list-item-demands-attention { + background-color: #ff7b63; +} + +.window-list-preview { + border: 1px solid #333333; + background-color: #242424; + border-radius: 8px; + padding: 12px; + spacing: 4px; + box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.5); +} \ No newline at end of file diff --git a/tests/testCNFCollections.pl b/tests/testCNFCollections.pl index c310b11..ce5cdbe 100644 --- a/tests/testCNFCollections.pl +++ b/tests/testCNFCollections.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -use warnings; use strict; +use warnings; use strict; use Syntax::Keyword::Try; use lib::relative ('.','../system/modules'); @@ -7,7 +7,7 @@ require CNFParser; require TestManager; my $test = TestManager -> new($0); my $cnf; -try{ +try{ ### # Test instance creation. @@ -24,40 +24,47 @@ try{ 1,2,3 4,5 6 >> -<<%A$$<%> +<<%A$$<%> hello = "world" ask: How are you today? >> )); $test->case("Passed new instance CNFParser.",'1'); $test->subcase('CNFParser->VERSION is '.CNFParser->VERSION); - # + # $test-> nextCase(); # $test->case("Test array.",'2'); my @array1 = $cnf -> property('@array1'); - $test->evaluate('Array has 4 elements?',scalar(@array1),4); + $test->evaluate('@array1 has 4 elements?',scalar(@array1),4); + $test->evaluate('@array1 contains "1 2 3 4"?',"@array1", "1 2 3 4"); + $test->evaluate('@array1[0] is 1?',$array1[0], 1); + my @array2 = $cnf -> property('@array2'); - $test->evaluate('Array has 1 element?',scalar(@array2),1); - $test->evaluate('Array[0] has value 1 2 3 4?',$array2[0],"1 2 3 4"); + #change since v.3.3.7 string is split based on CNFMeta::DELIMITER. + $test->evaluate('@array2 has 4 elements?',scalar(@array2),4); + $test->evaluate('@array2[0] is 1?',$array2[0], 1); + $test->evaluate('pop @array2[last] is 4?',pop @array2, 4); + $test->evaluate('array2 is now joined "123"?',"@array2", "1 2 3"); + my @A0 = $cnf -> property('@A0'); - $test->evaluate('Array has 6 elements?',scalar(@A0),6); - # + $test->evaluate('Array has 6 elements?',scalar(@A0),6); + # $test-> nextCase(); # $test->case("Test as a hash property.",'3'); my %A1 = $cnf -> property('@A1'); - $test->evaluate('Hash has two keys?',scalar(keys %A1),2); - $test->evaluate('hello eq "world"?',$A1{hello},'world'); - $test->evaluate('ask eq "How are you today?"?',$A1{ask},'How are you today?'); - - - # - $test->done(); + $test->evaluate('Hash has two keys?',scalar(keys %A1),2); + $test->evaluate('hello eq "world"?',$A1{hello},'world'); + $test->evaluate('ask eq "How are you today?"?',$A1{ask},'How are you today?'); + + + # + $test->done(); # } -catch{ - $test -> dumpTermination($@); +catch{ + $test -> dumpTermination($@); $test -> doneFailed(); }