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

Diff of /parser/parser.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 325 by abate, Tue Jul 10 17:25:18 2007 UTC revision 326 by abate, Tue Jul 10 17:25:21 2007 UTC
# Line 48  Line 48 
48    in    in
49    aux (pos+1) (Encodings.Utf8.start_index s) (Encodings.Utf8.end_index s)    aux (pos+1) (Encodings.Utf8.start_index s) (Encodings.Utf8.end_index s)
50    
51    let get_string s =
52      let s = Encodings.Utf8.mk s in
53      let b = Buffer.create 32 in
54      let rec aux i j =
55        if Encodings.Utf8.equal_index i j then ()
56        else
57          let (len,i) = Encodings.Utf8.next s i in
58          let (c,i) = Encodings.Utf8.next s i in
59          Encodings.Utf8.store b c;
60          aux i j
61      in
62      aux (Encodings.Utf8.start_index s) (Encodings.Utf8.end_index s);
63      Buffer.contents b
64    
65  exception Error of string  exception Error of string
66  let error (i,j) s = Location.raise_loc i j (Error s)  let error (i,j) s = Location.raise_loc i j (Error s)
67    
# Line 81  Line 95 
95      | LIDENT "type"; x = UIDENT; "="; t = pat -> [ mk loc (TypeDecl (x,t)) ]      | LIDENT "type"; x = UIDENT; "="; t = pat -> [ mk loc (TypeDecl (x,t)) ]
96      | LIDENT "debug"; d = debug_directive -> [ mk loc (Debug d) ]      | LIDENT "debug"; d = debug_directive -> [ mk loc (Debug d) ]
97      | LIDENT "include"; s = STRING2 ->      | LIDENT "include"; s = STRING2 ->
98            let s = get_string s in
99          protect_op "File inclusion";          protect_op "File inclusion";
100          (* avoid looping; should issue an error ? *)          (* avoid looping; should issue an error ? *)
101          if List.mem s !include_stack then []          if List.mem s !include_stack then []

Legend:
Removed from v.325  
changed lines
  Added in v.326

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