From f7ba1647aea3696e3d448dd3a41338150b4228ba Mon Sep 17 00:00:00 2001 From: Ryan Culpepper Date: Fri, 16 Mar 2012 18:28:53 -0600 Subject: [PATCH] macro-debugger: fix parser for local-actions in mod pass 2 original commit: 6b02b507a95245be5f43e6a583adfe419dadb1c6 --- .../analysis/private/get-references.rkt | 8 ++++---- collects/macro-debugger/model/deriv-c.rkt | 4 ++-- collects/macro-debugger/model/deriv-parser.rkt | 13 ++++++++----- collects/macro-debugger/model/reductions.rkt | 6 ++++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/collects/macro-debugger/analysis/private/get-references.rkt b/collects/macro-debugger/analysis/private/get-references.rkt index ef3b887..544e945 100644 --- a/collects/macro-debugger/analysis/private/get-references.rkt +++ b/collects/macro-debugger/analysis/private/get-references.rkt @@ -201,12 +201,12 @@ (recur head prim)] [(mod:splice head rename ?1 tail) (recur head)] - [(mod:lift head renames tail) - (recur head)] + [(mod:lift head locals renames tail) + (recur head locals)] [(mod:lift-end tail) (void)] - [(mod:cons head) - (recur head)] + [(mod:cons head locals) + (recur head locals)] [(mod:skip) (void)] ;; Shouldn't occur in module expansion. diff --git a/collects/macro-debugger/model/deriv-c.rkt b/collects/macro-debugger/model/deriv-c.rkt index bc2791e..3c2fe10 100644 --- a/collects/macro-debugger/model/deriv-c.rkt +++ b/collects/macro-debugger/model/deriv-c.rkt @@ -181,9 +181,9 @@ (define-struct modrule () #:transparent) (define-struct (mod:prim modrule) (head rename prim) #:transparent) (define-struct (mod:splice modrule) (head rename ?1 tail) #:transparent) -(define-struct (mod:lift modrule) (head renames tail) #:transparent) +(define-struct (mod:lift modrule) (head locals renames tail) #:transparent) (define-struct (mod:lift-end modrule) (tail) #:transparent) -(define-struct (mod:cons modrule) (head) #:transparent) +(define-struct (mod:cons modrule) (head locals) #:transparent) (define-struct (mod:skip modrule) () #:transparent) ;; A ModPrim is either #f or one of the following PRule variants: diff --git a/collects/macro-debugger/model/deriv-parser.rkt b/collects/macro-debugger/model/deriv-parser.rkt index 0bf7b1b..1290e47 100644 --- a/collects/macro-debugger/model/deriv-parser.rkt +++ b/collects/macro-debugger/model/deriv-parser.rkt @@ -324,7 +324,7 @@ [(EE rename-one ! splice) (make mod:splice $1 $2 $3 $4)] [(EE rename-list module-lift-loop) - (make mod:lift $1 $2 $3)]) + (make mod:lift $1 null $2 $3)]) (ModulePass1/Prim (#:args e1) @@ -354,11 +354,14 @@ [() (make mod:skip)] ;; normal: expand completely - [((? EE)) - (make mod:cons $1)] + [((? EE) (? Eval)) + ;; after expansion, may compile => may eval letstx rhss again! + ;; need to include those evals too (for errors, etc) + (make mod:cons $1 $2)] ;; catch lifts - [(EE module-lift-loop) - (make mod:lift $1 #f $2)]) + [(EE Eval module-lift-loop) + ;; same as above: after expansion, may compile => may eval + (make mod:lift $1 $2 #f $3)]) (ModulePass3 (#:skipped null) diff --git a/collects/macro-debugger/model/reductions.rkt b/collects/macro-debugger/model/reductions.rkt index 9e3a7d4..c7b9241 100644 --- a/collects/macro-debugger/model/reductions.rkt +++ b/collects/macro-debugger/model/reductions.rkt @@ -669,7 +669,7 @@ [#:step 'splice-module (stx->list (stx-cdr begin-form))] [#:rename ?forms tail] [ModulePass ?forms rest])] - [(cons (Wrap mod:lift (head renames stxs)) rest) + [(cons (Wrap mod:lift (head locals renames stxs)) rest) (R [#:pattern (?firstL . ?rest)] ;; renames has form (head-e2 . ?rest) ;; stxs has form (lifted ...), @@ -678,6 +678,7 @@ (visible-lift-stxs null)) [#:pass1] [Expr ?firstL head] + [LocalActions ?firstL locals] [#:do (when (pair? (available-lift-stxs)) (lift-error 'mod:lift "available lifts left over"))] [#:let visible-lifts (visible-lift-stxs)] @@ -701,9 +702,10 @@ [(cons (Wrap mod:skip ()) rest) (R [#:pattern (?firstS . ?rest)] [ModulePass ?rest rest])] - [(cons (Wrap mod:cons (head)) rest) + [(cons (Wrap mod:cons (head locals)) rest) (R [#:pattern (?firstC . ?rest)] [Expr ?firstC head] + [LocalActions ?firstC locals] [ModulePass ?rest rest])])) ;; Lifts