aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherbelin2010-10-11 21:10:07 +0000
committerherbelin2010-10-11 21:10:07 +0000
commitf815aa9b59892a6c7cd2823c3c2a2424e616d4f2 (patch)
treea4d6a23f2eeaade4176cda64867784ead68a2d21
parent85e52dd8deaaea8dded6be09e7f733c949fd54c5 (diff)
Backporting r13521 from branch 8.3 to trunk (fixing bug #2406, looping
on unsupported unicode character) + forbidding unsupported unicode in Notation declarations too. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13526 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--parsing/lexer.ml49
-rw-r--r--test-suite/bugs/closed/shouldsucceed/2406.v3
-rw-r--r--toplevel/metasyntax.ml1
3 files changed, 9 insertions, 4 deletions
diff --git a/parsing/lexer.ml4 b/parsing/lexer.ml4
index 15cdc6077a..3c392acb6c 100644
--- a/parsing/lexer.ml4
+++ b/parsing/lexer.ml4
@@ -158,7 +158,7 @@ let lookup_utf8_tail c cs =
| _ -> error_utf8 cs
in
try classify_unicode unicode, n
- with UnsupportedUtf8 -> error_unsupported_unicode_character n cs
+ with UnsupportedUtf8 -> njunk n cs; error_unsupported_unicode_character n cs
let lookup_utf8 cs =
match Stream.peek cs with
@@ -169,8 +169,11 @@ let lookup_utf8 cs =
let check_special_token str =
let rec loop_symb = parser
| [< ' (' ' | '\n' | '\r' | '\t' | '"') >] -> bad_token str
- | [< _ = Stream.empty >] -> ()
- | [< '_ ; s >] -> loop_symb s
+ | [< s >] ->
+ match lookup_utf8 s with
+ | Utf8Token (_,n) -> njunk n s; loop_symb s
+ | AsciiChar -> Stream.junk s; loop_symb s
+ | EmptyStream -> ()
in
loop_symb (Stream.of_string str)
diff --git a/test-suite/bugs/closed/shouldsucceed/2406.v b/test-suite/bugs/closed/shouldsucceed/2406.v
new file mode 100644
index 0000000000..8f56778996
--- /dev/null
+++ b/test-suite/bugs/closed/shouldsucceed/2406.v
@@ -0,0 +1,3 @@
+(* Check correct handling of unsupported notations *)
+Fail Notation "'’'" := (fun x => C) (at level 20).
+Fail Definition crash_the_rooster f := ’.
diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml
index f0cfd5fd97..3d19811688 100644
--- a/toplevel/metasyntax.ml
+++ b/toplevel/metasyntax.ml
@@ -326,7 +326,6 @@ let rec raw_analyze_notation_tokens = function
| String ".." :: sl -> NonTerminal ldots_var :: raw_analyze_notation_tokens sl
| String "_" :: _ -> error "_ must be quoted."
| String x :: sl when is_normal_token x ->
- Lexer.check_ident x;
NonTerminal (Names.id_of_string x) :: raw_analyze_notation_tokens sl
| String s :: sl ->
Lexer.check_keyword s;