Extend unicode support

* Support \u{xxxx} syntax
 * Add support for surrogate pairs
 * Allow identifiers to have unicode escape sequence
This commit is contained in:
Anthony Van de Gejuchte
2016-06-22 17:12:23 +02:00
committed by Richard van Velzen
parent 07785d0003
commit 63c432f4fa
4 changed files with 292 additions and 64 deletions

View File

@@ -15,3 +15,29 @@ unicode_parse_variables: {
var l = 3;
}
}
unicode_escaped_identifier: {
input: {
var \u{61} = "foo";
var \u{10000} = "bar";
}
expect_exact: 'var a="foo";var \u{10000}="bar";';
}
unicode_identifier_ascii_only: {
beautify = {ascii_only: true}
input: {
var \u{0061} = "hi";
var bar = "h\u{0065}llo";
var \u{10000} = "testing \u{101111}";
}
expect_exact: 'var a="hi";var bar="hello";var \\u{10000}="testing \\u{101111}";'
}
unicode_string_literals: {
beautify = {ascii_only: true}
input: {
var a = "6 length unicode character: \u{101111}";
}
expect_exact: 'var a="6 length unicode character: \\u{101111}";'
}