git.annexia.org
/
whenjobs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow job names to be arbitrary OCaml expressions.
[whenjobs.git]
/
lib
/
whenfile.ml
diff --git
a/lib/whenfile.ml
b/lib/whenfile.ml
index
89a09b0
..
b109e66
100644
(file)
--- a/
lib/whenfile.ml
+++ b/
lib/whenfile.ml
@@
-16,23
+16,24
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
-open When
utils
+open When
expr
open Printf
open Printf
-(* The
list of jobs in this
file. *)
-let
jobs = ref []
+(* The
state updated during parsing of the
file. *)
+let
state = ref Whenstate.empty
-let init
() = jobs := []
+let init
s = state := s
let add_when_job _loc name e sh =
let e = expr_of_ast _loc e in
let add_when_job _loc name e sh =
let e = expr_of_ast _loc e in
- let job = make_when_job _loc name e sh in
- jobs := job :: !jobs
+ let job = { job_loc = _loc; job_name = name;
+ job_cond = When_job e; job_script = sh } in
+ state := Whenstate.add_job !state job
let add_every_job _loc name e sh =
let add_every_job _loc name e sh =
- let job = make_every_job _loc name e sh in
- jobs := job :: !jobs
+ let job = { job_loc = _loc; job_name = name;
+ job_cond = Every_job e; job_script = sh } in
+ state := Whenstate.add_job !state job
-let get_jobs () =
- List.rev !jobs
+let get_state () = !state