JavaScript: add binaries, fix octals, improve escapes & allow Non-ASCII identifiers
ClosedPublic

Authored by nibags on Jul 4 2018, 4:50 PM.

Details

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:

Diff Detail

Repository
R216 Syntax Highlighting
Branch
arcpatch-D13888_1
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 2148
Build 2166: arc lint + arc unit
nibags created this revision.Jul 4 2018, 4:50 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 4 2018, 4:50 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
nibags requested review of this revision.Jul 4 2018, 4:50 PM
nibags changed the visibility from "Public (No Login Required)" to "No One".Jul 4 2018, 4:50 PM
nibags changed the edit policy from "All Users" to "No One".
nibags removed a project: Frameworks.
nibags removed a subscriber: kde-frameworks-devel.
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 4 2018, 4:50 PM
nibags removed R216 Syntax Highlighting as the repository for this revision.Jul 4 2018, 4:52 PM
nibags removed a project: Frameworks.
nibags updated this revision to Diff 40109.Aug 21 2018, 5:56 AM

JavaScript: add binaries, fix octals and improve escapes

Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptAug 21 2018, 5:56 AM
nibags retitled this revision from JavaScript: Add unicode escape `\u{1234\}` to JavaScript: add binaries, fix octals and improve escapes.Aug 21 2018, 6:01 AM
nibags edited the summary of this revision. (Show Details)
nibags changed the visibility from "No One" to "Public (No Login Required)".
nibags changed the edit policy from "No One" to "All Users".
Restricted Application added a subscriber: kwrite-devel. · View Herald TranscriptAug 21 2018, 6:01 AM
nibags updated this revision to Diff 40116.Aug 21 2018, 7:24 AM
  • Allow identifiers with Non-ASCII characters
nibags retitled this revision from JavaScript: add binaries, fix octals and improve escapes to JavaScript: add binaries, fix octals, improve escapes & allow Non-ASCII identifiers.Aug 21 2018, 7:27 AM
nibags edited the summary of this revision. (Show Details)
cullmann accepted this revision.Aug 22 2018, 7:28 PM

All fine, thanks!

Btw., just for future reference: Would you be OK to have your contributions MIT licensed?

This revision is now accepted and ready to land.Aug 22 2018, 7:28 PM

I have no problem with using MIT!

Before doing the commit I will add a comment in the file, mentioning the bug reported

nibags updated this revision to Diff 40291.Aug 23 2018, 10:44 AM
nibags edited the summary of this revision. (Show Details)
  • Add comment

Ok, thanks!
Feel free to commit after adding the comments.

nibags closed this revision.Aug 23 2018, 10:46 AM