Changeset 551
- Timestamp:
- 06/18/08 11:58:46 (5 months ago)
- Files:
-
- trunk/pcc/compiler/driver.scm (modified) (4 diffs)
- trunk/pcc/compiler/evaluate.scm (modified) (1 diff)
- trunk/pcc/compiler/target.scm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pcc/compiler/driver.scm
r533 r551 56 56 (dump-flow input-file) 57 57 (dump-preprocessed input-file) 58 (php-repl-eval code) 58 59 (interpret input-file) 59 60 (debug input-file) … … 640 641 (with-input-from-string (string-append "<?php " (mkstr code) " ?>") 641 642 (lambda () 642 (%memoized-parse (read-string) 'php-lambda (format "~a : eval()'d code" *PHP-FILE* (mkstr *PHP-LINE*)))643 (%memoized-parse (read-string) 'php-lambda (format "~a: eval()'d code" *PHP-FILE*)) 643 644 )))) 644 645 646 (define (php-repl-token-error escape proc msg token) 647 (let ((outmsg (format "~%~a" msg))) 648 (fprint (current-error-port) outmsg) 649 (escape 'nop))) 650 651 (define (php-repl-eval code) 652 (evaluate 653 (with-input-from-string (string-append "<?php " (mkstr code) " ?>") 654 (lambda () 655 (%do-parse (read-string) 'php-repl "Interactive Shell: " php-repl-token-error) 656 )))) 645 657 646 658 (define (evaluate-from-file file name-to-use) … … 707 719 (define %%memoized-parses #f) 708 720 721 (define (%do-parse input-string main-name filename handler) 722 (with-input-from-string input-string 723 (lambda () 724 (try (parse (php-preprocess (current-input-port) filename) 725 main-name filename) 726 handler)))) 727 709 728 (define (%memoized-parse input-string main-name filename) 710 729 ;; save the result of parsing a file so that we can skip parsing it next time … … 712 731 ;(debug-trace 0 "Parsing " filename " for the first time") 713 732 (set! %%memo-miss-count (+ %%memo-miss-count 1)) 714 (with-input-from-string input-string 715 (lambda () 716 (try (parse (php-preprocess (current-input-port) filename) 717 main-name filename) 718 handle-token-error)))))) 733 (%do-parse input-string main-name filename handle-token-error)))) 719 734 ;; I think that memoization will only help when running as a web 720 735 ;; server, because it only speeds up the 2nd and subsequent trunk/pcc/compiler/evaluate.scm
r544 r551 100 100 ((list? node) (evaluate-block node)) 101 101 ((eqv? node :next) :next) 102 ((eqv? node 'nop) #t) ; bad parse in interactive mode 102 103 (else (error 'evaluate "Don't know what to do with node: " 103 104 (with-output-to-string trunk/pcc/compiler/target.scm
r550 r551 160 160 (try 161 161 (begin 162 (php- eval input)162 (php-repl-eval input) 163 163 (print)) 164 164 (lambda (e p m o)
