Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move ast_filters into original syntax
- Loading branch information
Showing
5 changed files
with
62 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,52 @@ | ||
|
||
open Util | ||
open Astf | ||
open Astf | ||
|
||
type key = string | ||
type 'a filter = 'a -> 'a | ||
let interf_filters: (key,sigi filter) Hashtbl.t = Hashtbl.create 40 | ||
let implem_filters: (key,stru filter) Hashtbl.t = Hashtbl.create 40 | ||
let topphrase_filters: (key,stru filter) Hashtbl.t = Hashtbl.create 40 | ||
let applied_interf_filters: (string* sigi filter) Queue.t = Queue.create () | ||
let applied_implem_filters: (string* stru filter) Queue.t = Queue.create () | ||
let applied_topphrase_filters: (string* stru filter) Queue.t = | ||
Queue.create () | ||
let apply_interf_filters = | ||
function | ||
| i -> | ||
Queue.fold (function | ast -> (function | (_name,f) -> f ast)) i | ||
applied_interf_filters | ||
let apply_implem_filters = | ||
function | ||
| i -> | ||
Queue.fold (function | ast -> (function | (_name,f) -> f ast)) i | ||
applied_implem_filters | ||
let apply_topphrase_filters = | ||
function | ||
| i -> | ||
Queue.fold (function | ast -> (function | (_name,f) -> f ast)) i | ||
applied_topphrase_filters | ||
let use_interf_filter = | ||
function | ||
| s -> | ||
let u = | ||
try Hashtbl.find interf_filters s | ||
with | Not_found -> failwithf "filter %s is not registered" s in | ||
Queue.add (s, u) applied_interf_filters | ||
let use_implem_filter = | ||
function | ||
| s -> | ||
let u = | ||
try Hashtbl.find implem_filters s | ||
with | Not_found -> failwithf "filter %s is not registered" s in | ||
Queue.add (s, u) applied_implem_filters | ||
let use_topphrase_filter = | ||
function | ||
| s -> | ||
let u = | ||
try Hashtbl.find topphrase_filters s | ||
with | Not_found -> failwithf "filter %s is not registered" s in | ||
Queue.add (s, u) applied_topphrase_filters | ||
let register_sigi_filter = | ||
function | (k,f) -> Hashtbl.replace interf_filters k f | ||
let register_stru_filter = | ||
function | (k,f) -> Hashtbl.replace implem_filters k f | ||
let register_topphrase_filter = | ||
function | (k,f) -> Hashtbl.replace topphrase_filters k f | ||
type 'a filter = 'a -> 'a | ||
|
||
|
||
let interf_filters: ( key, sigi filter ) Hashtbl.t = Hashtbl.create 40 | ||
let implem_filters: (key, stru filter ) Hashtbl.t = Hashtbl.create 40 | ||
|
||
let topphrase_filters: (key, stru filter ) Hashtbl.t = Hashtbl.create 40 | ||
|
||
let applied_interf_filters: (string * sigi filter ) Queue.t = Queue.create () | ||
let applied_implem_filters: (string * stru filter ) Queue.t = Queue.create () | ||
let applied_topphrase_filters: (string * stru filter ) Queue.t = Queue.create () | ||
|
||
let apply_interf_filters i = | ||
Queue.fold (fun ast (_name,f) -> f ast) i applied_interf_filters | ||
let apply_implem_filters i = | ||
Queue.fold (fun ast (_name,f) -> f ast) i applied_implem_filters | ||
let apply_topphrase_filters i = | ||
Queue.fold (fun ast (_name,f) -> f ast) i applied_topphrase_filters | ||
|
||
let use_interf_filter s = | ||
let u = | ||
try Hashtbl.find interf_filters s | ||
with Not_found -> failwithf "filter %s is not registered" s in | ||
Queue.add (s,u) applied_interf_filters | ||
|
||
let use_implem_filter s = | ||
let u = | ||
try Hashtbl.find implem_filters s | ||
with Not_found -> failwithf "filter %s is not registered" s in | ||
Queue.add (s,u) applied_implem_filters | ||
|
||
let use_topphrase_filter s = | ||
let u = | ||
try Hashtbl.find topphrase_filters s | ||
with Not_found -> failwithf "filter %s is not registered" s in | ||
Queue.add (s,u) applied_topphrase_filters | ||
|
||
let register_sigi_filter (k,f) = | ||
Hashtbl.replace interf_filters k f | ||
|
||
let register_stru_filter (k,f) = | ||
Hashtbl.replace implem_filters k f | ||
|
||
|
||
let register_topphrase_filter (k,f) = | ||
Hashtbl.replace topphrase_filters k f | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../cold/ast_filters.ml |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../cold/ast_filters.mli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
# echo $1 | ||
mv -f $1.ml $1.mli ../cold/ | ||
ln -s ../cold/$1.ml | ||
ln -s ../cold/$1.mli |