author | wenzelm |
Mon, 10 Jan 2011 21:45:44 +0100 | |
changeset 41502 | 967cbbc77abd |
parent 40627 | becf5d5187cc |
child 43947 | 9b00f09f7721 |
permissions | -rw-r--r-- |
24579 | 1 |
(* Title: Pure/ML/ml_lex.ML |
2 |
Author: Makarius |
|
3 |
||
4 |
Lexical syntax for SML. |
|
5 |
*) |
|
6 |
||
7 |
signature ML_LEX = |
|
8 |
sig |
|
9 |
datatype token_kind = |
|
24596 | 10 |
Keyword | Ident | LongIdent | TypeVar | Word | Int | Real | Char | String | |
24579 | 11 |
Space | Comment | Error of string | EOF |
12 |
eqtype token |
|
27732 | 13 |
val stopper: token Scan.stopper |
24596 | 14 |
val is_regular: token -> bool |
15 |
val is_improper: token -> bool |
|
30683
e8ac1f9d9469
datatype antiquote: maintain original Position.range, which is eventually attached to the resulting ML tokens;
wenzelm
parents:
30645
diff
changeset
|
16 |
val set_range: Position.range -> token -> token |
30636 | 17 |
val pos_of: token -> Position.T |
31474 | 18 |
val end_pos_of: token -> Position.T |
24579 | 19 |
val kind_of: token -> token_kind |
27817 | 20 |
val content_of: token -> string |
31426 | 21 |
val check_content_of: token -> string |
31332 | 22 |
val flatten: token list -> string |
30614 | 23 |
val report_token: token -> unit |
24579 | 24 |
val keywords: string list |
24596 | 25 |
val source: (Symbol.symbol, 'a) Source.source -> |
30573 | 26 |
(token, (Symbol_Pos.T, Position.T * (Symbol.symbol, 'a) Source.source) |
27772 | 27 |
Source.source) Source.source |
30591 | 28 |
val tokenize: string -> token list |
37198
3af985b10550
replaced ML_Lex.read_antiq by more concise ML_Lex.read, which includes full read/report with explicit position information;
wenzelm
parents:
37195
diff
changeset
|
29 |
val read: Position.T -> Symbol_Pos.text -> token Antiquote.antiquote list |
24579 | 30 |
end; |
31 |
||
32 |
structure ML_Lex: ML_LEX = |
|
33 |
struct |
|
34 |
||
35 |
(** tokens **) |
|
36 |
||
37 |
(* datatype token *) |
|
38 |
||
39 |
datatype token_kind = |
|
24596 | 40 |
Keyword | Ident | LongIdent | TypeVar | Word | Int | Real | Char | String | |
24579 | 41 |
Space | Comment | Error of string | EOF; |
42 |
||
27772 | 43 |
datatype token = Token of Position.range * (token_kind * string); |
44 |
||
45 |
||
46 |
(* position *) |
|
47 |
||
30683
e8ac1f9d9469
datatype antiquote: maintain original Position.range, which is eventually attached to the resulting ML tokens;
wenzelm
parents:
30645
diff
changeset
|
48 |
fun set_range range (Token (_, x)) = Token (range, x); |
e8ac1f9d9469
datatype antiquote: maintain original Position.range, which is eventually attached to the resulting ML tokens;
wenzelm
parents:
30645
diff
changeset
|
49 |
|
30636 | 50 |
fun pos_of (Token ((pos, _), _)) = pos; |
51 |
fun end_pos_of (Token ((_, pos), _)) = pos; |
|
24579 | 52 |
|
53 |
||
24596 | 54 |
(* control tokens *) |
24579 | 55 |
|
27772 | 56 |
fun mk_eof pos = Token ((pos, Position.none), (EOF, "")); |
57 |
val eof = mk_eof Position.none; |
|
24579 | 58 |
|
59 |
fun is_eof (Token (_, (EOF, _))) = true |
|
60 |
| is_eof _ = false; |
|
61 |
||
27772 | 62 |
val stopper = |
30636 | 63 |
Scan.stopper (fn [] => eof | toks => mk_eof (end_pos_of (List.last toks))) is_eof; |
27772 | 64 |
|
24579 | 65 |
|
27772 | 66 |
(* token content *) |
67 |
||
31426 | 68 |
fun kind_of (Token (_, (k, _))) = k; |
69 |
||
27817 | 70 |
fun content_of (Token (_, (_, x))) = x; |
71 |
fun token_leq (tok, tok') = content_of tok <= content_of tok'; |
|
27772 | 72 |
|
41502
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
73 |
fun is_regular (Token (_, (Error _, _))) = false |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
74 |
| is_regular (Token (_, (EOF, _))) = false |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
75 |
| is_regular _ = true; |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
76 |
|
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
77 |
fun is_improper (Token (_, (Space, _))) = true |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
78 |
| is_improper (Token (_, (Comment, _))) = true |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
79 |
| is_improper _ = false; |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
80 |
|
40337
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
81 |
fun warn tok = |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
82 |
(case tok of |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
83 |
Token (_, (Keyword, ":>")) => |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
84 |
warning ("Opaque signature matching (:>) fails to work with ML pretty printing --\n\ |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
85 |
\prefer non-opaque matching (:) possibly with abstype" ^ |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
86 |
Position.str_of (pos_of tok)) |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
87 |
| _ => ()); |
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
88 |
|
31426 | 89 |
fun check_content_of tok = |
30636 | 90 |
(case kind_of tok of |
30645 | 91 |
Error msg => error msg |
40337
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
92 |
| _ => content_of tok); |
30636 | 93 |
|
41502
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
94 |
fun flatten_content (tok :: (toks as tok' :: _)) = |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
95 |
Symbol.escape (check_content_of tok) :: |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
96 |
(if is_improper tok orelse is_improper tok' then flatten_content toks |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
97 |
else Symbol.space :: flatten_content toks) |
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
98 |
| flatten_content toks = map (Symbol.escape o check_content_of) toks; |
31332 | 99 |
|
41502
967cbbc77abd
refined ML_Lex.flatten: ensure proper separation of tokens;
wenzelm
parents:
40627
diff
changeset
|
100 |
val flatten = implode o flatten_content; |
24596 | 101 |
|
102 |
||
30614 | 103 |
(* markup *) |
104 |
||
37195 | 105 |
local |
106 |
||
30645 | 107 |
val token_kind_markup = |
108 |
fn Keyword => Markup.ML_keyword |
|
109 |
| Ident => Markup.ML_ident |
|
110 |
| LongIdent => Markup.ML_ident |
|
111 |
| TypeVar => Markup.ML_tvar |
|
112 |
| Word => Markup.ML_numeral |
|
113 |
| Int => Markup.ML_numeral |
|
114 |
| Real => Markup.ML_numeral |
|
115 |
| Char => Markup.ML_char |
|
116 |
| String => Markup.ML_string |
|
38474
e498dc2eb576
uniform Markup.empty/Markup.Empty in ML and Scala;
wenzelm
parents:
37209
diff
changeset
|
117 |
| Space => Markup.empty |
30645 | 118 |
| Comment => Markup.ML_comment |
119 |
| Error _ => Markup.ML_malformed |
|
38474
e498dc2eb576
uniform Markup.empty/Markup.Empty in ML and Scala;
wenzelm
parents:
37209
diff
changeset
|
120 |
| EOF => Markup.empty; |
30614 | 121 |
|
37195 | 122 |
fun token_markup kind x = |
123 |
if kind = Keyword andalso exists_string (not o Symbol.is_ascii_letter) x |
|
124 |
then Markup.ML_delimiter |
|
125 |
else token_kind_markup kind; |
|
126 |
||
127 |
in |
|
128 |
||
39507
839873937ddd
tuned signature of (Context_)Position.report variants;
wenzelm
parents:
38474
diff
changeset
|
129 |
fun report_token (Token ((pos, _), (kind, x))) = Position.report pos (token_markup kind x); |
37195 | 130 |
|
131 |
end; |
|
30614 | 132 |
|
133 |
||
24579 | 134 |
|
135 |
(** scanners **) |
|
136 |
||
30573 | 137 |
open Basic_Symbol_Pos; |
24579 | 138 |
|
30573 | 139 |
fun !!! msg = Symbol_Pos.!!! ("SML lexical error: " ^ msg); |
24579 | 140 |
|
141 |
||
27772 | 142 |
(* blanks *) |
24579 | 143 |
|
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
144 |
val scan_blank = Scan.one (Symbol.is_ascii_blank o Symbol_Pos.symbol); |
27772 | 145 |
val scan_blanks1 = Scan.repeat1 scan_blank; |
24579 | 146 |
|
147 |
||
148 |
(* keywords *) |
|
149 |
||
150 |
val keywords = ["#", "(", ")", ",", "->", "...", ":", ":>", ";", "=", |
|
151 |
"=>", "[", "]", "_", "{", "|", "}", "abstype", "and", "andalso", "as", |
|
152 |
"case", "datatype", "do", "else", "end", "eqtype", "exception", "fn", |
|
153 |
"fun", "functor", "handle", "if", "in", "include", "infix", "infixr", |
|
154 |
"let", "local", "nonfix", "of", "op", "open", "orelse", "raise", "rec", |
|
155 |
"sharing", "sig", "signature", "struct", "structure", "then", "type", |
|
156 |
"val", "where", "while", "with", "withtype"]; |
|
157 |
||
40627
becf5d5187cc
renamed raw "explode" function to "raw_explode" to emphasize its meaning;
wenzelm
parents:
40525
diff
changeset
|
158 |
val lex = Scan.make_lexicon (map raw_explode keywords); |
27772 | 159 |
fun scan_keyword x = Scan.literal lex x; |
24579 | 160 |
|
161 |
||
162 |
(* identifiers *) |
|
163 |
||
24596 | 164 |
local |
165 |
||
24579 | 166 |
val scan_letdigs = |
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
167 |
Scan.many |
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
168 |
((Symbol.is_ascii_letter orf Symbol.is_ascii_digit orf Symbol.is_ascii_quasi) o |
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
169 |
Symbol_Pos.symbol); |
24579 | 170 |
|
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
171 |
val scan_alphanumeric = |
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
172 |
Scan.one (Symbol.is_ascii_letter o Symbol_Pos.symbol) -- scan_letdigs >> op ::; |
24579 | 173 |
|
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
174 |
val scan_symbolic = |
40627
becf5d5187cc
renamed raw "explode" function to "raw_explode" to emphasize its meaning;
wenzelm
parents:
40525
diff
changeset
|
175 |
Scan.many1 (member (op =) (raw_explode "!#$%&*+-/:<=>?@\\^`|~") o Symbol_Pos.symbol); |
24579 | 176 |
|
24596 | 177 |
in |
178 |
||
24579 | 179 |
val scan_ident = scan_alphanumeric || scan_symbolic; |
180 |
||
181 |
val scan_longident = |
|
27772 | 182 |
(Scan.repeat1 (scan_alphanumeric @@@ $$$ ".") >> flat) @@@ (scan_ident || $$$ "="); |
24579 | 183 |
|
27772 | 184 |
val scan_typevar = $$$ "'" @@@ scan_letdigs; |
24579 | 185 |
|
24596 | 186 |
end; |
24579 | 187 |
|
188 |
||
189 |
(* numerals *) |
|
190 |
||
24596 | 191 |
local |
192 |
||
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
193 |
val scan_dec = Scan.many1 (Symbol.is_ascii_digit o Symbol_Pos.symbol); |
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
194 |
val scan_hex = Scan.many1 (Symbol.is_ascii_hex o Symbol_Pos.symbol); |
27772 | 195 |
val scan_sign = Scan.optional ($$$ "~") []; |
196 |
val scan_decint = scan_sign @@@ scan_dec; |
|
24579 | 197 |
|
24596 | 198 |
in |
199 |
||
27772 | 200 |
val scan_word = |
201 |
$$$ "0" @@@ $$$ "w" @@@ $$$ "x" @@@ scan_hex || |
|
202 |
$$$ "0" @@@ $$$ "w" @@@ scan_dec; |
|
24579 | 203 |
|
27772 | 204 |
val scan_int = scan_sign @@@ ($$$ "0" @@@ $$$ "x" @@@ scan_hex || scan_dec); |
24579 | 205 |
|
27772 | 206 |
val scan_exp = ($$$ "E" || $$$ "e") @@@ scan_decint; |
24579 | 207 |
|
208 |
val scan_real = |
|
27772 | 209 |
scan_decint @@@ $$$ "." @@@ scan_dec @@@ Scan.optional scan_exp [] || |
210 |
scan_decint @@@ scan_exp; |
|
24579 | 211 |
|
24596 | 212 |
end; |
213 |
||
24579 | 214 |
|
215 |
(* chars and strings *) |
|
216 |
||
24596 | 217 |
local |
218 |
||
219 |
val scan_escape = |
|
40627
becf5d5187cc
renamed raw "explode" function to "raw_explode" to emphasize its meaning;
wenzelm
parents:
40525
diff
changeset
|
220 |
Scan.one (member (op =) (raw_explode "\"\\abtnvfr") o Symbol_Pos.symbol) >> single || |
27772 | 221 |
$$$ "^" @@@ (Scan.one (fn (s, _) => ord "@" <= ord s andalso ord s <= ord "_") >> single) || |
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
222 |
Scan.one (Symbol.is_ascii_digit o Symbol_Pos.symbol) -- |
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
223 |
Scan.one (Symbol.is_ascii_digit o Symbol_Pos.symbol) -- |
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
224 |
Scan.one (Symbol.is_ascii_digit o Symbol_Pos.symbol) >> (fn ((a, b), c) => [a, b, c]); |
24596 | 225 |
|
226 |
val scan_str = |
|
30600
de241396389c
allow non-printable symbols within string tokens;
wenzelm
parents:
30593
diff
changeset
|
227 |
Scan.one (fn (s, _) => Symbol.is_regular s andalso s <> "\"" andalso s <> "\\" andalso |
de241396389c
allow non-printable symbols within string tokens;
wenzelm
parents:
30593
diff
changeset
|
228 |
(not (Symbol.is_char s) orelse Symbol.is_printable s)) >> single || |
27772 | 229 |
$$$ "\\" @@@ !!! "bad escape character in string" scan_escape; |
24596 | 230 |
|
27772 | 231 |
val scan_gap = $$$ "\\" @@@ scan_blanks1 @@@ $$$ "\\"; |
232 |
val scan_gaps = Scan.repeat scan_gap >> flat; |
|
24579 | 233 |
|
24596 | 234 |
in |
24579 | 235 |
|
236 |
val scan_char = |
|
27772 | 237 |
$$$ "#" @@@ $$$ "\"" @@@ scan_gaps @@@ scan_str @@@ scan_gaps @@@ $$$ "\""; |
24579 | 238 |
|
239 |
val scan_string = |
|
27772 | 240 |
$$$ "\"" @@@ !!! "missing quote at end of string" |
241 |
((Scan.repeat (scan_gap || scan_str) >> flat) @@@ $$$ "\""); |
|
24596 | 242 |
|
243 |
end; |
|
24579 | 244 |
|
245 |
||
30645 | 246 |
(* scan tokens *) |
24579 | 247 |
|
248 |
local |
|
249 |
||
30593 | 250 |
fun token k ss = Token (Symbol_Pos.range ss, (k, Symbol_Pos.content ss)); |
24579 | 251 |
|
30593 | 252 |
val scan_ml = |
27772 | 253 |
(scan_char >> token Char || |
254 |
scan_string >> token String || |
|
255 |
scan_blanks1 >> token Space || |
|
30573 | 256 |
Symbol_Pos.scan_comment !!! >> token Comment || |
27772 | 257 |
Scan.max token_leq |
258 |
(scan_keyword >> token Keyword) |
|
259 |
(scan_word >> token Word || |
|
260 |
scan_real >> token Real || |
|
261 |
scan_int >> token Int || |
|
262 |
scan_longident >> token LongIdent || |
|
263 |
scan_ident >> token Ident || |
|
264 |
scan_typevar >> token TypeVar)); |
|
265 |
||
30645 | 266 |
val scan_antiq = Antiquote.scan || scan_ml >> Antiquote.Text; |
267 |
||
27772 | 268 |
fun recover msg = |
40525
14a2e686bdac
eliminated slightly odd pervasive Symbol_Pos.symbol;
wenzelm
parents:
40523
diff
changeset
|
269 |
Scan.many (((not o Symbol.is_blank) andf Symbol.is_regular) o Symbol_Pos.symbol) |
27772 | 270 |
>> (fn cs => [token (Error msg) cs]); |
24579 | 271 |
|
272 |
in |
|
273 |
||
24596 | 274 |
fun source src = |
30573 | 275 |
Symbol_Pos.source (Position.line 1) src |
30593 | 276 |
|> Source.source Symbol_Pos.stopper (Scan.bulk (!!! "bad input" scan_ml)) (SOME (false, recover)); |
30591 | 277 |
|
40523
1050315f6ee2
simplified/robustified treatment of malformed symbols, which are now fully internalized (total Symbol.explode etc.);
wenzelm
parents:
40337
diff
changeset
|
278 |
val tokenize = Source.of_string #> Symbol.source #> source #> Source.exhaust; |
24579 | 279 |
|
37198
3af985b10550
replaced ML_Lex.read_antiq by more concise ML_Lex.read, which includes full read/report with explicit position information;
wenzelm
parents:
37195
diff
changeset
|
280 |
fun read pos txt = |
3af985b10550
replaced ML_Lex.read_antiq by more concise ML_Lex.read, which includes full read/report with explicit position information;
wenzelm
parents:
37195
diff
changeset
|
281 |
let |
39507
839873937ddd
tuned signature of (Context_)Position.report variants;
wenzelm
parents:
38474
diff
changeset
|
282 |
val _ = Position.report pos Markup.ML_source; |
37198
3af985b10550
replaced ML_Lex.read_antiq by more concise ML_Lex.read, which includes full read/report with explicit position information;
wenzelm
parents:
37195
diff
changeset
|
283 |
val syms = Symbol_Pos.explode (txt, pos); |
37209
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
284 |
val termination = |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
285 |
if null syms then [] |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
286 |
else |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
287 |
let |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
288 |
val pos1 = List.last syms |-> Position.advance; |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
289 |
val pos2 = Position.advance Symbol.space pos1; |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
290 |
in [Antiquote.Text (Token (Position.range pos1 pos2, (Space, Symbol.space)))] end; |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
291 |
val input = |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
292 |
(Source.of_list syms |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
293 |
|> Source.source Symbol_Pos.stopper (Scan.bulk (!!! "bad input" scan_antiq)) |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
294 |
(SOME (false, fn msg => recover msg >> map Antiquote.Text)) |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
295 |
|> Source.exhaust |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
296 |
|> tap (List.app (Antiquote.report report_token)) |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
297 |
|> tap Antiquote.check_nesting |
40337
d25bbb5f1c9e
warn in correlation with report -- avoid spurious message duplicates;
wenzelm
parents:
40319
diff
changeset
|
298 |
|> tap (List.app (fn Antiquote.Text tok => (check_content_of tok; warn tok) | _ => ()))) |
37209
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
299 |
handle ERROR msg => |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
300 |
cat_error msg ("The error(s) above occurred in ML source" ^ Position.str_of pos); |
1c8cf0048934
terminate ML compiler input produced by ML_Lex.read (cf. 85e864045497);
wenzelm
parents:
37198
diff
changeset
|
301 |
in input @ termination end; |
30645 | 302 |
|
24579 | 303 |
end; |
304 |
||
24596 | 305 |
end; |
24579 | 306 |