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
9867c0d5
Commit
9867c0d5
authored
Apr 06, 2021
by
Kim Nguyễn
Browse files
Add a workaround for the parsing of long identifiers.
parent
bcbb6528
Changes
1
Hide whitespace changes
Inline
Side-by-side
ocamliface/mlcompat_411_12.ml
View file @
9867c0d5
(* Compatibilty for OCaml 4.11 & 4.12 *)
open
Cduce_core
let
()
=
Printexc
.
record_backtrace
true
let
longident_parse
s
=
let
open
Ocaml_common
in
match
String
.
index_opt
s
'.'
with
|
None
->
Longident
.
Lident
s
|
_
->
Parse
.
longident
(
Lexing
.
from_string
s
)
let
open
Ocaml_common
in
let
rec
loop
first
s
=
match
String
.
rindex_opt
s
'.'
with
|
None
->
Longident
.
Lident
s
|
Some
i
->
try
Parse
.
longident
(
Lexing
.
from_string
s
)
with
_
->
try
Parse
.
val_ident
(
Lexing
.
from_string
s
)
with
_
->
try
Parse
.
constr_ident
(
Lexing
.
from_string
s
)
with
|
e
->
(* last resort *)
if
first
then
let
p
,
s
=
String
.
sub
s
0
i
,
String
.
sub
s
(
i
+
1
)
(
String
.
length
s
-
i
-
1
)
in
let
s
=
p
^
".("
^
s
^
")"
in
loop
false
s
else
raise
e
in
loop
true
s
module
Mlstub
=
struct
let
noloc
id
=
Some
id
...
...
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