File: stdcompat__lexing.ml.in

package info (click to toggle)
ocaml-stdcompat 20~git20240529-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,540 kB
  • sloc: ml: 34,099; sh: 861; makefile: 249
file content (34 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
include Lexing

@BEGIN_BEFORE_4_11_0@
let set_position lexbuf position =
  lexbuf.lex_curr_p <-
    { position with pos_fname = lexbuf.lex_curr_p.pos_fname };
  lexbuf.lex_abs_pos <- position.pos_cnum

let set_filename lexbuf filename =
  lexbuf.lex_curr_p <- { lexbuf.lex_curr_p with pos_fname = filename }
@END_BEFORE_4_11_0@

@BEGIN_BEFORE_4_08_0@
let from_channel ?with_positions:_pos chan =
  from_channel chan

let from_string ?with_positions:_pos s =
  from_string s

let from_function ?with_positions:_pos f =
  from_function f

let with_positions _lexbuf =
  true
@END_BEFORE_4_08_0@

@BEGIN_BEFORE_3_11_0@
let new_line lexbuf =
  let lex_curr_p = lexbuf.Lexing.lex_curr_p in
  if lex_curr_p != Lexing.dummy_pos then
    lexbuf.Lexing.lex_curr_p <- { lex_curr_p with
      Lexing.pos_lnum = succ lex_curr_p.Lexing.pos_lnum;
      Lexing.pos_bol = lex_curr_p.Lexing.pos_cnum; }
@END_BEFORE_3_11_0@