Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
91584e55
Commit
91584e55
authored
Sep 02, 2011
by
Andrei Paskevich
Browse files
accept string literals in use/clone qualifiers
parent
b56e22bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/env.ml
View file @
91584e55
...
...
@@ -117,8 +117,21 @@ let locate_file name lp path =
|
[
file
]
->
file
|
file1
::
file2
::
_
->
raise
(
AmbiguousPath
(
file1
,
file2
))
exception
InvalidQualifier
of
string
let
check_qualifier
s
=
let
find_dir_sep
s
=
let
re
=
Str
.
regexp_string
Filename
.
dir_sep
in
try
ignore
(
Str
.
search_forward
re
s
0
);
true
with
Not_found
->
false
in
if
(
s
=
Filename
.
parent_dir_name
||
s
=
Filename
.
current_dir_name
||
find_dir_sep
s
)
then
raise
(
InvalidQualifier
s
)
let
create_env_of_loadpath
lp
=
let
fc
f
sl
=
List
.
iter
check_qualifier
sl
;
let
file
=
locate_file
f
lp
sl
in
file
,
open_in
file
in
...
...
@@ -176,6 +189,8 @@ let () = Exn_printer.register
Format
.
fprintf
fmt
"Format not specified"
|
AmbiguousPath
(
f1
,
f2
)
->
Format
.
fprintf
fmt
"Ambiguous path:@ both `%s'@ and `%s'@ match"
f1
f2
|
InvalidQualifier
s
->
Format
.
fprintf
fmt
"Invalid qualifier `%s'"
s
|
_
->
raise
exn
end
src/parser/parser.mly
View file @
91584e55
...
...
@@ -330,10 +330,8 @@ decl:
{
UseClone
(
floc
()
,
$
2
,
None
)
}
|
CLONE
use
clone_subst
{
UseClone
(
floc
()
,
$
2
,
Some
$
3
)
}
|
META
ident
list1_meta_arg_sep_comma
|
META
s
ident
list1_meta_arg_sep_comma
{
Meta
(
floc
()
,
$
2
,
$
3
)
}
|
META
STRING
list1_meta_arg_sep_comma
{
Meta
(
floc
()
,
mk_id
$
2
(
floc_i
2
)
,
$
3
)
}
;
/*
Use
and
clone
*/
...
...
@@ -906,8 +904,13 @@ tqualid:
;
any_qualid
:
|
ident
{
Qident
$
1
}
|
any_qualid
DOT
ident
{
Qdot
(
$
1
,
$
3
)
}
|
sident
{
Qident
$
1
}
|
any_qualid
DOT
sident
{
Qdot
(
$
1
,
$
3
)
}
;
sident
:
|
ident
{
$
1
}
|
STRING
{
mk_id
$
1
(
floc
()
)
}
;
/*
Misc
*/
...
...
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