2006-06-29 14:55:15 -07:00
|
|
|
open Camlp4.PreCast;
|
|
|
|
|
|
|
|
let simplify =
|
2007-11-21 09:49:56 -08:00
|
|
|
object
|
2006-06-29 14:55:15 -07:00
|
|
|
inherit Ast.map as super;
|
|
|
|
method expr e =
|
2007-11-21 09:49:56 -08:00
|
|
|
match super#expr e with
|
|
|
|
[ <:expr< $x$ + 0 >> | <:expr< 0 + $x$ >> -> x
|
|
|
|
| x -> x ];
|
2006-06-29 14:55:15 -07:00
|
|
|
end
|
|
|
|
in AstFilters.register_str_item_filter simplify#str_item;
|