Commit 29c3a402 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-09 10:09:30 by cvscast] Empty log message

Original author: cvscast
Date: 2003-05-09 10:09:31+00:00
parent ed5b4c86
......@@ -12,10 +12,12 @@ parser/location.cmo: parser/location.cmi
parser/location.cmx: parser/location.cmi
parser/parser.cmo: parser/ast.cmo types/atoms.cmi types/builtin.cmo \
types/chars.cmi types/ident.cmo types/intervals.cmi parser/location.cmi \
types/sequence.cmi types/types.cmi parser/parser.cmi
types/sequence.cmi types/types.cmi parser/wlexer.cmo parser/parser.cmi
parser/parser.cmx: parser/ast.cmx types/atoms.cmx types/builtin.cmx \
types/chars.cmx types/ident.cmx types/intervals.cmx parser/location.cmx \
types/sequence.cmx types/types.cmx parser/parser.cmi
types/sequence.cmx types/types.cmx parser/wlexer.cmx parser/parser.cmi
parser/wlexer.cmo: parser/location.cmi
parser/wlexer.cmx: parser/location.cmx
typing/typed.cmo: types/ident.cmo parser/location.cmi types/patterns.cmi \
types/types.cmi
typing/typed.cmx: types/ident.cmx parser/location.cmx types/patterns.cmx \
......@@ -93,15 +95,15 @@ runtime/value.cmx: types/atoms.cmx types/builtin.cmx types/chars.cmx \
driver/cduce.cmo: parser/ast.cmo types/builtin.cmo runtime/eval.cmi \
types/ident.cmo parser/location.cmi parser/parser.cmi types/patterns.cmi \
misc/state.cmi typing/typed.cmo typing/typer.cmi types/types.cmi \
runtime/value.cmi driver/cduce.cmi
runtime/value.cmi parser/wlexer.cmo driver/cduce.cmi
driver/cduce.cmx: parser/ast.cmx types/builtin.cmx runtime/eval.cmx \
types/ident.cmx parser/location.cmx parser/parser.cmx types/patterns.cmx \
misc/state.cmx typing/typed.cmx typing/typer.cmx types/types.cmx \
runtime/value.cmx driver/cduce.cmi
runtime/value.cmx parser/wlexer.cmx driver/cduce.cmi
driver/run.cmo: driver/cduce.cmi parser/location.cmi misc/state.cmi \
types/types.cmi
types/types.cmi parser/wlexer.cmo
driver/run.cmx: driver/cduce.cmx parser/location.cmx misc/state.cmx \
types/types.cmx
types/types.cmx parser/wlexer.cmx
driver/webiface.cmo: driver/cduce.cmi driver/examples.cmo parser/location.cmi \
misc/state.cmi
driver/webiface.cmx: driver/cduce.cmx driver/examples.cmx parser/location.cmx \
......
......@@ -24,6 +24,14 @@ let do_file s =
if s = "" then (`Stream, stdin) else (`File s, open_in s) in
Location.push_source src;
let input = Stream.of_channel chan in
if Stream.peek input = Some '#' then
(
let rec count n =
match Stream.next input with
| '\n' -> n
| _ -> count (n + 1) in
Wlexer.set_delta_loc (count 1)
);
let ok = Cduce.run ppf ppf_err input in
if s <> "" then close_in chan;
if not ok then (Format.fprintf ppf_err "@."; exit 1)
......
......@@ -323,7 +323,12 @@ and string1 engine lexbuf =
# 159 "parser/wlexer.mll"
let delta_loc = ref 0
let set_delta_loc dl = delta_loc := dl
let lexer_func_of_wlex lexfun lexengine cs =
let dl = !delta_loc in
delta_loc := 0;
let lb =
Lexing.from_function
(fun s n ->
......@@ -331,7 +336,8 @@ let lexer_func_of_wlex lexfun lexengine cs =
in
let next () =
let tok = lexfun lexengine lb in
let loc = (Lexing.lexeme_start lb, Lexing.lexeme_end lb) in
let loc = (Lexing.lexeme_start lb + dl,
Lexing.lexeme_end lb + dl) in
(tok, loc)
in
Token.make_stream_and_location next
......
......@@ -158,7 +158,12 @@ and string1 = parse
{
let delta_loc = ref 0
let set_delta_loc dl = delta_loc := dl
let lexer_func_of_wlex lexfun lexengine cs =
let dl = !delta_loc in
delta_loc := 0;
let lb =
Lexing.from_function
(fun s n ->
......@@ -166,7 +171,8 @@ let lexer_func_of_wlex lexfun lexengine cs =
in
let next () =
let tok = lexfun lexengine lb in
let loc = (Lexing.lexeme_start lb, Lexing.lexeme_end lb) in
let loc = (Lexing.lexeme_start lb + dl,
Lexing.lexeme_end lb + dl) in
(tok, loc)
in
Token.make_stream_and_location next
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment