aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2016-10-05 17:56:59 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2016-10-05 17:56:59 +0200
commit8114da3ba8a9b31ffe194e7f7f0239ecc2219b9c (patch)
treed8924a831c286430001bbf22c68a54eeb3a84233
parent6cfdf1ca60535f6e9ee6c5e0d5c546d34e803c61 (diff)
parent14f8db195021e709734ed89d9cb513d1c0db6a93 (diff)
Merge branch 'v8.5' into v8.6
-rw-r--r--test-suite/bugs/closed/4970.v3
-rw-r--r--toplevel/metasyntax.ml5
2 files changed, 7 insertions, 1 deletions
diff --git a/test-suite/bugs/closed/4970.v b/test-suite/bugs/closed/4970.v
new file mode 100644
index 000000000..7a896582f
--- /dev/null
+++ b/test-suite/bugs/closed/4970.v
@@ -0,0 +1,3 @@
+(* Check "{{" is not confused with "{" in notations *)
+Reserved Notation "x {{ y }}" (at level 40).
+Notation "x {{ y }}" := (x y) (only parsing).
diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml
index 42f65dfb5..008d5cf9f 100644
--- a/toplevel/metasyntax.ml
+++ b/toplevel/metasyntax.ml
@@ -1093,7 +1093,10 @@ let contract_notation ntn =
let rec aux ntn i =
if i <= String.length ntn - 5 then
let ntn' =
- if String.is_sub "{ _ }" ntn i then
+ if String.is_sub "{ _ }" ntn i &&
+ (i = 0 || ntn.[i-1] = ' ') &&
+ (i = String.length ntn - 5 || ntn.[i+5] = ' ')
+ then
String.sub ntn 0 i ^ "_" ^
String.sub ntn (i+5) (String.length ntn -i-5)
else ntn in