author | wenzelm |
Sat, 05 Mar 2016 13:53:08 +0100 | |
changeset 62517 | 091fdc002a52 |
parent 62453 | b93cc7d73431 |
child 62849 | caaa2fc4040d |
permissions | -rw-r--r-- |
22106 | 1 |
(* Title: Pure/Thy/thy_header.ML |
46939 | 2 |
Author: Makarius |
22106 | 3 |
|
46939 | 4 |
Static theory header information. |
22106 | 5 |
*) |
6 |
||
7 |
signature THY_HEADER = |
|
8 |
sig |
|
59934
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
9 |
type keywords = ((string * Position.T) * Keyword.spec option) list |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
10 |
type header = |
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
11 |
{name: string * Position.T, |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
12 |
imports: (string * Position.T) list, |
51294
0850d43cb355
discontinued obsolete header "files" -- these are loaded explicitly after exploring dependencies;
wenzelm
parents:
51293
diff
changeset
|
13 |
keywords: keywords} |
0850d43cb355
discontinued obsolete header "files" -- these are loaded explicitly after exploring dependencies;
wenzelm
parents:
51293
diff
changeset
|
14 |
val make: string * Position.T -> (string * Position.T) list -> keywords -> header |
59735 | 15 |
val theoryN: string |
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
16 |
val bootstrap_keywords: Keyword.keywords |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
17 |
val add_keywords: keywords -> theory -> theory |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
18 |
val get_keywords: theory -> Keyword.keywords |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
19 |
val get_keywords': Proof.context -> Keyword.keywords |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
20 |
val args: header parser |
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
21 |
val read: Position.T -> string -> header |
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
22 |
val read_tokens: Token.T list -> header |
22106 | 23 |
end; |
24 |
||
32466 | 25 |
structure Thy_Header: THY_HEADER = |
22106 | 26 |
struct |
27 |
||
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
28 |
(** keyword declarations **) |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
29 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
30 |
(* header *) |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
31 |
|
59934
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
32 |
type keywords = ((string * Position.T) * Keyword.spec option) list; |
48874
ff9cd47be39b
refined Thy_Load.check_thy: find more uses in body text, based on keywords;
wenzelm
parents:
48864
diff
changeset
|
33 |
|
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
34 |
type header = |
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
35 |
{name: string * Position.T, |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
36 |
imports: (string * Position.T) list, |
51294
0850d43cb355
discontinued obsolete header "files" -- these are loaded explicitly after exploring dependencies;
wenzelm
parents:
51293
diff
changeset
|
37 |
keywords: keywords}; |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
38 |
|
51294
0850d43cb355
discontinued obsolete header "files" -- these are loaded explicitly after exploring dependencies;
wenzelm
parents:
51293
diff
changeset
|
39 |
fun make name imports keywords : header = |
0850d43cb355
discontinued obsolete header "files" -- these are loaded explicitly after exploring dependencies;
wenzelm
parents:
51293
diff
changeset
|
40 |
{name = name, imports = imports, keywords = keywords}; |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
41 |
|
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
42 |
|
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
43 |
(* bootstrap keywords *) |
22106 | 44 |
|
58868
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
45 |
val chapterN = "chapter"; |
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
46 |
val sectionN = "section"; |
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
47 |
val subsectionN = "subsection"; |
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
48 |
val subsubsectionN = "subsubsection"; |
61463 | 49 |
val paragraphN = "paragraph"; |
50 |
val subparagraphN = "subparagraph"; |
|
58999
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
51 |
val textN = "text"; |
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
52 |
val txtN = "txt"; |
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
53 |
val text_rawN = "text_raw"; |
58868
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
54 |
|
22106 | 55 |
val theoryN = "theory"; |
56 |
val importsN = "imports"; |
|
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
57 |
val keywordsN = "keywords"; |
22106 | 58 |
val beginN = "begin"; |
59 |
||
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
60 |
val bootstrap_keywords = |
58903 | 61 |
Keyword.empty_keywords |
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
62 |
|> Keyword.add_keywords |
59934
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
63 |
[(("%", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
64 |
(("(", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
65 |
((")", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
66 |
((",", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
67 |
(("::", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
68 |
(("==", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
69 |
(("and", @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
70 |
((beginN, @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
71 |
((importsN, @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
72 |
((keywordsN, @{here}), NONE), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
73 |
((chapterN, @{here}), SOME ((Keyword.document_heading, []), [])), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
74 |
((sectionN, @{here}), SOME ((Keyword.document_heading, []), [])), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
75 |
((subsectionN, @{here}), SOME ((Keyword.document_heading, []), [])), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
76 |
((subsubsectionN, @{here}), SOME ((Keyword.document_heading, []), [])), |
61463 | 77 |
((paragraphN, @{here}), SOME ((Keyword.document_heading, []), [])), |
78 |
((subparagraphN, @{here}), SOME ((Keyword.document_heading, []), [])), |
|
59934
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
79 |
((textN, @{here}), SOME ((Keyword.document_body, []), [])), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
80 |
((txtN, @{here}), SOME ((Keyword.document_body, []), [])), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
81 |
((text_rawN, @{here}), SOME ((Keyword.document_raw, []), [])), |
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
82 |
((theoryN, @{here}), SOME ((Keyword.thy_begin, []), ["theory"])), |
60957
574254152856
support for ML files with/without debugger information;
wenzelm
parents:
59934
diff
changeset
|
83 |
(("ML_file", @{here}), SOME ((Keyword.thy_load, []), ["ML"])), |
574254152856
support for ML files with/without debugger information;
wenzelm
parents:
59934
diff
changeset
|
84 |
(("ML_file_debug", @{here}), SOME ((Keyword.thy_load, []), ["ML"])), |
574254152856
support for ML files with/without debugger information;
wenzelm
parents:
59934
diff
changeset
|
85 |
(("ML_file_no_debug", @{here}), SOME ((Keyword.thy_load, []), ["ML"]))]; |
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
86 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
87 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
88 |
(* theory data *) |
22106 | 89 |
|
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
90 |
structure Data = Theory_Data |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
91 |
( |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
92 |
type T = Keyword.keywords; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
93 |
val empty = bootstrap_keywords; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
94 |
val extend = I; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
95 |
val merge = Keyword.merge_keywords; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
96 |
); |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
97 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
98 |
val add_keywords = Data.map o Keyword.add_keywords; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
99 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
100 |
val get_keywords = Data.get; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
101 |
val get_keywords' = get_keywords o Proof_Context.theory_of; |
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
102 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
103 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
104 |
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
105 |
(** concrete syntax **) |
22106 | 106 |
|
107 |
(* header args *) |
|
108 |
||
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
109 |
local |
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
110 |
|
59694 | 111 |
fun imports name = |
112 |
if name = Context.PureN then Scan.succeed [] |
|
113 |
else Parse.$$$ importsN |-- Parse.!!! (Scan.repeat1 (Parse.position Parse.theory_xname)); |
|
53962
65bca53daf70
more robust parser: 'imports' are mandatory except for bootstrapping Pure;
wenzelm
parents:
51627
diff
changeset
|
114 |
|
48864
3ee314ae1e0a
added keyword kind "thy_load" (with optional list of file extensions);
wenzelm
parents:
48707
diff
changeset
|
115 |
val opt_files = |
3ee314ae1e0a
added keyword kind "thy_load" (with optional list of file extensions);
wenzelm
parents:
48707
diff
changeset
|
116 |
Scan.optional (Parse.$$$ "(" |-- Parse.!!! (Parse.list1 Parse.name) --| Parse.$$$ ")") []; |
50128
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
117 |
|
48864
3ee314ae1e0a
added keyword kind "thy_load" (with optional list of file extensions);
wenzelm
parents:
48707
diff
changeset
|
118 |
val keyword_spec = |
3ee314ae1e0a
added keyword kind "thy_load" (with optional list of file extensions);
wenzelm
parents:
48707
diff
changeset
|
119 |
Parse.group (fn () => "outer syntax keyword specification") |
3ee314ae1e0a
added keyword kind "thy_load" (with optional list of file extensions);
wenzelm
parents:
48707
diff
changeset
|
120 |
(Parse.name -- opt_files -- Parse.tags); |
3ee314ae1e0a
added keyword kind "thy_load" (with optional list of file extensions);
wenzelm
parents:
48707
diff
changeset
|
121 |
|
50128
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
122 |
val keyword_compl = |
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
123 |
Parse.group (fn () => "outer syntax keyword completion") Parse.name; |
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
124 |
|
46939 | 125 |
val keyword_decl = |
59934
b65c4370f831
more position information and PIDE markup for command keywords;
wenzelm
parents:
59735
diff
changeset
|
126 |
Scan.repeat1 (Parse.position Parse.string) -- |
50128
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
127 |
Scan.option (Parse.$$$ "::" |-- Parse.!!! keyword_spec) -- |
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
128 |
Scan.option (Parse.$$$ "==" |-- Parse.!!! keyword_compl) |
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
129 |
>> (fn ((names, spec), _) => map (rpair spec) names); |
599c935aac82
alternative completion for outer syntax keywords;
wenzelm
parents:
48992
diff
changeset
|
130 |
|
46939 | 131 |
val keyword_decls = Parse.and_list1 keyword_decl >> flat; |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
132 |
|
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
133 |
in |
22106 | 134 |
|
135 |
val args = |
|
59693 | 136 |
Parse.position Parse.theory_name :|-- (fn (name, pos) => |
59694 | 137 |
imports name -- |
53962
65bca53daf70
more robust parser: 'imports' are mandatory except for bootstrapping Pure;
wenzelm
parents:
51627
diff
changeset
|
138 |
Scan.optional (Parse.$$$ keywordsN |-- Parse.!!! keyword_decls) [] --| |
65bca53daf70
more robust parser: 'imports' are mandatory except for bootstrapping Pure;
wenzelm
parents:
51627
diff
changeset
|
139 |
Parse.$$$ beginN >> (fn (imports, keywords) => make (name, pos) imports keywords)); |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
140 |
|
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
141 |
end; |
22106 | 142 |
|
143 |
||
144 |
(* read header *) |
|
145 |
||
58868
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
146 |
val heading = |
62453 | 147 |
(Parse.command chapterN || |
58908 | 148 |
Parse.command sectionN || |
149 |
Parse.command subsectionN || |
|
58999
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
150 |
Parse.command subsubsectionN || |
61463 | 151 |
Parse.command paragraphN || |
152 |
Parse.command subparagraphN || |
|
58999
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
153 |
Parse.command textN || |
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
154 |
Parse.command txtN || |
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58932
diff
changeset
|
155 |
Parse.command text_rawN) -- |
58868
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
156 |
Parse.tags -- Parse.!!! Parse.document_source; |
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
wenzelm
parents:
58864
diff
changeset
|
157 |
|
22106 | 158 |
val header = |
58908 | 159 |
(Scan.repeat heading -- Parse.command theoryN -- Parse.tags) |-- Parse.!!! args; |
22106 | 160 |
|
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
161 |
fun token_source pos str = |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
162 |
str |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
163 |
|> Source.of_string_limited 8000 |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
164 |
|> Symbol.source |
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58924
diff
changeset
|
165 |
|> Token.source_strict bootstrap_keywords pos; |
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
166 |
|
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
167 |
fun read_source pos source = |
22106 | 168 |
let val res = |
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
169 |
source |
36959
f5417836dbea
renamed structure OuterLex to Token and type token to Token.T, keeping legacy aliases for some time;
wenzelm
parents:
36950
diff
changeset
|
170 |
|> Token.source_proper |
58864 | 171 |
|> Source.source Token.stopper (Scan.single (Scan.error (Parse.!!! header))) |
22106 | 172 |
|> Source.get_single; |
173 |
in |
|
42003
6e45dc518ebb
replaced File.check by specific File.check_file, File.check_dir;
wenzelm
parents:
41944
diff
changeset
|
174 |
(case res of |
46938
cda018294515
some support for outer syntax keyword declarations within theory header;
wenzelm
parents:
46737
diff
changeset
|
175 |
SOME (h, _) => h |
48992 | 176 |
| NONE => error ("Unexpected end of input" ^ Position.here pos)) |
22106 | 177 |
end; |
178 |
||
48927
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
179 |
fun read pos str = read_source pos (token_source pos str); |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
180 |
fun read_tokens toks = read_source Position.none (Source.of_list toks); |
ef462b5558eb
theory def/ref position reports, which enable hyperlinks etc.;
wenzelm
parents:
48881
diff
changeset
|
181 |
|
22106 | 182 |
end; |