▼ |  | Dr Racket Plugins

1 | Implementing Dr Racket Plugins
2 | Adding Languages to Dr Racket
3 | Creating New Kinds of Dr Racket Frames
4 | Extending the Existing Dr Racket Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | Language-Specific Capabilities
8 | Check Syntax
9 | Cooperating with Background Check Syntax
10 | Teaching Languages
11 | Signatures
12 | drracket: get/ extend
13 | drracket: unit
14 | drracket: language
15 | drracket: language-configuration
16 | drracket: debug
17 | drracket: rep
18 | drracket: frame
19 | drracket: help-desk
20 | drracket: eval
21 | drracket: modes
22 | drracket: module-language-tools
23 | drracket: module-language
24 | drracket: tracing
25 | Backwards Compatibility
| Index

top ← prev up next →

### 5`` Expanding the User’s Program Text and Breaking

Macro-expanding a program may involve arbitrary computation and requires the setup of the correct language. To aid this, DrRacket’s tool interface provides drracket:eval:expand-program to help. Use this method to extract the fully expanded program text in a particular language.

Because expanding the user’s program may require DrRacket to evaluate arbitrary code that the user wrote, tools that expand the user’s program should also allow the user to break the expansion. To help with this, the tools interfaces provides these methods: enable-evaluation and disable-evaluation. Since your tool will be expanding the program text, you should be both overriding enable-evaluation and disable-evaluation to disable your tool and calling them to ensure that only one expansion is happening at a time.

Finally, DrRacket provides the set-breakables method. This method controls what behavior the Break button has.

top ← prev up next →