author | haftmann |
Fri, 09 Jan 2015 08:37:00 +0100 | |
changeset 59324 | f5f9993a168d |
parent 59064 | a8bcb5a446c8 |
child 60858 | 7bf2188a0998 |
permissions | -rw-r--r-- |
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
1 |
(* Title: Pure/ML/ml_file.ML |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
3 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
4 |
The 'ML_file' command. |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
5 |
*) |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
6 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
7 |
structure ML_File: sig end = |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
8 |
struct |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
9 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
10 |
val _ = |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
11 |
Outer_Syntax.command ("ML_file", @{here}) "ML text from file" |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
12 |
(Resources.parse_files "ML_file" >> (fn files => Toplevel.generic_theory (fn gthy => |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
13 |
let |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
14 |
val [{src_path, lines, digest, pos}] = files (Context.theory_of gthy); |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
15 |
val provide = Resources.provide (src_path, digest); |
59064 | 16 |
val source = Input.source true (cat_lines lines) (pos, pos); |
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
17 |
val flags = {SML = false, exchange = false, redirect = true, verbose = true}; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
18 |
in |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
19 |
gthy |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
20 |
|> ML_Context.exec (fn () => ML_Context.eval_source flags source) |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
21 |
|> Local_Theory.propagate_ml_env |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
22 |
|> Context.mapping provide (Local_Theory.background_theory provide) |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
23 |
end))); |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
24 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
diff
changeset
|
25 |
end; |