Ticket #1115: the_p_in_repl.patch
File the_p_in_repl.patch, 2.5 KB (added by riffraff, 12 years ago) |
---|
-
compilers/pct/src/PCT/HLLCompiler.pir
18 18 load_bytecode 'P6object.pbc' 19 19 load_bytecode 'Parrot/Exception.pbc' 20 20 $P0 = new 'P6metaclass' 21 $S0 = '@stages $parsegrammar $parseactions $astgrammar $commandline_banner $commandline_prompt @cmdoptions $usage $version'21 $S0 = '@stages $parsegrammar $parseactions $astgrammar $commandline_banner $commandline_prompt $commandline_result_prompt @cmdoptions $usage $version' 22 22 $P0.'new_class'('PCT::HLLCompiler', 'attr'=>$S0) 23 23 .end 24 24 … … 146 146 The prompt is displayed in interactive mode at each point where 147 147 the compiler is ready for code to be compiled and executed. 148 148 149 =item commandline_result_prompt([string value]) 150 151 Set the command-line prompt for result of this computation to C<value>. 152 The prompt is displayed in interactive mode after each point where 153 the code is inserted showing the result of the computation. 154 149 155 =cut 150 156 151 157 .sub 'stages' :method … … 184 190 .tailcall self.'attr'('$commandline_prompt', value, has_value) 185 191 .end 186 192 193 .sub 'commandline_result_prompt' :method 194 .param string value :optional 195 .param int has_value :opt_flag 196 .tailcall self.'attr'('$commandline_result_prompt', value, has_value) 197 .end 198 187 199 =item removestage(string stagename) 188 200 189 201 Delete a stage from the compilation process queue. … … 575 587 $P0 = self.'commandline_banner'() 576 588 printerr $P0 577 589 590 # set result prompt once 591 .local string result_prompt 592 result_prompt = '=> ' 593 $P0 = self.'commandline_result_prompt'() 594 $I0 = defined $P0 595 unless $I0 goto has_result_prompt 596 result_prompt = $P0 597 598 has_result_prompt: 599 578 600 .local pmc stdin 579 601 .local int has_readline 580 602 stdin = getstdin … … 587 609 unless stdin goto interactive_end 588 610 589 611 .local string prompt 590 prompt = '> '612 prompt = '>> ' 591 613 $P0 = self.'commandline_prompt'() 592 614 $I0 = defined $P0 593 615 unless $I0 goto have_prompt … … 604 626 $P0 = self.'eval'(code, adverbs :flat :named) 605 627 pop_eh 606 628 if null $P0 goto interactive_loop 607 unless target goto interactive_ loop629 unless target goto interactive_print 608 630 if target == 'pir' goto target_pir 609 631 self.'dumper'($P0, target, adverbs :flat :named) 632 interactive_print: 633 print result_prompt 634 print $P0 635 print "\n" 610 636 goto interactive_loop 611 637 target_pir: 612 638 say $P0