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
b05e438f
Commit
b05e438f
authored
Feb 16, 2015
by
Kim Nguyễn
Browse files
Correctly flush the toplevel output in case the lexer consumes the
"\n" after the ;; token.
parent
36b83c45
Changes
1
Show whitespace changes
Inline
Side-by-side
driver/run.ml
View file @
b05e438f
...
...
@@ -103,6 +103,18 @@ let outflush s =
output_string
stdout
s
;
flush
stdout
let
has_newline
b
=
let
rec
loop
i
found
=
if
i
>=
1
then
let
c
=
Buffer
.
nth
b
i
in
if
c
==
'
;
'
&&
Buffer
.
nth
b
(
i
-
1
)
==
'
;
'
then
found
else
loop
(
i
-
1
)
(
c
==
'\n'
)
else
false
in
loop
(
Buffer
.
length
b
-
1
)
false
let
toploop
()
=
let
restore
=
try
...
...
@@ -141,6 +153,8 @@ let toploop () =
bol
:=
false
;
Buffer
.
clear
buf_in
;
ignore
(
Cduce
.
topinput
ppf
ppf_err
input
);
if
not
(
has_newline
buf_in
)
then
(* ";;\n" was eaten by a regular expression in the lexer *)
while
(
input_char
stdin
!=
'\n'
)
do
()
done
;
loop
()
in
(
try
loop
()
with
End_of_file
->
()
);
...
...
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