JavaScript: add binaries, fix octals, improve escapes & allow Non-ASCII identifiers
Summary: **Changes:** * Add binaries: `0b0101` [1] * Fix octals: the format of octals supported is: `0o1717`, but the HlCOct rule is equivalent to `01717`. [1] * Improve escapes [2]: HlCStringChar rule does not contain the exact escapes supported by JavaScript: * The reserved character escapes are `'"\bfnrtv0`. These are now highlighted in bold (itemData: "Reserved Char. Escape"). * Hexadecimal escapes in JS only support 2 numbers: `\xNN`, but HlCStringChar admits 1 or 2. * The maximum value of octal escape is `\377` (255 in decimal). For example, when typing `\477`, it's only considered as an escape: `\47`. * Any character can be escaped (previously, in the templates, the special character "$" for substitutions is not escaped). * In "JavaScript React" the context "Conditional Expression", which is unnecessary, is eliminated to simplify the code. * Add identifiers with Non-ASCII characters [3], to avoid highlighting RegExp and numbers after non-ASCII characters. This also applies to the highlighting of objects, functions and JSON properties. BUG: 393633 **References:** * [1] Standard ECMA-262, ECMAScript 2015 Language Specification. [11.8.3] Numeric Literals: https://ecma-international.org/ecma-262/6.0/#sec-literals-numeric-literals * [2] Standard ECMA-262, ECMAScript 2015 Language Specification. [11.8.4] String Literals: https://ecma-international.org/ecma-262/6.0/#sec-literals-string-literals * [3] Valid JavaScript variable names in ES2015: https://mathiasbynens.be/notes/javascript-identifiers-es6 Reviewers: dhaumann, cullmann, #framework_syntax_highlighting Reviewed By: cullmann, #framework_syntax_highlighting Subscribers: kwrite-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D13888
parent
ee0aa575
Please register or sign in to comment