2017-08-06 17:36:50 +02:00
|
|
|
|
// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
|
2015-11-15 02:37:49 +05:30
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
|
|
// Characters and their corresponding confusables were collected from
|
2017-08-06 17:36:50 +02:00
|
|
|
|
// http://www.unicode.org/Public/security/10.0.0/confusables.txt
|
2015-11-15 02:37:49 +05:30
|
|
|
|
|
2017-03-15 00:22:48 +00:00
|
|
|
|
use syntax_pos::{Span, NO_EXPANSION};
|
2015-12-21 10:00:43 +13:00
|
|
|
|
use errors::DiagnosticBuilder;
|
2015-11-15 02:37:49 +05:30
|
|
|
|
use super::StringReader;
|
|
|
|
|
|
|
|
|
|
const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('
', "Line Separator", ' '),
|
|
|
|
|
('
', "Paragraph Separator", ' '),
|
|
|
|
|
(' ', "Ogham Space mark", ' '),
|
2016-04-21 20:05:47 +08:00
|
|
|
|
(' ', "En Quad", ' '),
|
|
|
|
|
(' ', "Em Quad", ' '),
|
|
|
|
|
(' ', "En Space", ' '),
|
|
|
|
|
(' ', "Em Space", ' '),
|
|
|
|
|
(' ', "Three-Per-Em Space", ' '),
|
|
|
|
|
(' ', "Four-Per-Em Space", ' '),
|
|
|
|
|
(' ', "Six-Per-Em Space", ' '),
|
|
|
|
|
(' ', "Punctuation Space", ' '),
|
|
|
|
|
(' ', "Thin Space", ' '),
|
|
|
|
|
(' ', "Hair Space", ' '),
|
|
|
|
|
(' ', "Medium Mathematical Space", ' '),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
(' ', "No-Break Space", ' '),
|
|
|
|
|
(' ', "Figure Space", ' '),
|
|
|
|
|
(' ', "Narrow No-Break Space", ' '),
|
2016-04-21 20:05:47 +08:00
|
|
|
|
(' ', "Ideographic Space", ' '),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ߺ', "Nko Lajanyalan", '_'),
|
|
|
|
|
('﹍', "Dashed Low Line", '_'),
|
|
|
|
|
('﹎', "Centreline Low Line", '_'),
|
|
|
|
|
('﹏', "Wavy Low Line", '_'),
|
2017-08-06 18:34:36 +02:00
|
|
|
|
('_', "Fullwidth Low Line", '_'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('‐', "Hyphen", '-'),
|
|
|
|
|
('‑', "Non-Breaking Hyphen", '-'),
|
|
|
|
|
('‒', "Figure Dash", '-'),
|
|
|
|
|
('–', "En Dash", '-'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('—', "Em Dash", '-'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('﹘', "Small Em Dash", '-'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('۔', "Arabic Full Stop", '-'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('⁃', "Hyphen Bullet", '-'),
|
|
|
|
|
('˗', "Modifier Letter Minus Sign", '-'),
|
|
|
|
|
('−', "Minus Sign", '-'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('➖', "Heavy Minus Sign", '-'),
|
|
|
|
|
('Ⲻ', "Coptic Letter Dialect-P Ni", '-'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('ー', "Katakana-Hiragana Prolonged Sound Mark", '-'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('-', "Fullwidth Hyphen-Minus", '-'),
|
|
|
|
|
('―', "Horizontal Bar", '-'),
|
|
|
|
|
('─', "Box Drawings Light Horizontal", '-'),
|
|
|
|
|
('━', "Box Drawings Heavy Horizontal", '-'),
|
|
|
|
|
('㇐', "CJK Stroke H", '-'),
|
|
|
|
|
('ꟷ', "Latin Epigraphic Letter Dideways", '-'),
|
|
|
|
|
('ᅳ', "Hangul Jungseong Eu", '-'),
|
|
|
|
|
('ㅡ', "Hangul Letter Eu", '-'),
|
|
|
|
|
('一', "CJK Unified Ideograph-4E00", '-'),
|
|
|
|
|
('⼀', "Kangxi Radical One", '-'),
|
|
|
|
|
|
|
|
|
|
('؍', "Arabic Date Separator", ','),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('٫', "Arabic Decimal Separator", ','),
|
|
|
|
|
('‚', "Single Low-9 Quotation Mark", ','),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('¸', "Cedilla", ','),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ꓹ', "Lisu Letter Tone Na Po", ','),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
(',', "Fullwidth Comma", ','),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
(';', "Greek Question Mark", ';'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
(';', "Fullwidth Semicolon", ';'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('︔', "Presentation Form For Vertical Semicolon", ';'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ः', "Devanagari Sign Visarga", ':'),
|
|
|
|
|
('ઃ', "Gujarati Sign Visarga", ':'),
|
|
|
|
|
(':', "Fullwidth Colon", ':'),
|
|
|
|
|
('։', "Armenian Full Stop", ':'),
|
|
|
|
|
('܃', "Syriac Supralinear Colon", ':'),
|
|
|
|
|
('܄', "Syriac Sublinear Colon", ':'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('᛬', "Runic Multiple Ponctuation", ':'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('︰', "Presentation Form For Vertical Two Dot Leader", ':'),
|
|
|
|
|
('᠃', "Mongolian Full Stop", ':'),
|
|
|
|
|
('᠉', "Mongolian Manchu Full Stop", ':'),
|
|
|
|
|
('⁚', "Two Dot Punctuation", ':'),
|
|
|
|
|
('׃', "Hebrew Punctuation Sof Pasuq", ':'),
|
|
|
|
|
('˸', "Modifier Letter Raised Colon", ':'),
|
|
|
|
|
('꞉', "Modifier Letter Colon", ':'),
|
|
|
|
|
('∶', "Ratio", ':'),
|
|
|
|
|
('ː', "Modifier Letter Triangular Colon", ':'),
|
|
|
|
|
('ꓽ', "Lisu Letter Tone Mya Jeu", ':'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('︓', "Presentation Form For Vertical Colon", ':'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('!', "Fullwidth Exclamation Mark", '!'),
|
|
|
|
|
('ǃ', "Latin Letter Retroflex Click", '!'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('ⵑ', "Tifinagh Letter Tuareg Yang", '!'),
|
|
|
|
|
('︕', "Presentation Form For Vertical Exclamation Mark", '!'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ʔ', "Latin Letter Glottal Stop", '?'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('Ɂ', "Latin Capital Letter Glottal Stop", '?'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ॽ', "Devanagari Letter Glottal Stop", '?'),
|
|
|
|
|
('Ꭾ', "Cherokee Letter He", '?'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('ꛫ', "Bamum Letter Ntuu", '?'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('?', "Fullwidth Question Mark", '?'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('︖', "Presentation Form For Vertical Question Mark", '?'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('𝅭', "Musical Symbol Combining Augmentation Dot", '.'),
|
|
|
|
|
('․', "One Dot Leader", '.'),
|
|
|
|
|
('܁', "Syriac Supralinear Full Stop", '.'),
|
|
|
|
|
('܂', "Syriac Sublinear Full Stop", '.'),
|
|
|
|
|
('꘎', "Vai Full Stop", '.'),
|
|
|
|
|
('𐩐', "Kharoshthi Punctuation Dot", '.'),
|
|
|
|
|
('٠', "Arabic-Indic Digit Zero", '.'),
|
|
|
|
|
('۰', "Extended Arabic-Indic Digit Zero", '.'),
|
|
|
|
|
('ꓸ', "Lisu Letter Tone Mya Ti", '.'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('·', "Middle Dot", '.'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('・', "Katakana Middle Dot", '.'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('・', "Halfwidth Katakana Middle Dot", '.'),
|
|
|
|
|
('᛫', "Runic Single Punctuation", '.'),
|
|
|
|
|
('·', "Greek Ano Teleia", '.'),
|
|
|
|
|
('⸱', "Word Separator Middle Dot", '.'),
|
|
|
|
|
('𐄁', "Aegean Word Separator Dot", '.'),
|
|
|
|
|
('•', "Bullet", '.'),
|
|
|
|
|
('‧', "Hyphenation Point", '.'),
|
|
|
|
|
('∙', "Bullet Operator", '.'),
|
|
|
|
|
('⋅', "Dot Operator", '.'),
|
|
|
|
|
('ꞏ', "Latin Letter Sinological Dot", '.'),
|
|
|
|
|
('ᐧ', "Canadian Syllabics Final Middle Dot", '.'),
|
|
|
|
|
('ᐧ', "Canadian Syllabics Final Middle Dot", '.'),
|
|
|
|
|
('.', "Fullwidth Full Stop", '.'),
|
|
|
|
|
('。', "Ideographic Full Stop", '.'),
|
|
|
|
|
('︒', "Presentation Form For Vertical Ideographic Full Stop", '.'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('՝', "Armenian Comma", '\''),
|
|
|
|
|
(''', "Fullwidth Apostrophe", '\''),
|
|
|
|
|
('‘', "Left Single Quotation Mark", '\''),
|
|
|
|
|
('’', "Right Single Quotation Mark", '\''),
|
|
|
|
|
('‛', "Single High-Reversed-9 Quotation Mark", '\''),
|
|
|
|
|
('′', "Prime", '\''),
|
|
|
|
|
('‵', "Reversed Prime", '\''),
|
|
|
|
|
('՚', "Armenian Apostrophe", '\''),
|
|
|
|
|
('׳', "Hebrew Punctuation Geresh", '\''),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('`', "Greek Accent", '\''),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('`', "Greek Varia", '\''),
|
|
|
|
|
('`', "Fullwidth Grave Accent", '\''),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('´', "Acute Accent", '\''),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('΄', "Greek Tonos", '\''),
|
|
|
|
|
('´', "Greek Oxia", '\''),
|
|
|
|
|
('᾽', "Greek Koronis", '\''),
|
|
|
|
|
('᾿', "Greek Psili", '\''),
|
|
|
|
|
('῾', "Greek Dasia", '\''),
|
|
|
|
|
('ʹ', "Modifier Letter Prime", '\''),
|
|
|
|
|
('ʹ', "Greek Numeral Sign", '\''),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('ˈ', "Modifier Letter Vertical Line", '\''),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ˊ', "Modifier Letter Acute Accent", '\''),
|
|
|
|
|
('ˋ', "Modifier Letter Grave Accent", '\''),
|
|
|
|
|
('˴', "Modifier Letter Middle Grave Accent", '\''),
|
|
|
|
|
('ʻ', "Modifier Letter Turned Comma", '\''),
|
|
|
|
|
('ʽ', "Modifier Letter Reversed Comma", '\''),
|
|
|
|
|
('ʼ', "Modifier Letter Apostrophe", '\''),
|
|
|
|
|
('ʾ', "Modifier Letter Right Half Ring", '\''),
|
|
|
|
|
('ꞌ', "Latin Small Letter Saltillo", '\''),
|
|
|
|
|
('י', "Hebrew Letter Yod", '\''),
|
|
|
|
|
('ߴ', "Nko High Tone Apostrophe", '\''),
|
|
|
|
|
('ߵ', "Nko Low Tone Apostrophe", '\''),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('ᑊ', "Canadian Syllabics West-Cree P", '\''),
|
|
|
|
|
('ᛌ', "Runic Letter Short-Twig-Sol S", '\''),
|
|
|
|
|
('𖽑', "Miao Sign Aspiration", '\''),
|
|
|
|
|
('𖽒', "Miao Sign Reformed Voicing", '\''),
|
|
|
|
|
|
|
|
|
|
('᳓', "Vedic Sign Nihshvasa", '"'),
|
2015-11-18 10:32:43 +11:00
|
|
|
|
('"', "Fullwidth Quotation Mark", '"'),
|
|
|
|
|
('“', "Left Double Quotation Mark", '"'),
|
|
|
|
|
('”', "Right Double Quotation Mark", '"'),
|
|
|
|
|
('‟', "Double High-Reversed-9 Quotation Mark", '"'),
|
|
|
|
|
('″', "Double Prime", '"'),
|
|
|
|
|
('‶', "Reversed Double Prime", '"'),
|
|
|
|
|
('〃', "Ditto Mark", '"'),
|
|
|
|
|
('״', "Hebrew Punctuation Gershayim", '"'),
|
|
|
|
|
('˝', "Double Acute Accent", '"'),
|
|
|
|
|
('ʺ', "Modifier Letter Double Prime", '"'),
|
|
|
|
|
('˶', "Modifier Letter Middle Double Acute Accent", '"'),
|
|
|
|
|
('˵', "Modifier Letter Middle Double Grave Accent", '"'),
|
|
|
|
|
('ˮ', "Modifier Letter Double Apostrophe", '"'),
|
|
|
|
|
('ײ', "Hebrew Ligature Yiddish Double Yod", '"'),
|
|
|
|
|
('❞', "Heavy Double Comma Quotation Mark Ornament", '"'),
|
|
|
|
|
('❝', "Heavy Double Turned Comma Quotation Mark Ornament", '"'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
|
|
|
|
('(', "Fullwidth Left Parenthesis", '('),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('❨', "Medium Left Parenthesis Ornament", '('),
|
|
|
|
|
('﴾', "Ornate Left Parenthesis", '('),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
|
|
|
|
(')', "Fullwidth Right Parenthesis", ')'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('❩', "Medium Right Parenthesis Ornament", ')'),
|
|
|
|
|
('﴿', "Ornate Right Parenthesis", ')'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2016-04-21 20:09:26 +08:00
|
|
|
|
('[', "Fullwidth Left Square Bracket", '['),
|
|
|
|
|
('❲', "Light Left Tortoise Shell Bracket Ornament", '['),
|
2016-04-21 20:17:51 +08:00
|
|
|
|
('「', "Left Corner Bracket", '['),
|
|
|
|
|
('『', "Left White Corner Bracket", '['),
|
|
|
|
|
('【', "Left Black Lenticular Bracket", '['),
|
2016-04-21 20:09:26 +08:00
|
|
|
|
('〔', "Left Tortoise Shell Bracket", '['),
|
2016-04-21 20:17:51 +08:00
|
|
|
|
('〖', "Left White Lenticular Bracket", '['),
|
|
|
|
|
('〘', "Left White Tortoise Shell Bracket", '['),
|
|
|
|
|
('〚', "Left White Square Bracket", '['),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2016-04-21 20:09:26 +08:00
|
|
|
|
(']', "Fullwidth Right Square Bracket", ']'),
|
|
|
|
|
('❳', "Light Right Tortoise Shell Bracket Ornament", ']'),
|
2016-04-21 20:17:51 +08:00
|
|
|
|
('」', "Right Corner Bracket", ']'),
|
|
|
|
|
('』', "Right White Corner Bracket", ']'),
|
|
|
|
|
('】', "Right Black Lenticular Bracket", ']'),
|
2016-04-21 20:09:26 +08:00
|
|
|
|
('〕', "Right Tortoise Shell Bracket", ']'),
|
2016-04-21 20:17:51 +08:00
|
|
|
|
('〗', "Right White Lenticular Bracket", ']'),
|
|
|
|
|
('〙', "Right White Tortoise Shell Bracket", ']'),
|
|
|
|
|
('〛', "Right White Square Bracket", ']'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('❴', "Medium Left Curly Bracket Ornament", '{'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('𝄔', "Musical Symbol Brace", '{'),
|
|
|
|
|
('{', "Fullwidth Left Curly Bracket", '{'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('❵', "Medium Right Curly Bracket Ornament", '}'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('}', "Fullwidth Right Curly Bracket", '}'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('⁎', "Low Asterisk", '*'),
|
|
|
|
|
('٭', "Arabic Five Pointed Star", '*'),
|
|
|
|
|
('∗', "Asterisk Operator", '*'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('𐌟', "Old Italic Letter Ess", '*'),
|
|
|
|
|
('*', "Fullwidth Asterisk", '*'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('᜵', "Philippine Single Punctuation", '/'),
|
|
|
|
|
('⁁', "Caret Insertion Point", '/'),
|
|
|
|
|
('∕', "Division Slash", '/'),
|
|
|
|
|
('⁄', "Fraction Slash", '/'),
|
|
|
|
|
('╱', "Box Drawings Light Diagonal Upper Right To Lower Left", '/'),
|
|
|
|
|
('⟋', "Mathematical Rising Diagonal", '/'),
|
|
|
|
|
('⧸', "Big Solidus", '/'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('𝈺', "Greek Instrumental Notation Symbol-47", '/'),
|
|
|
|
|
('㇓', "CJK Stroke Sp", '/'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('〳', "Vertical Kana Repeat Mark Upper Half", '/'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('Ⳇ', "Coptic Capital Letter Old Coptic Esh", '/'),
|
|
|
|
|
('ノ', "Katakana Letter No", '/'),
|
|
|
|
|
('丿', "CJK Unified Ideograph-4E3F", '/'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('⼃', "Kangxi Radical Slash", '/'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('/', "Fullwidth Solidus", '/'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('\', "Fullwidth Reverse Solidus", '\\'),
|
|
|
|
|
('﹨', "Small Reverse Solidus", '\\'),
|
|
|
|
|
('∖', "Set Minus", '\\'),
|
|
|
|
|
('⟍', "Mathematical Falling Diagonal", '\\'),
|
|
|
|
|
('⧵', "Reverse Solidus Operator", '\\'),
|
|
|
|
|
('⧹', "Big Reverse Solidus", '\\'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('⧹', "Greek Vocal Notation Symbol-16", '\\'),
|
|
|
|
|
('⧹', "Greek Instrumental Symbol-48", '\\'),
|
|
|
|
|
('㇔', "CJK Stroke D", '\\'),
|
|
|
|
|
('丶', "CJK Unified Ideograph-4E36", '\\'),
|
|
|
|
|
('⼂', "Kangxi Radical Dot", '\\'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('、', "Ideographic Comma", '\\'),
|
|
|
|
|
('ヽ', "Katakana Iteration Mark", '\\'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('ꝸ', "Latin Small Letter Um", '&'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('&', "Fullwidth Ampersand", '&'),
|
|
|
|
|
|
|
|
|
|
('᛭', "Runic Cros Punctuation", '+'),
|
|
|
|
|
('➕', "Heavy Plus Sign", '+'),
|
|
|
|
|
('𐊛', "Lycian Letter H", '+'),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('﬩', "Hebrew Letter Alternative Plus Sign", '+'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('+', "Fullwidth Plus Sign", '+'),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('‹', "Single Left-Pointing Angle Quotation Mark", '<'),
|
|
|
|
|
('❮', "Heavy Left-Pointing Angle Quotation Mark Ornament", '<'),
|
|
|
|
|
('˂', "Modifier Letter Left Arrowhead", '<'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('𝈶', "Greek Instrumental Symbol-40", '<'),
|
|
|
|
|
('ᐸ', "Canadian Syllabics Pa", '<'),
|
|
|
|
|
('ᚲ', "Runic Letter Kauna", '<'),
|
|
|
|
|
('❬', "Medium Left-Pointing Angle Bracket Ornament", '<'),
|
|
|
|
|
('⟨', "Mathematical Left Angle Bracket", '<'),
|
|
|
|
|
('〈', "Left-Pointing Angle Bracket", '<'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('〈', "Left Angle Bracket", '<'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('㇛', "CJK Stroke Pd", '<'),
|
|
|
|
|
('く', "Hiragana Letter Ku", '<'),
|
|
|
|
|
('𡿨', "CJK Unified Ideograph-21FE8", '<'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('《', "Left Double Angle Bracket", '<'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('<', "Fullwidth Less-Than Sign", '<'),
|
|
|
|
|
|
|
|
|
|
('᐀', "Canadian Syllabics Hyphen", '='),
|
|
|
|
|
('⹀', "Double Hyphen", '='),
|
|
|
|
|
('゠', "Katakana-Hiragana Double Hyphen", '='),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('꓿', "Lisu Punctuation Full Stop", '='),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('=', "Fullwidth Equals Sign", '='),
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('›', "Single Right-Pointing Angle Quotation Mark", '>'),
|
|
|
|
|
('❯', "Heavy Right-Pointing Angle Quotation Mark Ornament", '>'),
|
|
|
|
|
('˃', "Modifier Letter Right Arrowhead", '>'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('𝈷', "Greek Instrumental Symbol-42", '>'),
|
|
|
|
|
('ᐳ', "Canadian Syllabics Po", '>'),
|
|
|
|
|
('𖼿', "Miao Letter Archaic Zza", '>'),
|
|
|
|
|
('❭', "Medium Right-Pointing Angle Bracket Ornament", '>'),
|
|
|
|
|
('⟩', "Mathematical Right Angle Bracket", '>'),
|
|
|
|
|
('〉', "Right-Pointing Angle Bracket", '>'),
|
2016-04-21 17:51:47 +08:00
|
|
|
|
('〉', "Right Angle Bracket", '>'),
|
|
|
|
|
('》', "Right Double Angle Bracket", '>'),
|
2017-08-06 17:36:50 +02:00
|
|
|
|
('>', "Fullwidth Greater-Than Sign", '>'), ];
|
|
|
|
|
|
2015-11-15 02:37:49 +05:30
|
|
|
|
|
|
|
|
|
const ASCII_ARRAY: &'static [(char, &'static str)] = &[
|
2016-04-21 20:05:47 +08:00
|
|
|
|
(' ', "Space"),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('_', "Underscore"),
|
|
|
|
|
('-', "Minus/Hyphen"),
|
|
|
|
|
(',', "Comma"),
|
|
|
|
|
(';', "Semicolon"),
|
|
|
|
|
(':', "Colon"),
|
|
|
|
|
('!', "Exclamation Mark"),
|
|
|
|
|
('?', "Question Mark"),
|
|
|
|
|
('.', "Period"),
|
|
|
|
|
('\'', "Single Quote"),
|
2015-11-18 10:32:43 +11:00
|
|
|
|
('"', "Quotation Mark"),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('(', "Left Parenthesis"),
|
|
|
|
|
(')', "Right Parenthesis"),
|
2016-04-21 20:09:26 +08:00
|
|
|
|
('[', "Left Square Bracket"),
|
|
|
|
|
(']', "Right Square Bracket"),
|
2015-11-15 02:37:49 +05:30
|
|
|
|
('{', "Left Curly Brace"),
|
|
|
|
|
('}', "Right Curly Brace"),
|
|
|
|
|
('*', "Asterisk"),
|
|
|
|
|
('/', "Slash"),
|
|
|
|
|
('\\', "Backslash"),
|
|
|
|
|
('&', "Ampersand"),
|
|
|
|
|
('+', "Plus Sign"),
|
|
|
|
|
('<', "Less-Than Sign"),
|
|
|
|
|
('=', "Equals Sign"),
|
|
|
|
|
('>', "Greater-Than Sign"), ];
|
|
|
|
|
|
2015-12-21 10:00:43 +13:00
|
|
|
|
pub fn check_for_substitution<'a>(reader: &StringReader<'a>,
|
|
|
|
|
ch: char,
|
|
|
|
|
err: &mut DiagnosticBuilder<'a>) {
|
2015-11-15 02:37:49 +05:30
|
|
|
|
UNICODE_ARRAY
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|&&(c, _, _)| c == ch)
|
|
|
|
|
.map(|&(_, u_name, ascii_char)| {
|
2017-03-15 00:22:48 +00:00
|
|
|
|
let span = Span { lo: reader.pos, hi: reader.next_pos, ctxt: NO_EXPANSION };
|
2015-11-15 02:37:49 +05:30
|
|
|
|
match ASCII_ARRAY.iter().find(|&&(c, _)| c == ascii_char) {
|
|
|
|
|
Some(&(ascii_char, ascii_name)) => {
|
|
|
|
|
let msg =
|
2017-05-20 11:18:26 -04:00
|
|
|
|
format!("unicode character '{}' ({}) looks like '{}' ({}), but it's not",
|
2015-11-15 02:37:49 +05:30
|
|
|
|
ch, u_name, ascii_char, ascii_name);
|
2015-12-21 10:00:43 +13:00
|
|
|
|
err.span_help(span, &msg);
|
2015-11-15 02:37:49 +05:30
|
|
|
|
},
|
|
|
|
|
None => {
|
2017-01-17 01:14:53 +00:00
|
|
|
|
let msg = format!("substitution character not found for '{}'", ch);
|
|
|
|
|
reader.sess.span_diagnostic.span_bug_no_panic(span, &msg);
|
2015-11-15 02:37:49 +05:30
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|