Using #:literals in syntax-parse

14 views
Skip to first unread message

Rafael Reia

unread,
Dec 18, 2015, 9:43:58 AM12/18/15
to Racket Developers
Hello everyone,

I'm trying to do refactoring operations in Racket. 

I'm using syntax-parse to match the refactoring rules, but I have a problem with the use of #:literals. It works for the expanded program, but it does not work for the non expanded program.

The non expanded program works just fine in a normal file, however it does not work when I feed the argument from other programs. While the expanded program works when is fed by other programs.

I get the expanded program from the function "drracket:eval:expand-program" and the non expanded program from "drracket:eval:traverse-program/multiple".

I have a plugin that shows this problem, you can find it in this link: https://github.com/RafaelReia/RefactoringTool.git I already have more refactoring operations but this plugin is simplified to show the error.

There are 2 refactorings available, one (refactoring If) uses drracket:eval:expand-program. It uses #:literals and it works.

the other (refactoring if V2) uses drracket:eval:traverse-program/multiple. When it uses #:literals it raises an error, but if I change it to #:datum-literals it works.

To use the refactoring tool it is necessary to select the code to be refactored (e.g. (if (< 1 2) #f #t) ), right click it and then select the refactoring in the Refactoring Test Plugin.

It would be great if someone could take a look at the plugin and explain the problem.

Thanks,

Reply all
Reply to author
Forward
0 new messages