Skip to content

Commit 026eb76

Browse files
committed
start rewriting HLL::Compiler.parse in nqp
1 parent 6b448c9 commit 026eb76

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/HLL/Compiler.pm

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -475,33 +475,21 @@ class HLL::Compiler {
475475
}
476476

477477
method parse($source, *%adverbs) {
478+
my $s := $source;
479+
if %adverbs<transcode> {
480+
for pir::split(' ', %adverbs<transcode>) {
481+
try {
482+
$s := pir::trans_encoding__ssi($s,
483+
pir::find_encoding__is($_));
484+
}
485+
}
486+
}
478487
Q:PIR {
479488
.local pmc source, options, self
480-
source = find_lex '$source'
489+
source = find_lex '$s'
481490
options = find_lex '%adverbs'
482491
self = find_lex 'self'
483492
484-
.local string tcode
485-
tcode = options['transcode']
486-
unless tcode goto transcode_done
487-
.local pmc tcode_it
488-
$P0 = split ' ', tcode
489-
tcode_it = iter $P0
490-
tcode_loop:
491-
unless tcode_it goto transcode_done
492-
tcode = shift tcode_it
493-
push_eh tcode_fail
494-
$I0 = find_encoding tcode
495-
$S0 = source
496-
$S0 = trans_encoding $S0, $I0
497-
assign source, $S0
498-
pop_eh
499-
goto transcode_done
500-
tcode_fail:
501-
pop_eh
502-
goto tcode_loop
503-
transcode_done:
504-
505493
.local pmc parsegrammar, parseactions, match
506494
parsegrammar = self.'parsegrammar'()
507495

0 commit comments

Comments
 (0)