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
87ed85ae
Commit
87ed85ae
authored
Apr 01, 2021
by
Kim Nguyễn
Browse files
Revert to reading file with Latin1 encoding by default.
parent
83abca50
Changes
1
Hide whitespace changes
Inline
Side-by-side
lang/parser/parse.ml
View file @
87ed85ae
...
@@ -142,7 +142,7 @@ let rec token enc lexbuf =
...
@@ -142,7 +142,7 @@ let rec token enc lexbuf =
Cduce_loc
.
push_source
(
`File
path
);
Cduce_loc
.
push_source
(
`File
path
);
try
try
let
cs
=
Stream
.
of_channel
ic
in
let
cs
=
Stream
.
of_channel
ic
in
let
newenc
=
ref
Utf8
in
let
newenc
=
ref
Latin1
in
(* or ref !enc ? *)
(* or ref !enc ? *)
let
newlb
=
mk_lexbuf
newenc
cs
in
let
newlb
=
mk_lexbuf
newenc
cs
in
let
past
=
pre_prog
(
token
newenc
newlb
)
in
let
past
=
pre_prog
(
token
newenc
newlb
)
in
...
@@ -173,7 +173,7 @@ let get_loc lexbuf =
...
@@ -173,7 +173,7 @@ let get_loc lexbuf =
(
loc1
.
Lexing
.
pos_cnum
,
loc2
.
Lexing
.
pos_cnum
)
(
loc1
.
Lexing
.
pos_cnum
,
loc2
.
Lexing
.
pos_cnum
)
let
protect_parser
?
global_enc
do_sync
gram
stream
=
let
protect_parser
?
global_enc
do_sync
gram
stream
=
let
enc
=
match
global_enc
with
Some
e
->
e
|
None
->
ref
Utf8
in
let
enc
=
match
global_enc
with
Some
e
->
e
|
None
->
ref
Latin1
in
let
b
=
mk_lexbuf
enc
stream
in
let
b
=
mk_lexbuf
enc
stream
in
try
try
let
f
=
token
enc
b
in
let
f
=
token
enc
b
in
...
@@ -201,7 +201,7 @@ let protect_parser ?global_enc do_sync gram stream =
...
@@ -201,7 +201,7 @@ let protect_parser ?global_enc do_sync gram stream =
let
prog
=
protect_parser
false
pre_prog
let
prog
=
protect_parser
false
pre_prog
let
top_phrases
=
let
top_phrases
=
protect_parser
~
global_enc
:
(
ref
Utf8
)
true
(
for_sedlex
Parser
.
top_phrases
)
protect_parser
~
global_enc
:
(
ref
Latin1
)
true
(
for_sedlex
Parser
.
top_phrases
)
let
protect_exn
f
g
=
let
protect_exn
f
g
=
try
try
...
...
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