/[svn]/parser/parser.ml
ViewVC logotype

Contents of /parser/parser.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 501 - (hide annotations)
Tue Jul 10 17:39:47 2007 UTC (5 years, 11 months ago) by abate
File size: 16221 byte(s)
[r2003-06-12 13:15:56 by cvscast] Merging schema branch

Original author: cvscast
Date: 2003-06-12 13:16:00+00:00
1 abate 4 open Location
2     open Ast
3 abate 225 open Ident
4 abate 501 open Printf
5 abate 4
6 abate 161 (*
7 abate 151 let () = Grammar.error_verbose := true
8 abate 161 *)
9 abate 81
10 abate 469
11 abate 81 let gram = Grammar.gcreate (Wlexer.lexer Wlexer.token Wlexer.latin1_engine)
12    
13 abate 421 let true_atom = Atoms.mk_ascii "true"
14     let false_atom = Atoms.mk_ascii "false"
15     let true_type = Types.atom (Atoms.atom true_atom)
16     let false_type = Types.atom (Atoms.atom false_atom)
17 abate 81
18 abate 374 let parse_ident = Encodings.Utf8.mk_latin1
19    
20 abate 375 let id_dummy = ident (U.mk "$$$")
21     let atom s = Atoms.mk (parse_ident s)
22 abate 374 let label s = LabelPool.mk (parse_ident s)
23 abate 375 let ident s = ident (parse_ident s)
24 abate 374
25 abate 38 let prog = Grammar.Entry.create gram "prog"
26 abate 431 let top_phrases = Grammar.Entry.create gram "toplevel phrases"
27 abate 38 let expr = Grammar.Entry.create gram "expression"
28     let pat = Grammar.Entry.create gram "type/pattern expression"
29     let regexp = Grammar.Entry.create gram "type/pattern regexp"
30     let const = Grammar.Entry.create gram "scalar constant"
31    
32 abate 316 let exp pos e = LocatedExpr (loc_of_pos pos,e)
33    
34 abate 38 let rec multi_prod loc = function
35     | [ x ] -> x
36     | x :: l -> mk loc (Prod (x, multi_prod loc l))
37     | [] -> assert false
38    
39 abate 316 let rec tuple = function
40 abate 38 | [ x ] -> x
41 abate 316 | x :: l -> Pair (x, tuple l)
42 abate 38 | [] -> assert false
43 abate 89
44     let tuple_queue =
45 abate 316 List.fold_right (fun x q -> Pair (x, q))
46 abate 89
47 abate 233
48 abate 249 let char = mknoloc (Internal (Types.char Chars.any))
49 abate 66 let string_regexp = Star (Elem char)
50 abate 38
51 abate 316 let cst_nil = Cst (Types.Atom Sequence.nil_atom)
52 abate 38
53 abate 66 let seq_of_string pos s =
54 abate 310 let s = Encodings.Utf8.mk s in
55 abate 66 let (pos,_) = pos in
56 abate 310 let rec aux pos i j =
57     if Encodings.Utf8.equal_index i j then []
58     else
59 abate 325 let (len,i) = Encodings.Utf8.next s i in
60 abate 310 let (c,i) = Encodings.Utf8.next s i in
61 abate 325 ((pos,pos+len),c) :: (aux (pos + len) i j)
62 abate 310 in
63 abate 325 aux (pos+1) (Encodings.Utf8.start_index s) (Encodings.Utf8.end_index s)
64 abate 4
65 abate 326 let get_string s =
66     let s = Encodings.Utf8.mk s in
67     let b = Buffer.create 32 in
68     let rec aux i j =
69     if Encodings.Utf8.equal_index i j then ()
70     else
71     let (len,i) = Encodings.Utf8.next s i in
72     let (c,i) = Encodings.Utf8.next s i in
73     Encodings.Utf8.store b c;
74     aux i j
75     in
76     aux (Encodings.Utf8.start_index s) (Encodings.Utf8.end_index s);
77     Buffer.contents b
78    
79 abate 81 exception Error of string
80 abate 249 let error (i,j) s = Location.raise_loc i j (Error s)
81 abate 18
82 abate 233 let make_record loc r =
83     LabelMap.from_list (fun _ _ -> error loc "Duplicated record field") r
84    
85 abate 81 let parse_char loc s =
86 abate 310 let s = seq_of_string loc s in
87     match s with
88 abate 325 | [ loc,c ] -> c
89 abate 310 | _ -> error loc "Character litteral must have length 1"
90 abate 81
91 abate 325 let char_list loc s =
92     let s = seq_of_string loc s in
93 abate 316 List.map (fun (loc,c) -> exp loc (Cst (Types.Char (Chars.mk_int c)))) s
94 abate 18
95 abate 249 let include_stack = ref []
96    
97 abate 448 let protect_exn f g =
98     try let x = f () in g (); x
99     with e -> g (); raise e
100    
101 abate 470 let is_fun_decl =
102     Grammar.Entry.of_parser gram "[is_fun_decl]"
103     (fun strm ->
104     match Stream.npeek 3 strm with
105     | [ ("", "fun"); ("LIDENT", _); ("", "(") ]
106     | [ ("LIDENT", _) ; ("", "(") ; _ ] -> ()
107     | _ -> raise Stream.Failure
108     )
109    
110 abate 501 let dot_RE = Pcre.regexp "\\."
111 abate 470
112 abate 38 EXTEND
113 abate 431 GLOBAL: top_phrases prog expr pat regexp const;
114 abate 4
115 abate 431 top_phrases: [
116 abate 446 [ l = LIST0 phrase; ";;" -> List.flatten l ]
117 abate 431 ];
118    
119 abate 10 prog: [
120 abate 431 [ l = LIST0 [ p = phrase ; OPT ";;" -> p ]; EOI -> List.flatten l ]
121 abate 10 ];
122    
123 abate 13 phrase: [
124 abate 431 [ (f,p,e) = let_binding ->
125     if f then [ mk loc (FunDecl e) ] else
126     [ mk loc (LetDecl (p,e)) ]
127     | (_,p,e1) = let_binding; "in"; e2 = expr LEVEL "top"->
128 abate 316 [ mk loc (EvalStatement (exp loc (Match (e1,[p,e2])))) ]
129 abate 431 | "type"; x = UIDENT; "="; t = pat -> [ mk loc (TypeDecl (x,t)) ]
130     | "type"; x = LIDENT -> error loc "Type identifiers must be capitalized"
131 abate 501 | "schema"; name = UIDENT; "="; uri = STRING2 ->
132     let schema_doc = Schema_xml.pxp_tree_of (get_string uri) in
133     let schema = Schema_parser.parse_schema schema_doc in
134     [ mk loc (SchemaDecl (name, schema))]
135 abate 431 | "debug"; d = debug_directive -> [ mk loc (Debug d) ]
136 abate 446 | DIRECTIVE "#quit" -> [ mk loc (Directive `Quit) ]
137     | DIRECTIVE "#env" -> [ mk loc (Directive `Env) ]
138 abate 431 | "include"; s = STRING2 ->
139 abate 326 let s = get_string s in
140 abate 471 let s =
141     if Filename.is_relative s
142     then Filename.concat (Location.current_dir ()) s
143     else s in
144 abate 249 protect_op "File inclusion";
145     (* avoid looping; should issue an error ? *)
146 abate 471 (* it is possible to have looping with x/../x/../x/.. ....
147     Need to canonicalize filename *)
148 abate 249 if List.mem s !include_stack then []
149     else (
150     include_stack := s :: !include_stack;
151     Location.push_source (`File s);
152 abate 448 protect_exn
153     (fun () ->
154     let chan = open_in s in
155 abate 471 protect_exn
156     (fun () ->
157     let input = Stream.of_channel chan in
158     Grammar.Entry.parse prog input)
159     (fun () -> close_in chan))
160 abate 448 (fun () ->
161     Location.pop_source ();
162     include_stack := List.tl !include_stack)
163 abate 249 )
164 abate 66 ] |
165 abate 249 [ e = expr -> [ mk loc (EvalStatement e) ]
166 abate 43 ]
167 abate 13 ];
168    
169 abate 43 debug_directive: [
170     [ LIDENT "filter"; t = pat; p = pat -> `Filter(t,p)
171 abate 75 | LIDENT "accept"; p = pat -> `Accept p
172 abate 43 | LIDENT "compile"; t = pat; p = LIST1 pat -> `Compile (t,p)
173 abate 407 | LIDENT "sample"; t = pat -> `Sample t
174 abate 224 | LIDENT "subtype"; t1 = pat; t2 = pat -> `Subtype (t1,t2)
175 abate 43 ]
176     ];
177    
178 abate 332 keyword: [
179     [ a =
180     [ "map" | "match" | "with" | "try" | "xtransform"
181     | "if" | "then" | "else"
182     | "transform" | "fun" | "in"
183 abate 431 | "let" | "type" | "debug" | "include"
184 abate 501 | "and" | "validate" | "schema"
185 abate 332 ]
186     -> a
187     ]
188     ];
189    
190 abate 4 expr: [
191     "top" RIGHTA
192 abate 421 [ "match"; e = SELF; "with"; b = branches ->
193     exp loc (Match (e,b))
194 abate 64 | "try"; e = SELF; "with"; b = branches ->
195 abate 425 exp loc (Try (e,b))
196 abate 421 | "map"; e = SELF; "with"; b = branches ->
197     exp loc (Map (e,b))
198     | "xtransform"; e = SELF; "with"; b = branches ->
199     exp loc (Xtrans (e,b))
200 abate 237 | "if"; e = SELF; "then"; e1 = SELF; "else"; e2 = SELF ->
201 abate 421 let p1 = mk loc (Internal true_type)
202     and p2 = mk loc (Internal false_type) in
203 abate 316 exp loc (Match (e, [p1,e1; p2,e2]))
204 abate 17 | "transform"; e = SELF; "with"; b = branches ->
205 abate 421 exp loc (Transform (e,b))
206 abate 501 | "validate"; e = SELF; "with"; schema = UIDENT; "#";
207     typ = [ UIDENT | LIDENT | keyword ] ->
208     exp loc (Validate (e, schema, typ))
209 abate 48 | "fun"; (f,a,b) = fun_decl ->
210 abate 316 exp loc (Abstraction { fun_name = f; fun_iface = a; fun_body = b })
211 abate 431 | (_,p,e1) = let_binding; "in"; e2 = expr LEVEL "top"->
212 abate 316 exp loc (Match (e1,[p,e2]))
213 abate 54 | e = expr; ":"; p = pat ->
214 abate 316 exp loc (Forget (e,p))
215 abate 4 ]
216    
217    
218 abate 15 |
219 abate 237 [ e1 = expr; op = ["=" | "<=" | "<<" | ">>" | ">=" ]; e2 = expr ->
220     let op = match op with
221     | "<<" -> "<"
222     | ">>" -> ">"
223     | s -> s in
224 abate 316 exp loc (Op (op,[e1;e2]))
225 abate 237 ]
226    
227     |
228 abate 242 [ e1 = expr; op = ["+" | "-" | "@" ]; e2 = expr ->
229 abate 316 exp loc (Op (op,[e1;e2]))
230 abate 339 | e = expr; "\\"; l = [LIDENT | UIDENT | keyword ] ->
231 abate 374 exp loc (RemoveField (e, label l))
232 abate 51 ]
233 abate 16 |
234 abate 316 [ e1 = expr; op = ["*"]; e2 = expr -> exp loc (Op (op,[e1;e2]))
235 abate 151 | e = expr; op = "/"; p = pat ->
236    
237     let tag = mk loc (Internal (Types.atom (Atoms.any))) in
238     let att = mk loc (Internal Types.Record.any) in
239     let any = mk loc (Internal (Types.any)) in
240 abate 375 let re = Star(Alt(SeqCapture(id_dummy,Elem p), Elem any)) in
241 abate 151 let ct = mk loc (Regexp (re,any)) in
242     let p = mk loc (XmlT (tag, multi_prod loc [att;ct])) in
243 abate 375 let b = (p, Var id_dummy) in
244 abate 421 exp loc (Transform (e,[b]))
245 abate 51 ]
246 abate 26 |
247 abate 339 [ e = expr; "."; l = [LIDENT | UIDENT | keyword ] ->
248 abate 374 exp loc (Dot (e, label l))
249 abate 51 ]
250 abate 26
251 abate 52 |
252 abate 66 [ op = [ LIDENT "flatten"
253     | LIDENT "load_xml"
254 abate 374 | LIDENT "load_file" | LIDENT "load_file_utf8"
255 abate 188 | LIDENT "load_html"
256 abate 374 | LIDENT "print_xml" | LIDENT "print_xml_utf8"
257 abate 124 | LIDENT "print"
258 abate 66 | LIDENT "int_of"
259 abate 133 | LIDENT "string_of"
260 abate 329 | LIDENT "atom_of"
261 abate 421 | LIDENT "raise"
262 abate 66 ];
263 abate 316 e = expr -> exp loc (Op (op,[e]))
264 abate 374 | op = [ LIDENT "dump_to_file" | LIDENT "dump_to_file_utf8" ];
265 abate 316 e1 = expr LEVEL "no_appl"; e2 = expr -> exp loc (Op (op, [e1;e2]))
266     | e1 = SELF; LIDENT "div"; e2 = expr -> exp loc (Op ("/", [e1;e2]))
267     | e1 = SELF; LIDENT "mod"; e2 = expr -> exp loc (Op ("mod", [e1;e2]))
268     | e1 = SELF; e2 = expr -> exp loc (Apply (e1,e2))
269 abate 52 ]
270    
271 abate 4 | "no_appl"
272 abate 316 [ c = const -> exp loc (Cst c)
273     | "("; l = LIST1 expr SEP ","; ")" -> exp loc (tuple l)
274 abate 18 | "["; l = LIST0 seq_elem; e = OPT [ ";"; e = expr -> e ]; "]" ->
275     let e = match e with Some e -> e | None -> cst_nil in
276 abate 321 let l = List.fold_right
277     (fun x q ->
278     match x with
279     | `Elems l -> tuple_queue l q
280     | `Explode x -> Op ("@",[x;q])
281     ) l e
282     in
283     exp loc l
284 abate 332 | "<"; t = [ "("; e = expr; ")" -> e
285     | a = [ LIDENT | UIDENT | keyword ] ->
286 abate 375 exp loc (Cst (Types.Atom (atom a))) ];
287 abate 81 a = expr_attrib_spec; ">"; c = expr ->
288 abate 316 exp loc (Xml (t, Pair (a,c)))
289     | "{"; r = [ expr_record_spec | -> exp loc (RecordLitt LabelMap.empty) ]; "}" -> r
290 abate 81 | s = STRING2 ->
291 abate 316 exp loc (tuple (char_list loc s @ [cst_nil]))
292 abate 375 | a = LIDENT -> exp loc (Var (ident a))
293 abate 4 ]
294    
295     ];
296 abate 18
297     seq_elem: [
298 abate 89 [ x = STRING1 -> `Elems (char_list loc x)
299     | e = expr LEVEL "no_appl" -> `Elems [e]
300     | "!"; e = expr LEVEL "no_appl" -> `Explode e
301 abate 18 ]
302     ];
303 abate 4
304     let_binding: [
305 abate 470 [ "let"; is_fun_decl; OPT "fun"; (f,a,b) = fun_decl ->
306     let f = match f with Some x -> x | None -> assert false in
307     let p = mk loc (Capture f) in
308     let abst = { fun_name = Some f; fun_iface = a; fun_body = b } in
309 abate 316 let e = exp loc (Abstraction abst) in
310 abate 431 (true,p,e)
311 abate 470 | "let"; p = pat; "="; e = expr -> (false,p,e)
312     | "let"; p = pat; ":"; t = pat; "="; e = expr -> (false,p, Forget (e,t))
313 abate 4 ]
314     ];
315    
316 abate 470 fun_decl_after_lparen: [
317 abate 85 (* need an hack to do this, because both productions would
318     match [ OPT LIDENT; "("; pat ] .... *)
319 abate 470 [ p1 = pat LEVEL "no_arrow";
320     res = [ "->"; p2 = pat;
321     a = [ ";"; a = LIST0 arrow SEP ";" -> a | -> [] ];
322     ")"; b = branches -> `Classic (p2,a,b)
323     | ":"; targ1 = pat;
324     args = LIST0 [ ","; arg = pat; ":"; targ = pat -> (arg,targ) ];
325     ")"; ":"; tres = pat ;
326     "="; body = expr ->
327     `Compact (targ1,args,tres,body)
328     ] ->
329     match res with
330     | `Classic (p2,a,b) -> (p1,p2)::a,b
331     | `Compact (targ1,args,tres,body) ->
332     let args = (p1,targ1) :: args in
333     let targ = multi_prod nopos (List.map snd args) in
334     let arg = multi_prod nopos (List.map fst args) in
335     let b = [arg, body] in
336     let a = [targ,tres] in
337     (a,b) ] ];
338    
339    
340     fun_decl: [
341     [ f = OPT [ x = LIDENT -> ident x]; "("; (a,b) = fun_decl_after_lparen ->
342 abate 85 (f,a,b)
343 abate 470 ]
344 abate 48 ];
345    
346 abate 85 arrow: [
347 abate 9 [ t1 = pat LEVEL "no_arrow"; "->"; t2 = pat -> (t1,t2)]
348 abate 4 ];
349    
350     branches: [
351 abate 81 [ OPT "|"; l = LIST1 branch SEP "|" -> l ]
352 abate 4 ];
353    
354     branch: [
355 abate 6 [ p = pat LEVEL "no_arrow"; "->"; e = expr -> (p,e) ]
356 abate 4 ];
357    
358    
359     regexp: [
360 abate 236 [ x = regexp; "|"; y = regexp ->
361     match (x,y) with
362     | Elem x, Elem y -> Elem (mk loc (Or (x,y)))
363     | _ -> Alt (x,y)
364     ]
365 abate 4 | [ x = regexp; y = regexp -> Seq (x,y) ]
366 abate 375 | [ a = LIDENT; "::"; x = regexp -> SeqCapture (ident a,x) ]
367 abate 4 | [ x = regexp; "*" -> Star x
368     | x = regexp; "*?" -> WeakStar x
369     | x = regexp; "+" -> Seq (x, Star x)
370     | x = regexp; "+?" -> Seq (x, WeakStar x)
371 abate 71 | x = regexp; "?" -> Alt (x, Epsilon)
372 abate 4 | x = regexp; "??" -> Alt (Epsilon, x) ]
373     | [ "("; x = regexp; ")" -> x
374 abate 225 | "("; a = LIDENT; ":="; c = const; ")" ->
375 abate 375 Elem (mk loc (Constant ((ident a,c))))
376 abate 66 | UIDENT "PCDATA" -> string_regexp
377 abate 81 | i = STRING1; "--"; j = STRING1 ->
378 abate 310 let i = Chars.mk_int (parse_char loc i)
379     and j = Chars.mk_int (parse_char loc j) in
380 abate 66 Elem (mk loc (Internal (Types.char (Chars.char_class i j))))
381 abate 81 | s = STRING1 ->
382     let s = seq_of_string loc s in
383 abate 18 List.fold_right
384 abate 66 (fun (loc,c) accu ->
385 abate 310 let c = Chars.mk_int c in
386 abate 18 let c = Chars.atom c in
387     Seq (Elem (mk loc (Internal (Types.char c))), accu))
388     s
389 abate 66 Epsilon
390 abate 4 | e = pat LEVEL "simple" -> Elem e
391     ]
392     ];
393    
394     pat: [
395 abate 332 [ x = pat; LIDENT "where";
396 abate 338 b = LIST1 [ a = UIDENT; "="; y = pat -> (a,y)
397     | LIDENT -> error loc "Type/pattern identifiers must be capitalized"
398     ] SEP "and"
399 abate 4 -> mk loc (Recurs (x,b)) ]
400     | RIGHTA [ x = pat; "->"; y = pat -> mk loc (Arrow (x,y)) ]
401 abate 6 | "no_arrow" [ x = pat; "|"; y = pat -> mk loc (Or (x,y)) ]
402 abate 121 | "simple" [ x = pat; "&"; y = pat -> mk loc (And (x,y))
403 abate 99 | x = pat; "\\"; y = pat -> mk loc (Diff (x,y)) ]
404 abate 4 |
405 abate 159 [ "{"; r = record_spec; "}" -> mk loc (Record (true,r))
406     | "{|"; r = record_spec; "|}" -> mk loc (Record (false,r))
407 abate 4 | LIDENT "_" -> mk loc (Internal Types.any)
408 abate 375 | a = LIDENT -> mk loc (Capture (ident a))
409 abate 225 | "("; a = LIDENT; ":="; c = const; ")" ->
410 abate 375 mk loc (Constant (ident a,c))
411 abate 501 | schema = UIDENT; "#"; typ = [ UIDENT | LIDENT | keyword ];
412     k = OPT [ "as"; k = [ "element" | "type" | "attribute" ] -> k ] ->
413     let kind =
414     match k with
415     | None -> `Any
416     | Some "element" -> `Element
417     | Some "type" -> `Type
418     | Some "attribute" -> `Attribute
419     | _ -> assert false
420     in
421     mk loc (SchemaVar (kind, schema, typ))
422 abate 4 | a = UIDENT -> mk loc (PatVar a)
423     | i = INT ; "--"; j = INT ->
424 abate 222 let i = Intervals.mk i
425     and j = Intervals.mk j in
426 abate 52 mk loc (Internal (Types.interval (Intervals.bounded i j)))
427     | i = INT ->
428 abate 222 let i = Intervals.mk i in
429 abate 52 mk loc (Internal (Types.interval (Intervals.atom i)))
430 abate 81 | "*"; "--"; j = INT ->
431 abate 222 let j = Intervals.mk j in
432 abate 52 mk loc (Internal (Types.interval (Intervals.left j)))
433 abate 81 | i = INT; "--"; "*" ->
434 abate 222 let i = Intervals.mk i in
435 abate 52 mk loc (Internal (Types.interval (Intervals.right i)))
436 abate 19 | i = char ->
437     mk loc (Internal (Types.char (Chars.char_class i i)))
438 abate 13 | i = char ; "--"; j = char ->
439 abate 18 mk loc (Internal (Types.char (Chars.char_class i j)))
440 abate 4 | c = const -> mk loc (Internal (Types.constant c))
441     | "("; l = LIST1 pat SEP ","; ")" -> multi_prod loc l
442     | "["; r = [ r = regexp -> r | -> Epsilon ];
443     q = [ ";"; q = pat -> q
444 abate 249 | -> mknoloc (Internal (Sequence.nil_type)) ];
445 abate 4 "]" -> mk loc (Regexp (r,q))
446 abate 332 | "<"; t =
447     [ x = [ LIDENT | UIDENT | keyword ] ->
448 abate 375 let a = if x = "_" then Atoms.any else Atoms.atom (atom x) in
449 abate 332 mk loc (Internal (Types.atom a))
450     | "("; t = pat; ")" -> t ];
451 abate 81 a = attrib_spec; ">"; c = pat ->
452 abate 110 mk loc (XmlT (t, multi_prod loc [a;c]))
453 abate 81 | s = STRING2 ->
454     let s = seq_of_string loc s in
455 abate 63 let s = List.map
456 abate 66 (fun (loc,c) ->
457 abate 63 mk loc (Internal
458     (Types.char
459     (Chars.atom
460 abate 310 (Chars.mk_int c))))) s in
461 abate 63 let s = s @ [mk loc (Internal (Sequence.nil_type))] in
462     multi_prod loc s
463 abate 4 ]
464    
465     ];
466    
467     record_spec:
468 abate 339 [ [ r = LIST0 [ l = [LIDENT | UIDENT | keyword ]; "=";
469 abate 81 o = [ "?" -> true | -> false];
470 abate 229 x = pat ->
471     let x = if o then mk loc (Optional x) else x in
472 abate 374 (label l, x)
473 abate 4 ] SEP ";" ->
474 abate 233 make_record loc r
475 abate 4 ] ];
476    
477 abate 13 char:
478     [
479 abate 310 [ c = STRING1 -> Chars.mk_int (parse_char loc c) ]
480 abate 13 ];
481    
482    
483 abate 4 const:
484     [
485 abate 222 [ i = INT -> Types.Integer (Intervals.mk i)
486 abate 375 | "`"; a = [LIDENT | UIDENT | keyword ] -> Types.Atom (atom a)
487 abate 13 | c = char -> Types.Char c ]
488 abate 4 ];
489    
490    
491     attrib_spec:
492 abate 159 [ [ r = record_spec -> mk loc (Record (true,r))
493 abate 252 | "("; t = pat; ")" -> t
494     | "{"; r = record_spec; "}" -> mk loc (Record (true,r))
495     | "{|"; r = record_spec; "|}" -> mk loc (Record (false,r))
496     ] ];
497 abate 4
498     expr_record_spec:
499     [ [ r = LIST1
500 abate 339 [ l = [LIDENT | UIDENT | keyword ]; "="; x = expr ->
501 abate 374 (label l,x) ]
502 abate 4 SEP ";" ->
503 abate 316 exp loc (RecordLitt (make_record loc r))
504 abate 4 ] ];
505    
506     expr_attrib_spec:
507     [ [ r = expr_record_spec -> r ]
508     | [ e = expr LEVEL "no_appl" -> e
509 abate 316 | -> exp loc (RecordLitt (LabelMap.empty))
510 abate 4 ]
511     ];
512     END
513    
514 abate 10 let pat = Grammar.Entry.parse pat
515 abate 81 and expr = Grammar.Entry.parse expr
516     and prog = Grammar.Entry.parse prog
517 abate 431 and top_phrases = Grammar.Entry.parse top_phrases
518 abate 10
519 abate 495 let sync () =
520     match !Wlexer.lexbuf with
521     | None -> ()
522     | Some lb ->
523     let rec aux () =
524     match !Wlexer.last_tok with
525     | ("",";;") | ("EOI","") -> ()
526     | _ ->
527     Wlexer.last_tok := Wlexer.token Wlexer.latin1_engine lb;
528     aux ()
529     in
530     aux ()

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5