From 48b79a329ed631b3205c61f4f6491f73aec714c4 Mon Sep 17 00:00:00 2001 From: David Warring Date: Wed, 18 Jan 2017 19:13:30 +1300 Subject: [PATCH] fixed whitespacing handling around quantifiers --- Changes | 1 + META.info | 2 +- lib/CSS/Specification.pm | 2 +- lib/CSS/Specification/Actions.pm | 10 +++++----- lib/CSS/Specification/Build.pm | 8 ++++---- lib/t/CSS/Aural/Spec/Grammar.pm | 8 ++++---- t/00basic.t | 4 ++-- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Changes b/Changes index 6f3b2ed..0c082eb 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ +0.4.4 Fixed whitespace handling on quantifiers 0.4.3 Move test classes into lib path; t::CSS::Aural::Grammar, etc. 0.4.2 Bugfix a length can be a percentage quantity - Also reinstate t/terms.t, lost around 538f043 diff --git a/META.info b/META.info index efa4dec..3bd49a3 100644 --- a/META.info +++ b/META.info @@ -1,6 +1,6 @@ { "perl" : "6.c", "name" : "CSS::Specification", - "version" : "0.4.3", + "version" : "0.4.4", "description" : "CSS Property definition grammar and generation tools", "depends" : [ "CSS::Grammar" ], "source-url" : "git://github.com/p6-css/perl6-CSS-Specification.git", diff --git a/lib/CSS/Specification.pm b/lib/CSS/Specification.pm index b95a8b3..ba69f3f 100644 --- a/lib/CSS/Specification.pm +++ b/lib/CSS/Specification.pm @@ -39,7 +39,7 @@ grammar CSS::Specification:ver<000.04> { token id-quoted { <.quote> <.quote> } rule keyw { } rule digits { \d+ } - rule rule { '<'~'>' } + rule rule { '<'~'>' } rule terms { + } rule term-options { +% '|' } diff --git a/lib/CSS/Specification/Actions.pm b/lib/CSS/Specification/Actions.pm index e87f88f..f85f129 100644 --- a/lib/CSS/Specification/Actions.pm +++ b/lib/CSS/Specification/Actions.pm @@ -79,7 +79,7 @@ class CSS::Specification::Actions { !! @choices[0]; } - method _choose(@choices) { + method !choose(@choices) { my $choices := @choices.map({[~] ($_, ' ')}).join(' | '); return [~] '[ ', $choices, ' ]'; } @@ -88,7 +88,7 @@ class CSS::Specification::Actions { my @choices = @>>.ast; make @choices > 1 - ?? $._choose( @choices ) ~ '+' + ?? self!choose( @choices ) ~ '+' !! @choices[0]; } @@ -96,7 +96,7 @@ class CSS::Specification::Actions { my @choices = $>>.ast; make @choices > 1 - ?? [~] $._choose( @choices ), '**', @choices.Int + ?? [~] self!choose( @choices ), '**', @choices.Int !! @choices[0]; } @@ -117,11 +117,11 @@ class CSS::Specification::Actions { method occurs:sym($/) { make '*' } method occurs:sym($/) { my $quant = $ ?? $.ast !! '+'; - make " {$quant}% " + make "{$quant}% " } method occurs:sym($/) { make $.ast } method range($/) { - my $range = '**' ~ $.ast; + my $range = ' ** ' ~ $.ast; $range ~= '..' ~ $.ast if $; diff --git a/lib/CSS/Specification/Build.pm b/lib/CSS/Specification/Build.pm index 9ebd89c..56e830f 100755 --- a/lib/CSS/Specification/Build.pm +++ b/lib/CSS/Specification/Build.pm @@ -130,7 +130,7 @@ module CSS::Specification::Build { with $def -> @props { my $perl6 = $def; my $synopsis = $def; - my $box = $perl6 ~~ / '**1..4' $/; + my $box = $perl6 ~~ /:s '**' '1..4' $/; for @props -> $name { my %details = :$name, :$synopsis; @@ -184,13 +184,13 @@ module CSS::Specification::Build { my $synopsis = $def; # boxed repeating property. repeat the expr - my $box = $perl6 ~~ / '**1..4' $/ + my $box = $perl6 ~~ /:s '**' '1..4' $/ ?? ', :box' !! ''; my $repeats = ''; if $box { - $perl6 ~~ s/ '**1..4' $//; - $repeats = '**1..4'; + $perl6 ~~ s/:s '**' '1..4' $//; + $repeats = ' ** 1..4'; } for @props -> $prop { diff --git a/lib/t/CSS/Aural/Spec/Grammar.pm b/lib/t/CSS/Aural/Spec/Grammar.pm index 68c4816..77e2ed6 100644 --- a/lib/t/CSS/Aural/Spec/Grammar.pm +++ b/lib/t/CSS/Aural/Spec/Grammar.pm @@ -26,7 +26,7 @@ grammar t::CSS::Aural::Spec::Grammar { #| pause: [ [