Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
ae22e456
Commit
ae22e456
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2003-11-20 13:33:33 by afrisch] Bug fix: file name in error messages for included files
Original author: afrisch Date: 2003-11-20 13:33:33+00:00
parent
d2518722
Changes
3
Hide whitespace changes
Inline
Side-by-side
driver/cduce.ml
View file @
ae22e456
...
...
@@ -345,17 +345,11 @@ let catch_exn ppf_err exn =
Format
.
fprintf
ppf_err
"@."
let
parse
rule
input
=
try
Some
(
rule
input
)
with
|
Stdpp
.
Exc_located
(
_
,
(
Location
_
as
e
))
->
Parser
.
sync
()
;
raise
e
|
Stdpp
.
Exc_located
((
i
,
j
)
,
e
)
->
Parser
.
sync
()
;
raise_loc
i
j
e
try
Parser
.
localize_exn
(
fun
()
->
rule
input
)
with
e
->
Parser
.
sync
()
;
raise
e
let
run
rule
ppf
ppf_err
input
=
try
match
parse
rule
input
with
|
Some
phs
->
phrases
ppf
phs
;
true
|
None
->
false
try
phrases
ppf
(
parse
rule
input
);
true
with
exn
->
catch_exn
ppf_err
exn
;
false
let
script
=
run
Parser
.
prog
...
...
parser/parser.ml
View file @
ae22e456
...
...
@@ -75,6 +75,13 @@ let protect_exn f g =
try
let
x
=
f
()
in
g
()
;
x
with
e
->
g
()
;
raise
e
let
localize_exn
f
=
try
f
()
with
|
Stdpp
.
Exc_located
(
_
,
(
Location
_
as
e
))
->
raise
e
|
Stdpp
.
Exc_located
((
i
,
j
)
,
e
)
->
raise_loc
i
j
e
let
is_fun_decl
=
Grammar
.
Entry
.
of_parser
gram
"[is_fun_decl]"
(
fun
strm
->
...
...
@@ -155,7 +162,7 @@ EXTEND
protect_exn
(
fun
()
->
let
input
=
Stream
.
of_channel
chan
in
Grammar
.
Entry
.
parse
prog
input
)
localize_exn
(
fun
()
->
Grammar
.
Entry
.
parse
prog
input
)
)
(
fun
()
->
close_in
chan
))
(
fun
()
->
Ulexer
.
enc
:=
saved_enc
;
...
...
parser/parser.mli
View file @
ae22e456
...
...
@@ -6,7 +6,7 @@ val prog : char Stream.t -> Ast.pmodule_item list
val
top_phrases
:
char
Stream
.
t
->
Ast
.
pmodule_item
list
val
sync
:
unit
->
unit
val
localize_exn
:
(
unit
->
'
a
)
->
'
a
(* Hooks to extend the syntax *)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment