Skip to content

Commit cd187ea

Browse files
committed
Adjust to latest RakuAST
1 parent e6d8ab4 commit cd187ea

File tree

3 files changed

+31
-33
lines changed

3 files changed

+31
-33
lines changed

lib/CSS/Specification/Compiler/RakuAST/Grammars.rakumod

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ sub property-decl(Str:D $prop-name) {
3838
body => seq (
3939
'i'.&modifier,
4040
RakuAST::Regex::CapturingGroup.new(
41-
(
42-
$prop-name.&lit,
43-
).&seq
41+
( $prop-name.&lit, ).&seq
4442
).&ws,
4543
RakuAST::Regex::Quote.new(
4644
RakuAST::QuotedString.new(
@@ -194,7 +192,7 @@ sub seen(Int:D $id) is export {
194192
my RakuAST::Var $operand = '@S'.&lexical;
195193
my RakuAST::Block $block .= new(
196194
body => RakuAST::Blockoid.new(
197-
RakuAST::StatementList.new(
195+
statements(
198196
expression $operand.&postfix($op).&postfix(
199197
RakuAST::Postfix.new(operator => "++")
200198
)
@@ -274,11 +272,11 @@ method build-grammar(@grammar-id) {
274272
my RakuAST::Name $name .= from-identifier-parts(|@grammar-id);
275273
my RakuAST::Statement::Expression @compiled = flat @.defs.map: &compile;
276274
my RakuAST::StatementList $statements .= new: |@compiled;
277-
my RakuAST::Blockoid $body .= new: |$statements;
275+
my RakuAST::Block $body .= new: :body(RakuAST::Blockoid.new: $statements);
278276

279277
RakuAST::Grammar.new(
280278
:$name,
281279
:scope<unit>,
282-
body => RakuAST::Block.new(:$body),
280+
:$body,
283281
);
284282
}

t/00compile.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ for (
120120
deparse => join("\n",
121121
'#| <length> | <percentage> | inherit',
122122
'rule decl:sym<min-width> {;',
123-
':i ("min-width") ":" <val(/ <expr=.expr-min-width> /, &?ROUTINE.WHY)> }',
123+
':i ("min-width") ":" <val(/<expr=.expr-min-width> /, &?ROUTINE.WHY)> }',
124124
'rule expr-min-width { :i <length> | <percentage> | [inherit & <keyw>] }',
125125
''),
126126
},
@@ -140,7 +140,7 @@ for (
140140
deparse => join("\n",
141141
'#| normal | none | [ <string> | <uri> | <counter> | attr(<identifier>) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit',
142142
'rule decl:sym<content> {;', # stray semicolon?
143-
':i (content) ":" <val(/ <expr=.expr-content> /, &?ROUTINE.WHY)> }',
143+
':i (content) ":" <val(/<expr=.expr-content> /, &?ROUTINE.WHY)> }',
144144
'rule expr-content { :i [[normal | none ]& <keyw>] | [<string> | <uri> | <counter> | <attr> | [["open-quote" | "close-quote" | "no-open-quote" | "no-close-quote" ]& <keyw>] ]+ | [inherit & <keyw>] }',
145145
''
146146
),
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
unit grammar Test::CSS::Aural::Spec::Grammar;
22
#| <angle> | [[ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards
33
rule decl:sym<azimuth> {;
4-
:i (azimuth) ":" <val(/ <expr=.expr-azimuth> /, &?ROUTINE.WHY)> }
4+
:i (azimuth) ":" <val(/<expr=.expr-azimuth> /, &?ROUTINE.WHY)> }
55
rule expr-azimuth { :i <angle> | [[:my @S;
66
; [[["left-side" | "far-left" | left | "center-left" | center | "center-right" | right | "far-right" | "right-side" ]& <keyw>]]<!{
77
@S[0]++
@@ -10,15 +10,15 @@ rule expr-azimuth { :i <angle> | [[:my @S;
1010
}>]+] | [[leftwards | rightwards ]& <keyw>] }
1111
#| <uri> | none
1212
rule decl:sym<cue-after> {;
13-
:i ("cue-after") ":" <val(/ <expr=.expr-cue-after> /, &?ROUTINE.WHY)> }
13+
:i ("cue-after") ":" <val(/<expr=.expr-cue-after> /, &?ROUTINE.WHY)> }
1414
rule expr-cue-after { :i <uri> | [none & <keyw>] }
1515
#| <uri> | none
1616
rule decl:sym<cue-before> {;
17-
:i ("cue-before") ":" <val(/ <expr=.expr-cue-before> /, &?ROUTINE.WHY)> }
17+
:i ("cue-before") ":" <val(/<expr=.expr-cue-before> /, &?ROUTINE.WHY)> }
1818
rule expr-cue-before { :i <uri> | [none & <keyw>] }
1919
#| [ 'cue-before' || 'cue-after' ]
2020
rule decl:sym<cue> {;
21-
:i (cue) ":" <val(/ <expr=.expr-cue> /, &?ROUTINE.WHY)> }
21+
:i (cue) ":" <val(/<expr=.expr-cue> /, &?ROUTINE.WHY)> }
2222
rule expr-cue { :i [[:my @S;
2323
; <expr-cue-before><!{
2424
@S[0]++
@@ -27,31 +27,31 @@ rule expr-cue { :i [[:my @S;
2727
}>]+] }
2828
#| <angle> | below | level | above | higher | lower
2929
rule decl:sym<elevation> {;
30-
:i (elevation) ":" <val(/ <expr=.expr-elevation> /, &?ROUTINE.WHY)> }
30+
:i (elevation) ":" <val(/<expr=.expr-elevation> /, &?ROUTINE.WHY)> }
3131
rule expr-elevation { :i <angle> | [[below | level | above | higher | lower ]& <keyw>] }
3232
#| [ [<time> | <percentage>]{1,2} ]
3333
rule decl:sym<pause> {;
34-
:i (pause) ":" <val(/ <expr=.expr-pause> /, &?ROUTINE.WHY)> }
34+
:i (pause) ":" <val(/<expr=.expr-pause> /, &?ROUTINE.WHY)> }
3535
rule expr-pause { :i [[<time> | <percentage> ]** 1..2] }
3636
#| <time> | <percentage>
3737
rule decl:sym<pause-after> {;
38-
:i ("pause-after") ":" <val(/ <expr=.expr-pause-after> /, &?ROUTINE.WHY)> }
38+
:i ("pause-after") ":" <val(/<expr=.expr-pause-after> /, &?ROUTINE.WHY)> }
3939
rule expr-pause-after { :i <time> | <percentage> }
4040
#| <time> | <percentage>
4141
rule decl:sym<pause-before> {;
42-
:i ("pause-before") ":" <val(/ <expr=.expr-pause-before> /, &?ROUTINE.WHY)> }
42+
:i ("pause-before") ":" <val(/<expr=.expr-pause-before> /, &?ROUTINE.WHY)> }
4343
rule expr-pause-before { :i <time> | <percentage> }
4444
#| <number>
4545
rule decl:sym<pitch-range> {;
46-
:i ("pitch-range") ":" <val(/ <expr=.expr-pitch-range> /, &?ROUTINE.WHY)> }
46+
:i ("pitch-range") ":" <val(/<expr=.expr-pitch-range> /, &?ROUTINE.WHY)> }
4747
rule expr-pitch-range { :i <number> }
4848
#| <frequency> | x-low | low | medium | high | x-high
4949
rule decl:sym<pitch> {;
50-
:i (pitch) ":" <val(/ <expr=.expr-pitch> /, &?ROUTINE.WHY)> }
50+
:i (pitch) ":" <val(/<expr=.expr-pitch> /, &?ROUTINE.WHY)> }
5151
rule expr-pitch { :i <frequency> | [["x-low" | low | medium | high | "x-high" ]& <keyw>] }
5252
#| <uri> [ mix || repeat ]? | auto | none
5353
rule decl:sym<play-during> {;
54-
:i ("play-during") ":" <val(/ <expr=.expr-play-during> /, &?ROUTINE.WHY)> }
54+
:i ("play-during") ":" <val(/<expr=.expr-play-during> /, &?ROUTINE.WHY)> }
5555
rule expr-play-during { :i <uri> [[:my @S;
5656
; [mix & <keyw>]<!{
5757
@S[0]++
@@ -60,35 +60,35 @@ rule expr-play-during { :i <uri> [[:my @S;
6060
}>]+]? | [[auto | none ]& <keyw>] }
6161
#| <number>
6262
rule decl:sym<richness> {;
63-
:i (richness) ":" <val(/ <expr=.expr-richness> /, &?ROUTINE.WHY)> }
63+
:i (richness) ":" <val(/<expr=.expr-richness> /, &?ROUTINE.WHY)> }
6464
rule expr-richness { :i <number> }
6565
#| normal | none | spell-out
6666
rule decl:sym<speak> {;
67-
:i (speak) ":" <val(/ <expr=.expr-speak> /, &?ROUTINE.WHY)> }
67+
:i (speak) ":" <val(/<expr=.expr-speak> /, &?ROUTINE.WHY)> }
6868
rule expr-speak { :i [[normal | none | "spell-out" ]& <keyw>] }
6969
#| once | always
7070
rule decl:sym<speak-header> {;
71-
:i ("speak-header") ":" <val(/ <expr=.expr-speak-header> /, &?ROUTINE.WHY)> }
71+
:i ("speak-header") ":" <val(/<expr=.expr-speak-header> /, &?ROUTINE.WHY)> }
7272
rule expr-speak-header { :i [[once | always ]& <keyw>] }
7373
#| digits | continuous
7474
rule decl:sym<speak-numeral> {;
75-
:i ("speak-numeral") ":" <val(/ <expr=.expr-speak-numeral> /, &?ROUTINE.WHY)> }
75+
:i ("speak-numeral") ":" <val(/<expr=.expr-speak-numeral> /, &?ROUTINE.WHY)> }
7676
rule expr-speak-numeral { :i [[digits | continuous ]& <keyw>] }
7777
#| code | none
7878
rule decl:sym<speak-punctuation> {;
79-
:i ("speak-punctuation") ":" <val(/ <expr=.expr-speak-punctuation> /, &?ROUTINE.WHY)> }
79+
:i ("speak-punctuation") ":" <val(/<expr=.expr-speak-punctuation> /, &?ROUTINE.WHY)> }
8080
rule expr-speak-punctuation { :i [[code | none ]& <keyw>] }
8181
#| <number> | x-slow | slow | medium | fast | x-fast | faster | slower
8282
rule decl:sym<speech-rate> {;
83-
:i ("speech-rate") ":" <val(/ <expr=.expr-speech-rate> /, &?ROUTINE.WHY)> }
83+
:i ("speech-rate") ":" <val(/<expr=.expr-speech-rate> /, &?ROUTINE.WHY)> }
8484
rule expr-speech-rate { :i <number> | [["x-slow" | slow | medium | fast | "x-fast" | faster | slower ]& <keyw>] }
8585
#| <number>
8686
rule decl:sym<stress> {;
87-
:i (stress) ":" <val(/ <expr=.expr-stress> /, &?ROUTINE.WHY)> }
87+
:i (stress) ":" <val(/<expr=.expr-stress> /, &?ROUTINE.WHY)> }
8888
rule expr-stress { :i <number> }
8989
#| [<generic-voice> | <specific-voice> ]#
9090
rule decl:sym<voice-family> {;
91-
:i ("voice-family") ":" <val(/ <expr=.expr-voice-family> /, &?ROUTINE.WHY)> }
91+
:i ("voice-family") ":" <val(/<expr=.expr-voice-family> /, &?ROUTINE.WHY)> }
9292
rule expr-voice-family { :i [<generic-voice> | <specific-voice> ]+% <op(",")> }
9393
#| male | female | child
9494
rule generic-voice {;
@@ -98,25 +98,25 @@ rule specific-voice {;
9898
:i <identifier> | <string> }
9999
#| <number> | <percentage> | silent | x-soft | soft | medium | loud | x-loud
100100
rule decl:sym<volume> {;
101-
:i (volume) ":" <val(/ <expr=.expr-volume> /, &?ROUTINE.WHY)> }
101+
:i (volume) ":" <val(/<expr=.expr-volume> /, &?ROUTINE.WHY)> }
102102
rule expr-volume { :i <number> | <percentage> | [[silent | "x-soft" | soft | medium | loud | "x-loud" ]& <keyw>] }
103103
#| [ <color> | transparent ]{1,4}
104104
rule decl:sym<border-color> {;
105-
:i ("border-color") ":" <val(/ <expr=.expr-border-color> /, &?ROUTINE.WHY)> }
105+
:i ("border-color") ":" <val(/<expr=.expr-border-color> /, &?ROUTINE.WHY)> }
106106
rule expr-border-color { :i [<color> | [transparent & <keyw>] ]** 1..4 }
107107
#| <color> | transparent
108108
rule decl:sym<border-top-color> {;
109-
:i ("border-top-color") ":" <val(/ <expr=.expr-border-top-color> /, &?ROUTINE.WHY)> }
109+
:i ("border-top-color") ":" <val(/<expr=.expr-border-top-color> /, &?ROUTINE.WHY)> }
110110
rule expr-border-top-color { :i <color> | [transparent & <keyw>] }
111111
#| <color> | transparent
112112
rule decl:sym<border-right-color> {;
113-
:i ("border-right-color") ":" <val(/ <expr=.expr-border-right-color> /, &?ROUTINE.WHY)> }
113+
:i ("border-right-color") ":" <val(/<expr=.expr-border-right-color> /, &?ROUTINE.WHY)> }
114114
rule expr-border-right-color { :i <color> | [transparent & <keyw>] }
115115
#| <color> | transparent
116116
rule decl:sym<border-bottom-color> {;
117-
:i ("border-bottom-color") ":" <val(/ <expr=.expr-border-bottom-color> /, &?ROUTINE.WHY)> }
117+
:i ("border-bottom-color") ":" <val(/<expr=.expr-border-bottom-color> /, &?ROUTINE.WHY)> }
118118
rule expr-border-bottom-color { :i <color> | [transparent & <keyw>] }
119119
#| <color> | transparent
120120
rule decl:sym<border-left-color> {;
121-
:i ("border-left-color") ":" <val(/ <expr=.expr-border-left-color> /, &?ROUTINE.WHY)> }
121+
:i ("border-left-color") ":" <val(/<expr=.expr-border-left-color> /, &?ROUTINE.WHY)> }
122122
rule expr-border-left-color { :i <color> | [transparent & <keyw>] }

0 commit comments

Comments
 (0)